Burning a User’s Tokens for a Flash Proposal will not Deduct Their Balance
The burn function for flash governance proposals overwrites the user's pending decision with the default config instead of clearing it, so the user's tokens are not actually burned and their unlock time becomes a short duration. An attacker could exploit this to avoid the intended token burn and unlock their funds earlier than intended.
Originally disclosed on Code4rena
Submitted by kirk-baird
The proposal to burn a user’s tokens for a flash governance proposal does not result in the user losing any funds and may in fact unlock their funds sooner.
Proof of Concept
The function burnFlashGovernanceAsset() will simply overwrite the user’s state with pendingFlashDecision[targetContract][user] = flashGovernanceConfig; as seen below.
function burnFlashGovernanceAsset(
address targetContract,
address user,
address asset,
uint256 amount
) public virtual onlySuccessfulProposal {
if (pendingFlashDecision[targetContract][user].assetBurnable) {
Burnable(asset).burn(amount);
}
pendingFlashDecision[targetContract][user] = flashGovernanceConfig;
}
Since flashGovernanceConfig is not modified in BurnFlashStakeDeposit.execute() the user will have amount set to the current config amount which is likely what they originally transferred in {assertGovernanceApproved()](https://github.com/code-423n4/2022-01-behodler/blob/main/contracts/DAO/FlashGovernanceArbiter.sol#L60).
Furthermore, unlockTime will be set to the config unlock time. The config unlock time is the length of time in seconds that proposal should lock tokens for not the future timestamp. That is unlock time may be say 7 days rather than now + 7 days. As a result the check in withdrawGovernanceAsset() pendingFlashDecision[targetContract][msg.sender].unlockTime < block.timestamp, will always pass unless there is a significant misconfiguration.
Recommended Mitigation Steps
Consider deleting the user’s data (i.e. delete pendingFlashDecision[targetContract][user]) rather than setting it to the config. This would ensure the user cannot withraw any funds afterwards.
Alternatively, only update pendingFlashDecision[targetContract][user].amount to subtract the amount sent as a function parameter and leave the remaining fields untouched.
gititGoro (Behodler) confirmed
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 function overwrites the user's pending decision with the default config instead of deleting it or reducing the amount, so the burn does not affect the user's balance and sets a short unlock time.
Impact
The user does not lose any tokens and may be able to unlock their funds sooner than intended, bypassing the burn mechanism.
What the attacker needed
A flash governance proposal is executed
The fix
The function should delete the user's pending decision or subtract the burned amount, rather than overwriting it with the config.
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.
In a smart contract, a 'burn' is supposed to destroy tokens permanently. Here, the function that should burn tokens instead resets the user's record to default settings, which means the tokens are not destroyed and the lock time becomes very short. So the user keeps their tokens and can withdraw them sooner than they should.
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.