Closed c4-bot-1 closed 6 months ago
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as primary issue
Incremental nonce is not needed here as userOp.nonce is only there to match up with REPLAYABLE_NONCE_KEY after userOpHash is recomputed.
The logic that the warden expected to find (nonce check + increment) is implemented upstream in the EntryPoint
through its parent NonceManager
, making the reported attack path not viable by ensuring replay is not possible.
3docSec marked the issue as unsatisfactory: Invalid
3docSec marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-coinbase/blob/e0573369b865d47fed778de00a7b6df65ab1744e/src/SmartWallet/CoinbaseSmartWallet.sol#L137-L168 https://github.com/code-423n4/2024-03-coinbase/blob/e0573369b865d47fed778de00a7b6df65ab1744e/src/SmartWallet/CoinbaseSmartWallet.sol#L145-L152
Vulnerability details
The nonce mechanism in CoinbaseSmartWallet.sol has potential issue related to nonce uniqueness and ordering for non-replayable user operations. The current implementation does not explicitly check the uniqueness of nonces and does not enforce strict ordering, which could lead to replay attacks and out-of-order execution of user operations within the same chain.
Description:
validateUserOp
, which is responsible for validating user operations takes the following parameters:userOp
: The user operation to be validated.userOpHash
: The hash of the user operation.missingAccountFunds
: The missing account funds required for the operation.Loc: validateUserOp
The function extracts the
key
from the upper 192 bits of theuserOp.nonce
field and uses it to determine whether the user operation is intended for cross-chain replay or not.a. Nonce Uniqueness:
validateUserOp
function does not check if the nonce has already been used for non-replayable user operations.If the same nonce is used for multiple non-replayable user operations, it could lead to replay attacks within the same chain.
b. Nonce Ordering:
validateUserOp
function does not enforce any specific ordering or sequencing of nonces for non-replayable user operations.Loc: #145-L151
These lines extract the
key
from theuserOp.nonce
and check if it is a replayable or non-replayable user operation, but they do not perform any checks for nonce uniqueness or ordering.Impact
If the same nonce is used for multiple non-replayable user operations, an attacker can replay a previously executed user operation, potentially leading to unintended or malicious actions.
Recommended Mitigation Steps
a. Nonce Uniqueness:
b. Nonce Ordering:
Assessed type
Invalid Validation