The _setTaxRate()
function in RAACToken.sol fails to properly enforce the incremental tax rate change limit when setting rates from zero, allowing an owner to bypass the intended gradual increase mechanism and instantly set high tax rates.
https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/tokens/RAACToken.sol#L118
The contract implements a tax rate increment limit mechanism to prevent sudden large changes in tax rates. However, this protection is bypassed when the current tax rate is 0, due to logic in _setTaxRate()
:
The increment check is only performed when currentRate != 0
. This allows:
Scenario 1: Normal Case (Working as intended)
Current rate: 500 (5%)
Increment limit: 1000 (10%)
Max allowed change: 500 + (500 × 10%) = 550
Cannot set rate above 550 in one transaction
Scenario 2: Zero Rate Case (Vulnerable)
Current rate: 0
Increment limit: 1000 (10%)
Can set directly to any value up to MAX_TAX_RATE (1000)
Bypasses intended incremental steps (0→100→200→...→1000)
Owner can instantly set high tax rates without following the gradual increase requirement
Modify the _setTaxRate
function to enforce incremental limits even when starting from zero:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.