Skip to content
Business logic Audit finding Beginner

Interest rate for pool is bounded wrongly

The pool deployment contract uses inclusive comparison operators for the interest rate bounds, so pools with rates exactly at the documented minimum (1%) or maximum (10%) are rejected. This means only rates strictly between 2% and 9% can be used, contrary to the intended 1-10% range.

yixxas Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-01-ajna-judging/issues/96

Found by

yixxas

Summary

It is documented that pools can be created for tokens with interest rate between 1-10%.

Pool creators: create pool by providing a fungible token for quote and collateral and an interest rate between 1-10%

However, due to a wrong implementation, pools can only be created between 2-9%.

Vulnerability Detail

In PoolDeployer.sol contract we have MIN_RATE = 0.01 * 1e18 and MAX_RATE = 0.1 * 1e18. This indicates the 1% and 10% value in which we should allow interest rate to be set.

However, in our canDeploy modifier, it causes a revert when the following condition is true.

if (MIN_RATE >= interestRate_ || interestRate_ >= MAX_RATE) revert IPoolFactory.PoolInterestRateInvalid()

A more than or equal sign is used to do the comparison, and reverts. This means that we can only set interest rate in the range of 2-9%, which I believe is not intended.

Impact

Interest rate is bounded wrongly, limiting pools from being deployed with the intended range.

Code Snippet

https://github.com/sherlock-audit/2023-01-ajna/blob/main/contracts/src/base/PoolDeployer.sol#L13-L14 https://github.com/sherlock-audit/2023-01-ajna/blob/main/contracts/src/base/PoolDeployer.sol#L38-L43

Tool used

Manual Review

Recommendation

Change to a strict comparison instead when doing the comparison.

Diff
- if (MIN_RATE >= interestRate_ || interestRate_ >= MAX_RATE)         revert IPoolFactory.PoolInterestRateInvalid();
+ if (MIN_RATE > interestRate_ || interestRate_ > MAX_RATE)         revert IPoolFactory.PoolInterestRateInvalid();

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

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 canDeploy modifier uses >= and <= instead of > and <, so the boundary values are incorrectly rejected.

Impact

Pools cannot be deployed with interest rates at the documented minimum or maximum, limiting the available range to 2-9%.

What the attacker needed

None

The fix

The comparison should use strict inequality (>) so that the boundary values are allowed.

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.

When you create a pool, you must choose an interest rate. The code is supposed to allow rates from 1% to 10%, but because of a small mistake in how the limits are checked, it only allows rates between 2% and 9%. This stops people from using the full allowed range.

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 yixxas

View all

13 more disclosed reports, best first.

More from Ajna #2

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.