Users can lower the interest rate by dividing a loan into multiple smaller loans
The minimum interest rate for a loan is calculated using the pool's utilisation ratio, which includes the newly borrowed amount. By splitting a large loan into several smaller loans, a borrower can reduce the interest rate paid on the total amount.
Source: https://github.com/sherlock-audit/2024-11-teller-finance-update-judging/issues/34
The protocol has acknowledged this issue.
Found by
KupiaSec
Summary
The LenderCommitmentGroup_Smart.getMinInterestRate() function calculates the minimum APR for borrowing. However, this APR is determined based on the utilization ratio, which includes the newly borrowed amount. This allows borrowers to reduce the APR by dividing a loan into multiple smaller loans.
Root Cause
The LenderCommitmentGroup_Smart.getMinInterestRate() function calculates the minimum APR for borrowing.
https://github.com/sherlock-audit/2024-11-teller-finance-update/blob/main/teller-protocol-v2-audit-2024/packages/contracts/contracts/LenderCommitmentForwarder/extensions/LenderCommitmentGroup/LenderCommitmentGroup_Smart.sol#L1017-1023
function getMinInterestRate(uint256 amountDelta) public view returns (uint16) {
return interestRateLowerBound +
uint16( uint256(interestRateUpperBound-interestRateLowerBound)
@> .percent(getPoolUtilizationRatio(amountDelta )
) );
}
However, the APR is calculated based on the utilization ratio, which includes the newly borrowed amount. This allows borrowers to reduce the APR by dividing a loan into multiple smaller loans, creating an unfair advantage for them over other users. https://github.com/sherlock-audit/2024-11-teller-finance-update/blob/main/teller-protocol-v2-audit-2024/packages/contracts/contracts/LenderCommitmentForwarder/extensions/LenderCommitmentGroup/LenderCommitmentGroup_Smart.sol#L1002-1015
function getPoolUtilizationRatio(uint256 activeLoansAmountDelta ) public view returns (uint16) {
if (getPoolTotalEstimatedValue() == 0) {
return 0;
}
return uint16( Math.min(
MathUpgradeable.mulDiv(
@> (getTotalPrincipalTokensOutstandingInActiveLoans() + activeLoansAmountDelta),
10000 ,
getPoolTotalEstimatedValue() ) ,
10000 ));
}
Internal pre-conditions
interestRateLowerBound = 0 interestRateLowerBound = 800 // 8% current total estimated value = $20000 current borrowed value = $5000
External pre-conditions
none
Attack Path
If Alice borrows $10000 USD at once, the APR is (5000 + 10000) / 20000 * 8% = 6%
However, Alice borrow $10000 as follows.
- Alice is going to borrow $10000.
- Alice borrows $1,000 repeatedly for a total of 10 times.
Then the APR for each 1000 USD is: (5000 + 1000) / 20000 * 8% = 2.4% (6000 + 1000) / 20000 * 8% = 2.8% (7000 + 1000) / 20000 * 8% = 3.2% (8000 + 1000) / 20000 * 8% = 3.6% (9000 + 1000) / 20000 * 8% = 4.0% (10000 + 1000) / 20000 * 8% = 4.4% (11000 + 1000) / 20000 * 8% = 4.8% (12000 + 1000) / 20000 * 8% = 5.2% (13000 + 1000) / 20000 * 8% = 5.6% (14000 + 1000) / 20000 * 8% = 6%
(2.4 + 2.8 + ... + 6) / 10 = 4.2
Therefore, the borrower will only pay an APR of 4.2% on the $10,000 loan. As a result, Alice lowers the interest rate from 6% to 4.2% by splitting a $10,000 loan into ten separate loans of $1,000 each.
Impact
Users can lower the interest rate by dividing a loan into multiple smaller loans.
PoC
none
Mitigation
Middle value should be used instead of end value.
function getPoolUtilizationRatio(uint256 activeLoansAmountDelta ) public view returns (uint16) {
if (getPoolTotalEstimatedValue() == 0) {
return 0;
}
return uint16( Math.min(
MathUpgradeable.mulDiv(
- (getTotalPrincipalTokensOutstandingInActiveLoans() + activeLoansAmountDelta),
+ (getTotalPrincipalTokensOutstandingInActiveLoans() + (activeLoansAmountDelta + 1) / 2),
10000 ,
getPoolTotalEstimatedValue() ) ,
10000 ));
}
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 interest rate is calculated using the utilisation ratio after adding the new loan amount, so splitting a loan into smaller parts results in a lower average rate.
What the attacker needed
InterestRateLowerBound = 0; interestRateUpperBound = 800; pool total estimated value = $20000; current borrowed value = $5000
The fix
The interest rate calculation should use the middle value of the loan amount instead of the full amount to prevent splitting.
How it was found
- Alice decides to borrow $10,000.
- She borrows $1,000 ten times in a row.
- Each $1,000 loan is priced at a lower APR because the utilisation ratio is recalculated with only that $1,000 added.
- The average APR across all ten loans is 4.2%, compared to 6% for a single $10,000 loan.
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 sets the interest rate for a loan based on how much of the pool is already borrowed. If you borrow a large sum all at once, the rate is higher. But if you borrow the same total in smaller chunks, each chunk is priced with a lower rate because the pool looks less utilised at each step. This means you pay less interest overall.
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.