QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

Vulnerability in `UpdateWeightRunner::setQuantAMMSwapFeeTake` Allows Swap Fees to Reach 100% L128

Summary

The UpdateWeightRunner::setQuantAMMSwapFeeTake function includes a check to ensure that the _quantAMMSwapFeeTake parameter is less than 100%. However, the use of <= operator in require(_quantAMMSwapFeeTake <= 1e18, "Swap fee must be less than 100%"); allows the swap fee to be set to exactly 100%. This could lead to scenarios where the protocol charges an astronomically high swap fee, potentially causing user dissatisfaction, lack of trust in the protocol, and decreased adoption.

Vulnerability Details

  • The setQuantAMMSwapFeeTake function allows an administrator (quantammAdmin) to update the quantAMMSwapFeeTake value, which represents the swap fee in a scaled format (e.g., 1e18 represents 100%).

  • The check require(_quantAMMSwapFeeTake <= 1e18, "Swap fee must be less than 100%") permits the fee to be set to exactly 100%, which is likely unintended given the expectation of a fee being "less than 100%."

  • A 100% swap fee effectively prevents meaningful use of the protocol, as users would lose all their assets in any transaction.

Impact

  • Protocol Trust: Users may lose trust in the protocol if a 100% fee is charged, especially if done maliciously or by mistake.

  • Financial Damage: If set to 100%, any swap transaction would effectively confiscate users’ assets, leading to severe financial losses.

  • Adoption Risk: A protocol perceived as unsafe or poorly managed would face reduced adoption and diminished reputation in the market.

Tools Used

Manual Review

Recommendations

  • Modify the Condition: Change the require statement to use the < operator instead of <=, ensuring that _quantAMMSwapFeeTake cannot equal 100%.

    - require(_quantAMMSwapFeeTake <= 1e18, "Swap fee must be less than 100%");
    + require(_quantAMMSwapFeeTake < 1e18, "Swap fee must be less than 100%");
  • Set Reasonable Limits: Consider imposing a maximum fee threshold (e.g., 5% or 0.05e18) to ensure fees remain reasonable and user-friendly.

    - require(_quantAMMSwapFeeTake <= 1e18, "Swap fee must be less than 100%");
    + require(_quantAMMSwapFeeTake < 0.05e18, "Swap fee must be less than 5%");

By implementing these changes, the protocol will prevent unintended or malicious configuration of the swap fee, preserving user trust and ensuring operational integrity.

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

0xcodex Submitter
10 months ago
n0kto Lead Judge
10 months ago
n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!