The delegateBoost
function in BoostController
only checks the user's balance against the current delegation amount, without tracking total delegations across pools:
As there is no tracking of the amount user already delegated from his current balance, this allows the user to abuse the system by delegating these same tokens to as many pools as he wants.
Example:
A user with 100 tokens can currently delegate those same tokens to multiple pools simultaneously.
For example, delegating 100 tokens to each of 5 pools results in a total delegation of 500 tokens, exceeding the user's actual token balance of 100.
Install foundry through:
npm i --save-dev @nomicfoundation/hardhat-foundry
Add require("@nomicfoundation/hardhat-foundry");
on hardhat config file
Run npx hardhat init-foundry
and forge install foundry-rs/forge-std --no-commit
Create a fille called BoostController.t.sol
in the test
folder
Paste the code below:
Run: forge test --match-test test_delegatingBoost_allowsDoubleSpending -vv
Result:
Users can multiply their voting power by delegating the same veTokens
multiple times to different pools.
This affects the vote()
function in GaugeController where users can influence gauge weights disproportionately.
Users can extract more rewards than intended from multiple pools simultaneously.
This creates an unfair advantage in both governance and reward distribution.
Manual Review & Foundry
1 - Add total delegation tracking per user.
2 - When user calls delegateBoost
check whether user can delegate the amount of tokens and increment the userTotalDelegated
adding the new amount.
3 - Decrement the userTotalDelegated
when calling removeBoostDelegation
:
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.