User can increase their unclaimed Flux token wi
The Voter.poke() function calls the internal voting logic that accrues unclaimed Flux tokens, but unlike vote() it lacks the onlyNewEpoch modifier, so it can be called repeatedly within the same epoch. An attacker could call poke() many times to accrue an unlimited amount of unclaimed Flux, which could be used to manipulate governance voting or sold to depress the token price.
- Disclosed after under an hour
30788 - [SC - Critical] User can increase their unclaimed Flux token wi...
Submitted on May 6th 2024 at 01:39:08 UTC by @jecikpo for Boost | Alchemix
Report ID: #30788
Report type: Smart Contract
Report severity: Critical
Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Voter.sol
Impacts:
- unbounded minting of token
- Manipulation of governance voting result deviating from voted outcome and resulting in a direct change from intended effect of original results
Description
Brief/Intro
A user can increase their unclaimed Flux token amount by calling Voter.poke() multiple times.
Vulnerability Details
The Voter._vote() function calls FluxToken.accrueFlux(_tokenId) which increases the unclaimed[_tokenId] balance according the _tokenId voting power. _vote() is called by vote() which has the onlyNewEpoch(_tokenId) modifier attached, so it can be called only once during each epoch.
The _vote() is also used inside poke(). poke() is supposed to vote based on the users previous voting weights. however poke() does not have the above mentioned modifier attached, hence it can be called multiple times during the epoch without any limits. Each time poke() is called the unclaimed FLUX is increased.
Impact Details
The impact is that the user can accrue potentially unlimited amount of unclaimed Flux. The unclaimed Flux could be used to execute unfair voting by increasing the user's voting power. It could also be claimed and sold on the open market to suppress the Flux price which will allow other users to unlock their veALCX tokens at lower prices hence destroying the entire voting system credibility.
References
Proof of Concept
Add to the VotingEscrow.t.sol the following code:
function testAbusePoke() public {
hevm.startPrank(admin);
uint256 tokenIdLarge = veALCX.createLock(TOKEN_100K, THREE_WEEKS, false);
//uint256 tokenIdSmall = veALCX.createLock(TOKEN_1, THREE_WEEKS, false);
voter.reset(tokenIdLarge);
console.log("Unclaimed Flux on tokenIdLarge: %d", flux.unclaimedFlux(tokenIdLarge));
voter.poke(tokenIdLarge);
// we can see that the user amassed more unclaimed FLUX: 9420478183663114723056
console.log("Unclaimed Flux on tokenIdLarge after poke called once: %d", flux.unclaimedFlux(tokenIdLarge));
// even more after calling poke() again: 14130717275494672084584
voter.poke(tokenIdLarge);
console.log("Unclaimed Flux on tokenIdLarge after poke called twice: %d", flux.unclaimedFlux(tokenIdLarge));
// and again: 18840956367326229446112
voter.poke(tokenIdLarge);
console.log("Unclaimed Flux on tokenIdLarge after poke called thrid time: %d", flux.unclaimedFlux(tokenIdLarge));
hevm.stopPrank();
}
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The poke() function reuses the internal _vote() logic that accrues Flux but does not enforce the once-per-epoch restriction that vote() has.
Impact
A user could accrue a potentially unlimited amount of unclaimed Flux, which could be used to unfairly increase voting power or sold on the open market to suppress the Flux price and undermine the voting system.
What the attacker needed
A token ID with voting power (veALCX lock)
How it was found
- Create a lock to obtain a token ID with voting power.
- Reset the token to prepare for voting.
- Call poke() on the token ID to accrue unclaimed Flux.
- Call poke() again multiple times to keep increasing the unclaimed Flux balance.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Flux is a reward token earned by voting in this system. The normal vote function can only be used once per voting period, but a related function called poke, meant to refresh a vote, can be called over and over. Each call adds more unclaimed Flux, so a user can keep calling it to get far more tokens than intended.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.