31579 - [SC - Critical] Infinite mint of FLUX using poke
Submitted on May 21st 2024 at 14:23:35 UTC by @konata for Boost | Alchemix
Report ID: #31579
Report type: Smart Contract
Report severity: Critical
Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/FluxToken.sol
Impacts:
Manipulation of governance voting result deviating from voted outcome and resulting in a direct change from intended effect of original results
Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Brief/Intro
There is an infinite mint vulnerability for the FLUX token using the poke
functionality of the Voter
contract.
Vulnerability Details
In the _vote
function of the Voter contract, it calls into FLUX.accrueFlux
, which increases the user's unclaimed FLUX balance from the VotingEscrow balance. It later calls FLUX.updateFlux
to decrease it, but only with the amount of boost
, which can simply be 0:
https://github.com/alchemix-finance/alchemix-v2-dao/blob/f1007439ad3a32e412468c4c42f62f676822dc1f/src/Voter.sol#L412-L455
The function FLUX.accrueFlux
increases the balance using VotingEscrow.claimableFlux(tokenId)
, which is a view function and stays the same depending on the amount and lock duration of the token ID:
https://github.com/alchemix-finance/alchemix-v2-dao/blob/f1007439ad3a32e412468c4c42f62f676822dc1f/src/FluxToken.sol#L188-L192
VotingEscrow.claimableFlux
does not depend on the amount of unclaimed FLUX in FluxToken for the user, and so the value returned from claimableFlux
remains the same.
One can therefore simply call Voter.poke()
over and over again, as this calls FluxToken.accrueFlux
each time and uses a boost of 0. The user's unclaimedFlux
in FluxToken
would grow with the entire balance each time.
The user can then call FluxToken.claimFlux
to turn the unclaimed FLUX into real ERC20 tokens that can be traded.
Impact Details
The impact is an infinite mint of FLUX. This is a critical impact to not only the governance process (since FLUX can be used to boost), but also to the market and TVL of FLUX.
The vulnerability can be exploited by anyone and in the time frame of the same transaction.
References
https://github.com/alchemix-finance/alchemix-v2-dao/blob/f1007439ad3a32e412468c4c42f62f676822dc1f/src/Voter.sol#L412-L455
https://github.com/alchemix-finance/alchemix-v2-dao/blob/f1007439ad3a32e412468c4c42f62f676822dc1f/src/FluxToken.sol#L188-L192
Proof of Concept
A simple PoC that shows the attack scenario by calling poke
each time.
Last updated