Open c4-bot-5 opened 5 months ago
raymondfam marked the issue as sufficient quality report
raymondfam marked the issue as primary issue
Will let the sponsor review it but the mitigation step seems infeasible.
This is a general problem with eth_estimateUserOperationGas. You want to construct a dummy signature that will match as closely as possible to the real signature, so that validation proceeds and you can get an accurate gas estimation. We have been using this for months with no issue.
wilsoncusack (sponsor) disputed
It is common practice to submit regular transactions with a gas limit that includes a margin on top of what's simulated, or at least re-simulating the final transaction before sending it. Worth keeping this as QA though.
3docSec changed the severity to QA (Quality Assurance)
3docSec marked the issue as grade-a
Lines of code
https://github.com/code-423n4/2024-03-coinbase/blob/main/src/SmartWallet/CoinbaseSmartWallet.sol#L321 https://github.com/code-423n4/2024-03-coinbase/blob/main/src/WebAuthnSol/WebAuthn.sol#L122-L128
Vulnerability details
Impact
The userOps using webauthn must get lesser
verificationGasLimit
when callingeth_estimateUserOperationGas
api to estimate the gas values for a UserOperation.With lesser
verificationGasLimit
, those userOps will be rejected by bundlers.Proof of Concept
UserOp
op
has unset gas fields.Signature of
op
will be set to a dummy webauthn signature where current userOpHashhash1
is encoded aschallenge
ofwebAuthn
.Call
eth_estimateUserOperationGas
api of bundler with currentop
.Gas fields will be set to different gas values by the bundler to find the best gas settings.
However, different gas values results in a different userOpHash
hash2
.For
hash1
is not equal tohash2
, the gas estimation will exit early here and result in a estimatedverificationGasLimit
which does not cover the following checks.verificationGasLimit
.verificationGasLimit
of userOp will be set to a lesserverificationGasLimit
from gas estimation.op
with a lesserverificationGasLimit
will be rejected by bundlers.Relate info about this findings
Recommended Mitigation Steps
userOpHash
to userOp.signature.Assessed type
Other