Description:
The _setTaxRate
function contains a vulnerability in its increment limitation mechanism. The function is designed to restrict tax rate changes to a maximum percentage increase or decrease relative to the current rate. However, the implementation bypasses this check entirely when the current tax rate is zero, allowing the contract owner to immediately set the tax rate to the maximum allowed value (MAX_TAX_RATE
, 10%) in a single transaction.
Impact:
This vulnerability has significant impact on the protocol's governance and user expectations:
Governance Subversion: The incremental rate change mechanism is intended as a safeguard against sudden tax policy changes. This bypass undermines the protocol's governance model.
User Trust Violation: Users who perform due diligence on the contract may note the incremental rate change protection as a safeguard, but be unaware of this exception that renders it ineffective.
Market Manipulation Potential: The ability to suddenly switch from 0% to 10% tax creates opportunities for the owner to time market activities around a planned tax rate spike.
Liquidity Flight Risk: A sudden unexpected tax increase could trigger mass withdrawals or selling, potentially destabilizing the token's value.
The severity is high because it directly compromises a core governance protection mechanism and enables behavior that most users would reasonably consider impossible based on the contract's stated intentions.
Proof of Concept:
The vulnerability manifests through the following sequence:
The tax rate (e.g., swapTaxRate
) is initially set to 0%, likely to attract users with fee-free operations.
The contract includes a taxRateIncrementLimit
(e.g., 20 basis points or 0.2%), which should prevent the owner from increasing rates by more than this amount in a single update.
However, when the contract owner calls the function to update the tax rate, the increment check is conditionally applied only when the current rate is non-zero:
With the current rate at 0%, this condition evaluates to false, bypassing the entire increment check block.
The owner can therefore set the new rate directly to the maximum allowed value (10%) in a single transaction.
Users who expected protection against sudden tax changes are caught off-guard by this immediate jump from 0% to 10%.
This behavior contradicts user expectations and the apparent intent of the governance mechanism.
Recommended Mitigation:
Implement consistent increment checking regardless of the current tax rate:
Remove the conditional check that skips increment verification when the current rate is zero.
For transitions from zero, calculate the increment based on a minimum effective rate (e.g., 0.1%) to prevent division by zero while maintaining governance controls.
Consider implementing a minimum waiting period between successive tax rate changes to further prevent manipulation.
Add explicit events that log all tax rate changes with both old and new values for transparency.
Document the increment limitation clearly in user-facing documentation, including any special cases for transitions from zero.
This approach ensures that tax rate changes remain predictable and aligned with user expectations, regardless of the starting rate.
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.