Initialising accounts can be griefed
Would be key to note that creating account around all three factories (K1ValidatorFactory, NexusAccountFactory & RegistryFactory) are done in a similar way.
Now take a look at https://github.com/Cyfrin/2024-07-biconomy/blob/9590f25cd63f7ad2c54feb618036984774f3879d/contracts/factory/NexusAccountFactory.sol#L44-L64
This function creates a new Nexus account with the provided initialization data, issue however is that in the case where the account is already deployed the account never gets initialised. Whereas this shouldn't happen in the normal intended flow, this is very possible cause an attacker can just frontrun the attempt at creating the account with deterministically creating an account, considering the salt
is not unique to the caller.
That would mean that the attacker can grief valid attempts of creating account, since they would never be initialised.
As hinted under Vulnerability Details, valid attempts of creating account can easily be faulted by an attacker since by frontrunning this the attacker ensures the accounts they would never be initialised.
As hinted earlier on in the report, this bug case is applicable to all three factories hinted below:
https://github.com/Cyfrin/2024-07-biconomy/blob/9590f25cd63f7ad2c54feb618036984774f3879d/contracts/factory/NexusAccountFactory.sol#L43-L64
https://github.com/Cyfrin/2024-07-biconomy/blob/9590f25cd63f7ad2c54feb618036984774f3879d/contracts/factory/RegistryFactory.sol#L111-L130
https://github.com/Cyfrin/2024-07-biconomy/blob/9590f25cd63f7ad2c54feb618036984774f3879d/contracts/factory/K1ValidatorFactory.sol#L75-L105
Manual review
Consider either making the salt
value unique down to the msg.sender
value or, even if the account is already deployed still try to initialize the account.
Invalid if a new Nexus proxy is already deployed, [`createDeterministicERC1967` will not revert](https://github.com/Vectorized/solady/blob/main/src/utils/LibClone.sol#L745), but simply return, so there is no DoS here. Users should carefully select a unique salt and initData when creating a new Nexus Proxy instance as noted in documentation [here](https://github.com/bcnmy/nexus/wiki/NexusAccountFactory#createaccount)
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.