Closed c4-submissions closed 1 year ago
141345 marked the issue as low quality report
invalid
claim future rewards
require(week + WEEK < block.timestamp, "Week not over yet");
dmvt marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-10-canto/blob/main/canto_ambient/contracts/callpaths/LiquidityMiningPath.sol#L62 https://github.com/code-423n4/2023-10-canto/blob/main/canto_ambient/contracts/callpaths/LiquidityMiningPath.sol#L58 https://github.com/code-423n4/2023-10-canto/blob/main/canto_ambient/contracts/mixins/LiquidityMining.sol#L256 https://github.com/code-423n4/2023-10-canto/blob/main/canto_ambient/contracts/mixins/LiquidityMining.sol#L156
Vulnerability details
Impact
The claimAmbientRewards function in the provided code has a potential vulnerability that could allow a malicious caller to drain the contract's balance by claiming rewards for future weeks. This could lead to a significant loss of funds and disrupt the intended behavior of the contract.
Proof of Concept
The claimAmbientRewards function is a public function that calls the internal claimAmbientRewards function. It allows any external caller to invoke the claim rewards process.
In the claimAmbientRewards function, the caller can specify an array of weeksToClaim. For each week specified in this array, the code calculates the rewards to send to the caller based on the ambRewardPerWeek and timeWeightedWeeklyPositionAmbLiquidity values.
The potential vulnerability lies in the fact that the caller can specify any week in the weeksToClaim array, and the rewards for that week will be calculated and sent to the caller. This means that the caller can potentially claim rewards for future weeks that have not yet occurred.
same for
Tools Used
Manual review
Recommended Mitigation Steps
Time-Based Validation: Implement time-based validation checks in the claimAmbientRewards function to ensure that rewards can only be claimed for past weeks, not for future weeks. Use the current block timestamp to verify the claimed weeks.
Limit Rewards: Consider implementing a mechanism to limit the maximum amount of rewards that can be claimed in a single transaction. This can prevent excessive claims and limit potential damage.
Assessed type
Access Control