The Vault
contract lacks access control on the initVault
function, allowing any address to initialize the vault with a malicious managerContract
and steal 'LoveTokens'
Consider the following scenario:
The Vault
contract is deployed and the initVault
function is not called by the Vault
contract owner immediately, or, to the same effect, the initVault
function is front-run by an attacker.
The attacker calls the initVault
function and passes a malicious contract address as the managerContract
argument.
LoveToken::initVault
approves managerContract
to spend 500_000_000 ether
worth of 'LoveToken' as shown:
https://github.com/Cyfrin/2024-02-soulmate/blob/main/src/LoveToken.sol#L46-L56
The attacker is now able to steal the tokens.
All 'LoveToken' balances are drained.
Manual review
Consider adding an owner check, so that only the contract owner can call the Vault::initVault
function
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.