The Vault contract's initVault
function is intended to initialize the vault by approving a corresponding management contract to handle tokens. This initialization includes setting a boolean flag to prevent re-initialization. However, the function lacks proper access control, allowing any caller to execute it, potentially leading to unauthorized initialization. This will give transfer permissions (allowance) to the attacker, then the attacker can steal the tokens from the vault.
The initVault
function in the Vault contract does not implement any access control mechanisms. As a result, any user can call this function, potentially allowing for unauthorized interaction with the ILoveToken
contract's initVault
function. After calling the initVault
the attacker can just simple add his address to have permissions to the tokens in the vault.
If exploited, this vulnerability could lead to unauthorized control over the vault's token management capabilities. This includes but is not limited to, setting an unauthorized managerContract
, which could then have implications for the handling and security of tokens intended for airdrops or staking. The impact is heightened by the fact that once the vault is initialized incorrectly, it cannot be re-initialized due to the vaultInitialize
guard.
Manual revision
To mitigate this issue and enhance the contract's security, it is recommended to implement the Ownable pattern. Here's a brief outline of how to implement this:
Inherit the Vault contract from the OpenZeppelin Ownable
contract. (Or the Owned
contract from Solmate)
Modify the initVault
function to include the onlyOwner
modifier, ensuring that only the contract owner can call this 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.