Front-running "deployCounterFactualWallet" #482
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-460
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccountFactory.sol#L33
Vulnerability details
Description
The
deployCounterFactualWallet
function deploys a smart wallet using thecreate2
function with a salt value that depends on the_owner
and_index
parameters. However, the address derivation for the deployed wallet does not depend on the_entryPoint
and_handler
parameters, which are used during initialization. This allows an attacker to front run the transaction and deploy a smart contract with their own_handler
and_entryPoint
, but same address. The attacker can then call theexecFromEntryPoint
function on the smart wallet, allowing them to execute any desired logic, such as changing the owner. As a result, users cannot rely on the address derivation in advance or deploy the wallet with the same address on different EVM chains.Impact
If users rely on the address derivation in advance or try to deploy the wallet with the same address on different EVM chains, any funds sent to the wallet could potentially be withdrawn by anyone else. All in all, it could lead to the theft of user funds.
Recommended Mitigation Steps
Change formula with which
salt
is calculated to depends_entryPoint
and_handler
.The text was updated successfully, but these errors were encountered: