The StakingPool
contract's initialize
function is vulnerable to multiple initializations, allowing the token address to be modified after the initial contract deployment. This breaks the assumption that the token address remains constant throughout the contract's lifecycle and can lead to inconsistencies and potential loss of funds for users.
This violates the expected behavior of the token address remaining constant throughout the contract's lifecycle.
The vulnerability stems from the initialize
function, which is responsible for setting up the contract's initial state, including the token address. However, the current implementation of the initialize
function lacks proper access control and can be called multiple times with different token addresses.
The initialize
function takes the _token
address as a parameter and passes it to the __StakingRewardsPool_init
function to set the token address. However, there is no mechanism in place to prevent the initialize
function from being called multiple times with different token addresses.
As a result, an attacker can exploit this vulnerability by calling the initialize
function multiple times with different token addresses, effectively changing the token address used by the StakingPool
contract after its initial deployment.
To reproduce:
Call the initialize
function with a specific token address, e.g., initialize(address(0x1234), "LiquidToken", "LT", new Fee[](0), 1000)
.
Verify that the token()
function returns the address 0x1234
.
Call the initialize
function again with a different token address, e.g., initialize(address(0x5678), "LiquidToken", "LT", new Fee[](0), 1000)
.
Verify that the token()
function now returns the address 0x5678
, demonstrating that the token address has been changed.
If the initialize
function is called multiple times with different token addresses, it will update the token address each time, leading to an inconsistent state of the contract. This can cause confusion and errors for users who interact with the contract expecting a specific token address.
Users may accidentally send the wrong tokens to the contract due to the changed token address, resulting in a loss of funds.
Manual Review
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.