Impossible to set boostMultiplier to MIN_BOOST
The setBoostMultiplier function uses a strict greater-than check against MIN_BOOST (which is zero), so it is impossible to set the boost multiplier to zero. An attacker could not exploit this directly, but it prevents the admin from configuring the multiplier to its minimum allowed value.
- Disclosed after under an hour
31416 - [SC - Insight] Impossible to set boostMultiplier to MIN_BOOST
Submitted on May 18th 2024 at 20:29:44 UTC by @RNemes for Boost | Alchemix
Report ID: #31416
Report type: Smart Contract
Report severity: Insight
Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Voter.sol
Impacts:
- Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief/Intro
The setBoostMultiplier function in the contract contains a logic flaw where the check for _boostMultiplier being greater than MIN_BOOST inadvertently prevents setting the boostMultiplier to MIN_BOOST, which is defined as zero. This prevents users from setting the boostMultiplier to its minimum allowed value, potentially leading to unexpected behavior or inability to achieve certain intended configurations.
Vulnerability Details
The vulnerability lies in the setBoostMultiplier function's requirement check:
require(_boostMultiplier <= MAX_BOOST && _boostMultiplier > MIN_BOOST, "Boost multiplier is out of bounds");
Given the definition:
uint256 internal constant MIN_BOOST = 0;
The condition _boostMultiplier > MIN_BOOST translates to _boostMultiplier > 0, which means _boostMultiplier must be greater than zero. Therefore, it's impossible to set _boostMultiplier to zero, even though zero is defined as the minimum boost allowed (MIN_BOOST). This restriction can prevent the proper functioning of the contract if setting the boostMultiplier to zero is a required use case.
Impact Details
The impact of this vulnerability is primarily operational rather than financial. If the boostMultiplier needs to be set to zero for certain operations or configurations, the current implementation will prevent this, potentially leading to incorrect contract behavior or inability to revert to a default state. This could disrupt contract functionality and the ability of the admin to control the boostMultiplier as intended. In scenarios where setting the multiplier to zero is necessary for security or protocol reasons, this bug could pose a more significant risk.
Proof of Concept
Add the following failing test to src/test/Voting.t.sol
function testSetBoostMultiplierToMinValue() public {
hevm.prank(address(timelockExecutor));
voter.setAdmin(devmsig);
hevm.startPrank(devmsig);
voter.acceptAdmin();
voter.setBoostMultiplier(0);
}
Failing tests:
Encountered 1 failing test in src/test/Voting.t.sol:VotingTest
[FAIL. Reason: revert: Boost multiplier is out of bounds] testSetBoostMultiplierToMinValue() (gas: 26707)
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 require statement uses a strict greater-than comparison against MIN_BOOST instead of greater-than-or-equal, so the boundary value zero is rejected.
Impact
The admin cannot set the boost multiplier to zero, which could prevent reverting to a default state or disrupt intended configurations, but there is no direct financial loss or attacker gain.
What the attacker needed
Admin privileges on the contract
How it was found
- Impersonate the timelock executor and set the admin to the dev multisig.
- Start a prank as the dev multisig and accept the admin role.
- Call setBoostMultiplier with zero as the argument.
- Observe the transaction reverts with 'Boost multiplier is out of bounds'.
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.
A smart contract has a rule that the boost multiplier must be greater than zero, but the code also says the minimum allowed value is zero. This means the admin can never set the multiplier to zero, even though the design says zero is allowed. It is a logic mistake, not a security hole that lets someone steal money.
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.