Skip to content
Business logic Audit finding Intermediate

Annualized fee APY dependence on the frequency of executing a function

The annualized fee charged by the contract compounds based on how often the fee-charging function is called. An attacker could call the function frequently to increase the effective APY, or less frequently to decrease it, affecting the fee amount.

Czar102 Follow

Originally disclosed on Code4rena

Submitted by Czar102

Impact

The APY of the annualized fee is dependent on the frequency of the execution of the BasketFacet::chargeOutstandingAnnualizedFee(). If it is called more frequently, the compounding is more frequent and the APY is higher. For less used baskets, the APY might be lower, because the compounding will happen at lower rate.

Recommended Mitigation Steps

Consider calculating the fee as the compounding was continous or with a constant compounding period.

loki-sama (Amun) acknowledged

0xleastwood (Judge) commented:

Nice find!

The original report as published on Code4rena, by Czar102. 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

The fee calculation compounds based on the time since the last fee charge, so the effective annual rate depends on how frequently the function is called.

Impact

The effective APY of the fee can vary, potentially allowing users to pay less or more than intended, depending on how often the function is called.

What the attacker needed

Ability to call the fee function

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 charges an annual fee, but the fee is calculated each time a function is called. If the function is called often, the fee compounds more often, so the total fee is higher. This means the fee rate is not fixed and can be manipulated by calling the function more or less often.

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 Czar102

View all

12 more disclosed reports, best first.

More from Amun 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.