User can increase their unclaimed Flux token wi
A user can call Voter.reset() on a token to accrue unclaimed Flux, then merge that token's voting power into another token and call Voter.reset() again on the new token within the same epoch, accruing Flux twice. This lets an attacker accumulate potentially unlimited unclaimed Flux, which could be used to boost voting power or sold to depress the Flux price.
- Disclosed after under an hour
30683 - [SC - Critical] User can increase their unclaimed Flux token wi...
Submitted on May 4th 2024 at 11:47:30 UTC by @jecikpo for Boost | Alchemix
Report ID: #30683
Report type: Smart Contract
Report severity: Critical
Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/VotingEscrow.sol
Impacts:
- unbound 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 the abuse of VotedEscrow.merge() and Voter.reset().
Vulnerability Details
The Voter.reset() function calls FluxToken.accrueFlux(_tokenId) which increases the unclaimed[_tokenId] balance according the _tokenId voting power. The Voter.reset() function can be called only once per epoch due to the onlyNewEpoch(_tokenId) modifier preventing the user from accruing excess unclaimed Flux. This however can be abused if the voting power of a token is transferred to a new tokenId using VotedEscrow.merge().
After calling VotedEscrow.merge() the voting power shall be transfered to a new token and the Voter.reset() can be called again on the new tokenId within the same epoch.
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 testAbuseResetFlux() 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));
veALCX.merge(tokenIdLarge, tokenIdSmall);
voter.reset(tokenIdSmall);
// we can see that the user amassed double of the unclaimedFlux during single epoch, this pattern could be repeated with more smaller vALCX locks
console.log("Unclaimed Flux on tokenIdSmall: %d", flux.unclaimedFlux(tokenIdSmall));
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
Likely the once-per-epoch guard in Voter.reset() is tracked per tokenId, so moving voting power to a fresh tokenId via merge resets the guard and allows accrual again in the same epoch.
Impact
The user could accrue a potentially unlimited amount of unclaimed Flux, which could be used to unfairly increase voting power or claimed and sold to suppress the Flux price, undermining the voting system.
What the attacker needed
A locked veALCX position; ability to merge tokens
How it was found
- Create a large lock and a small lock, each with voting power.
- Call voter.reset() on the large token to accrue unclaimed Flux.
- Merge the large token into the small token, transferring its voting power.
- Call voter.reset() on the small token within the same epoch to accrue Flux again.
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. Normally a user can only claim their Flux once per voting period (epoch) for each locked token. The report shows that by merging one locked token into another, the once-per-epoch check can be bypassed, so the same voting power earns Flux twice.
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.