Skip to content
Business logic Audit finding Intermediate

Improper Upper Bound Definition on the Fee

The adjustGlobalParams function lacks upper and lower bounds on fee parameters, allowing values that are too large and cause reversions in critical functions. An attacker with governance control could set excessive fees, potentially rugging users.

defsec Follow

Originally disclosed on Code4rena

Submitted by defsec, also found by gzeon, nathaniel, WatchPug, cmichel, and pauliax

Impact

In the adjustGlobalParams function on line 1603 of ”https://github.com/code-423n4/2021-11-overlay/blob/main/contracts/mothership/OverlayV1Mothership.sol#L1630“, adjustGlobalParams function does not have any upper or lower bounds. Values that are too large will lead to reversions in several critical functions.

Proof of Concept

  • The setFee function that begins on line 163 of adjustGlobalParams sets the liquidity and transaction fee rates for the market in which the function is called. In this context, the transaction fee is the percentage of a transaction that is taken by the protocol and moved to a designated reserve account. As the name suggests, transaction fees factor in to many of the essential transaction types performed within the system.
  • Navigate to ”https://github.com/code-423n4/2021-11-overlay/blob/main/contracts/mothership/OverlayV1Mothership.sol#L163” contract and go to line #163.
  • On the function there is no upper and lower bound defined. Therefore, users can pay higher fees.

Tools Used

None

Recommended Mitigation Steps

Consider defining upper and lower bounds on the adjustGlobalParams function.

mikeyrf (Overlay) confirmed

dmvt (judge) commented:

Several wardens have marked this issue as high severity due to the potential for governance to rug users. Several have marked it as low risk because it’s really just a bounding issue and presumably governance would not willingly choose to rug their users.

I view this a medium severity issue. If exploited, the impact would be high. The likelihood that it would be exploited intentionally or happen unintentionally is low, but not impossible as the uninformed users dynamic could come into play here.

The original report as published on Code4rena, by defsec. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

Likely the adjustGlobalParams function lacks validation to ensure fee values stay within safe upper and lower bounds.

Impact

If exploited, the impact would be high, but the likelihood is low; excessive fees could cause reversions in critical functions and potentially rug users.

What the attacker needed

Governance control over the contract

The fix

The adjustGlobalParams function should be fixed by defining upper and lower bounds on fee parameters.

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.

Smart contracts often let an admin change settings like fees. Here, the function that changes fees did not check that the new fee is reasonable. So someone with admin rights could set a fee so high that normal actions stop working, which could harm users.

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.

More by defsec

View all

16 more disclosed reports, best first.

More from Overlay Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.