30985 - [SC - Medium] Griefing attack prevents admins from disabling ...
Submitted on May 10th 2024 at 03:16:13 UTC by @infosec_us_team for Boost | Alchemix
Report ID: #30985
Report type: Smart Contract
Report severity: Medium
Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Bribe.sol
Impacts:
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Description
The Voter
smart contract can whitelist - and remove from the whitelist - tokens with the functions:
The Voter's whitelist is used in the Bribe
smart contract to ensure only whitelisted tokens are enabled when calling Bribe.addRewardToken(...)
.
In Bribe, it is impossible to disable a token explicitly; it is only possible for admins to "disable an already enabled token while replacing it with a new one" calling Voter.swapReward(...)
, then the Voter smart contract will call Bribe.swapOutRewardToken(...)
.
swapReward in Voter
swapOutRewardToken in Bribe
We discover a griefing attack that makes the swapOutRewardToken(...)
revert, preventing reward tokens from being disabled.
Vulnerability Details
The swapOutRewardToken(...)
function requires the new token that admins are trying to replace the old token with not to exist. (rewards[newToken] must be equal to false).
Github link: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Bribe.sol#L138-L155
Attack vector
The logic of the public function Bribe.notifyRewardAmount(token, amount)
, automatically enables any whitelisted token you pass as a parameter if it is not already enabled so the attack vector is:
Step 1- An admin whitelists a token in Voter (say DAI) to replace the old reward token with it.
Step 2- A malicious entity calls Bribe.notifyRewardAmount(DAI, 1)
sending 1 wei of day. The DAI token will be enabled automatically.
Step 3- The admin calls Voter.swapReward(...)
to disable the old token and enable DAI, but his transaction reverts because DAI is already enabled.
Hence, the old reward token can't be disabled.
Impact Details
Griefing attack that prevents admin from disabling a token.
The 5-reports/48-hours limit makes time management crucial, and every day we invest in attempting to escalate the impact of a specific report decreases the total number of bugs we can submit to the Boost.
We suspect the impact could be increased from griefing to a denial of service in parts of the protocol or the Bribe itself, but we can't afford to allocate time to dig deeper.
Proof of Concept
The following test replicates the attack vector.
Add it to alchemix-v2-dao/src/test/Voting.t.sol
:
Last updated