Closed c4-bot-9 closed 8 months ago
Known issue per contest readme: validatePaymasterUserOp checks address.balance, which currently violates ERC-7562 rules, however there is PR to change this.
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as primary issue
3docSec marked the issue as unsatisfactory: Out of scope
Lines of code
https://github.com/code-423n4/2024-03-coinbase/blob/main/src/MagicSpend/MagicSpend.sol#L133-L135
Vulnerability details
Impact
The contract balance cannot be queried in the validation code due to storage access restrictions of ERC-4337.
Proof of Concept
The Paymaster uses the
SELFBALANCE
opcode during the validation phase:https://github.com/code-423n4/2024-03-coinbase/blob/main/src/MagicSpend/MagicSpend.sol#L133-L135
This is one of the Opcodes that it's blocked during validation:
https://docs.stackup.sh/docs/opcode-rules#op-011-blocked-opcodes
Additional info about this issue can be found in the TokenPaymaster template, even if it's a different model (it uses ERC20 as payment):
https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/samples/TokenPaymaster.sol#L15-L25
Tools Used
Manual review
Recommended Mitigation Steps
It's difficult to provide a solution to this as it impacts the entire design, but blocked opcodes should be avoided during the validation phase.
Assessed type
Context