The BoostController
contract allows users to delegate their boost to multiple users without deducting the delegated amount from their own boost balance. Additionally, there is no mechanism for pools to easily track all delegates assigned to them. These issues can lead to incorrect boost calculations and operational inefficiencies.
The BoostController::delegateBoost
function allows a user to delegate their boost to multiple users without deducting the delegated amount from their own boost balance. This means a user can delegate the same boost amount to multiple recipients, effectively "double-spending" their boost.
The contract does not provide a way for pools to easily see all delegates assigned to them. This makes it difficult to track and manage delegated boosts, leading to potential inefficiencies and incorrect calculations.
Multiple Delegation Without Deduction:
The delegateBoost
function does not deduct the delegated amount from the user's boost balance:
Lack of Delegation Tracking:
The contract does not maintain a list of delegates for each pool, making it difficult to track and manage delegated boosts.
User Delegates Boost: User 1 delegates 100 ether of boost to User 2 and then delegates the same 100 ether of boost to User 3.
No Deduction: The boost amount is not deducted from User 1's balance, allowing them to delegate the same amount multiple times.
Lack of Tracking: There is no way for the pool to easily see all delegates assigned to it.
The vulnerability is demonstrated in the following Foundry test suite. Convert to foundry project using the steps highlighted here. Then in the test/
folder create a Test file named BoostControllerTest.t.sol
and paste the test into it. Make sure the imports path are correct and run the test using forge test --mt testDelegateBoostBug
:
In this test:
User 1 delegates 100 ether of boost to User 2 and then delegates the same 100 ether of boost to User 3.
The boost amount is not deducted from User 1's balance, allowing them to delegate the same amount multiple times.
There is no way for the pool to easily see all delegates assigned to it.
Incorrect Boost Calculations: Users can delegate the same boost amount to multiple recipients, leading to incorrect boost calculations.
Operational Inefficiency: The lack of delegation tracking makes it difficult to manage and track delegated boosts, leading to potential inefficiencies.
Foundry: Used to write and execute the test suite that demonstrates the vulnerability.
Manual Review
Deduct Delegated Boost from User's Balance:
Update the delegateBoost
function to deduct the delegated amount from the user's boost balance.
Add Delegation Tracking:
Implement a mechanism to track all delegates assigned to a pool. This can be done by maintaining a list of delegates for each pool.
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.