-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Users can front run the signature of the paymaster operation leading to some problems. #39
Comments
raymondfam marked the issue as insufficient quality report |
raymondfam marked the issue as primary issue |
raymondfam marked the issue as sufficient quality report |
Will let the sponsor verify the runnable POC. |
To be clear, the same signature cannot be used twice. The front run is interesting: requires a user to submit a userOp with the withdraw signature in |
wilsoncusack marked the issue as disagree with severity |
wilsoncusack (sponsor) acknowledged |
Because the front-run signature would DoS the second one, tokens would be spent only once (invalidating point 2. of the impact), so it looks more like a grieving attack on the MS reputation with no tokens at risk => medium seems more appropriate. |
3docSec changed the severity to 2 (Med Risk) |
3docSec marked the issue as satisfactory |
3docSec marked the issue as selected for report |
Lines of code
https://github.com/code-423n4/2024-03-coinbase/blob/e0573369b865d47fed778de00a7b6df65ab1744e/src/MagicSpend/MagicSpend.sol#L181
Vulnerability details
The paymaster is a extension of the eip-4337, normally the paymaster is welling to pay a user transaction if the account can return the amount of gas at the final of the transaction.
In the context of the coinbase smart wallet the paymaster is the contract call magicSpend.sol, This contract expose the normal function need it to be a paymaster:
The magic spend is also implementing the entry point deposit, unlock and withdraw functions as required.
Addionally of this the magicSpend is implementing a withdraw functions for users:
[Link]
The problem is that validatePaymasterUserOp is consuming the same signature of the withdraw function, so user can request a transaction through the paymaster, then front runt this transaction calling the withdraw function in the magicSpend (as you notice this transaction is not being processed through the bundler so user can get this withdraw transaction first if he send the correct amount of gas to be included first) making the validatePaymasterUserOp revert because the nonce was already consumed.
This is behavior is so problematic see the impact.
Impact
Are there any griefing attacks that could cause this paymaster to be banned by bundlers?
I consider that this have to be another vulnerability but i decided to putted here because the main problem is the same.
Proof of Concept
Run this test in
file:/test/MagicSpend/Withdraw.t.sol
:Tools Used
Manual,Foundry
Recommended Mitigation Steps
Consider add another signer for the withdraw function different from the validatePaymasterUserOp signer.
Assessed type
Other
The text was updated successfully, but these errors were encountered: