The vulnerability a related to the lack of access controls on the initVault
function in the Vault
contract, which could allow unauthorized users to initialize the contract multiple times.
Finding: The Vault.initVault()
function in Vault.sol
is an unprotected initializer, which could be exploited by an attacker to reset the contract state or grant unintended permissions.
Location: Vault.initVault(ILoveToken,address)
(src/Vault.sol#27-31)
Code Snippet:
The initVault
function is intended to initialize the vault with the loveToken
and managerContract
addresses. However, the current implementation does not prevent the function from being called multiple times, which could lead to the contract being initialized more than once and potentially causing security issues.
This vulnerability could enable an attacker to manipulate the contract's state or gain unauthorized access to sensitive functions. It is particularly concerning in upgradeable contracts, where repeated initialization could reset the contract's state and compromise its integrity.
To mitigate this vulnerability, the initVault
function should be modified to include a modifier or a require
statement that ensures the function can only be called once. Consider implementing an ownership pattern to restrict access to sensitive functions.
Here is the corrected code snippet with a simple initialization check:
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.