Deployment of vaults and initialization of vaults are performed in two different transactions. After the deployment transactions an attacker
can frontrun the initialization transactions.
In Vault::initVault
function, call is given to an arbitrary contract that is taken as an input from the user. Another issue here is the violation of Check Effects Interactions
pattern, because Vault::vaultInitialize
variable is updated after the external call.
Vault.sol:
https://github.com/Cyfrin/2024-02-soulmate/blob/b3f9227942ffd5c443ce6bccaa980fea0304c38f/src/Vault.sol#L27C1-L31C6
While loveToken::initVault
function is called then overall control of the execution flow goes to the arbitrary contract. When execution is finished and transaciton is not reverted then Vault::vaultInitialize
variable is set to true
which makes the vault not initializable.
Manual Review
The Vault::initVault
function should be protected. solmate's Owned.sol can be used.
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.