AA-466 // Prevent initcode front-running #233
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add front-run protected method to K1 Factory
as per https://github.com/eth-infinitism/account-abstraction/pull/514/files#diff-63e48c2a9557cb30a347e1b089b19a170f42ca42990a55ba1a226f2e58600120
It is expected that wallets use that method in the
userOp.initcode
if they want to protect against front-run => the whole userOp is reverted.The original non permissioned method is available for direct (non 4337 flow) deployments
eth-infinitism
dependency and fix tests as soon as new EP 0.8 is released with the EP.senderCreator method availablequote from EF:
Prevent initcode front-run (AA-466)
In prior versions, the initCode from a UserOp can be extracted from a UserOp in the mempool, and executed by front-running the actual UserOp. The result is that the attacker pays for the account deployment, instead of the account owner.
Why is this a problem? Because wallets usually don’t expect a submitted UserOperation to fail, and require to re-submit (and re-sign) it.
In order to prevent such front-run, an account’s factory contract now could do
require(msg.sender == entryPoint.senderCreator());
(As can be seen in the SimpleAccountFactory)
Note: wallets are not required to use this method, but if they don’t, they are encouraged to protect their users against such a front-run.