Skip to content
Business logic Audit finding Intermediate

Wrong APR can be used when project is unpublished and published again

When a project is unpublished and later republished in a community, the APR can be overwritten, and the new APR is incorrectly used to calculate interest for the period when the project was unpublished. This can cause the project to owe more or less interest than it should.

Lambda Follow

Originally disclosed on Code4rena

Submitted by Lambda, also found by rbserver

Community.sol#L267

When a project is unpublished from a community, it can still owe money to this community (on which it needs to pay interest according to the specified APR). However, when the project is later published again in this community, the APR can be overwritten and the overwritten APR is used for the calculation of the interest for the old project (when it was unpublished).

Proof Of Concept

1.) Project A is published in community I with an APR of 3%. The community lends 1,000,000 USD to the project. 2.) Project A is unpublished, the lentAmount is still 1,000,000 USD. 3.) During one year, no calls to repayLender, reduceDebt, or escrow happens, i.e. the interest is never added and the lastTimestamp not updated. 4.) After one year, the project is published again in the same community. Because the FED raised interest rates, it is specified that the APR should be 5% from now on. 5.) Another $1,000,000 is lent to the project by calling lendToProject. Now, claimInterest is called which calculates the interest of the last year for the first million. However, the function already uses the new APR of 5%, meaning the added interest is 50,000 USD instead of the correct 30,000 USD.

Recommended Mitigation Steps

When publishing a project, if the lentAmount for the community is non-zero, calculate the interest before updating the APR.

parv3213 (Rigor) confirmed


The original report as published on Code4rena, by Lambda. 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 publish function updates the APR without first calculating and settling the interest accrued under the old APR.

Impact

The project could be charged incorrect interest, potentially overpaying or underpaying, depending on the APR change.

What the attacker needed

Project is unpublished; project is republished with new APR; lent amount is non-zero

How it was found

  1. Project A is published in community I with an APR of 3% and lent 1,000,000 USD.
  2. Project A is unpublished, but the lent amount remains 1,000,000 USD.
  3. No repayments or interest updates occur for one year.
  4. Project A is published again with a new APR of 5%.
  5. Another 1,000,000 USD is lent, triggering interest calculation that uses the new 5% APR for the previous year.
  6. The interest added is 50,000 USD instead of the correct 30,000 USD.

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 community lends money to a project at a certain interest rate (APR). If the project is temporarily removed and then added back, the interest rate can be changed, but the system mistakenly applies the new rate to the old loan period, leading to incorrect interest charges.

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 Lambda

View all

64 more disclosed reports, best first.

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