Skip to content
DoS Audit finding Intermediate

If `repayLoanCallback` address doesn't implement `repayLoanCallback` try/catch won't go into the catch and will revert the tx

A lender can set a loan repayment listener contract that does not implement the repayLoanCallback function, causing the try/catch in the repayment function to revert instead of catching the error. This prevents borrowers from repaying their loans, forcing default and allowing the lender to seize collateral.

EgisSecurity Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-04-teller-finance-judging/issues/178

Found by

EgisSecurity

Summary

If repayLoanCallback address doesn't implement repayLoanCallback try/catch won't go into the catch and will revert the tx

Vulnerability Detail

If a contract, which is set as loanRepaymentListener from a lender doesn't implement repayLoanCallback transaction will revert and catch block won't help. This is serious and even crucial problem, because a malicous lender could prevent borrowers from repaying their loans, as repayLoanCallback is called inside the only function used to repay loans. This way he guarantees himself their collateral tokens.

Converastion explaining why try/catch helps only if transaction is reverted in the target, contrac, which is not the case here

Solidity
 if (loanRepaymentListener != address(0)) {
            try
                ILoanRepaymentListener(loanRepaymentListener).repayLoanCallback{
                    gas: 80000
                }( //limit gas costs to prevent lender griefing repayments
                    _bidId,
                    _msgSenderForMarket(bid.marketplaceId),
                    _payment.principal,
                    _payment.interest
                )
            {} catch {}
        }

Impact

Lenders can stop borrowers from repaying their loans, forcing their loans to default.

Code Snippet

https://github.com/sherlock-audit/2024-04-teller-finance/blob/defe55469a2576735af67483acf31d623e13592d/teller-protocol-v2-audit-2024/packages/contracts/contracts/TellerV2.sol#L953

Tool used

Manual Review

Recommendation

Maybe use a wrapper contract, which is trusted to you and is internally calling the repayLoanCallback on the untrusted target.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/teller-protocol/teller-protocol-v2-audit-2024/pull/31

sherlock-admin2

The Lead Senior Watson signed off on the fix.

The original report as published on Sherlock, by EgisSecurity. 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 try/catch only catches reverts from the called function, not from calling a non-existent function on a contract that lacks it, so the external call reverts before the catch block can handle it.

Impact

A malicious lender could prevent borrowers from repaying, forcing loans to default and allowing the lender to take collateral.

What the attacker needed

Lender sets a malicious listener contract; borrower attempts to repay

The fix

The protocol team fixed this issue in a pull request.

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.

In Ethereum smart contracts, a lender can attach a listener contract that gets notified when a loan is repaid. If that listener contract is missing the required notification function, the repayment transaction fails entirely, even though the code tries to catch errors. This lets a malicious lender block repayments and take the borrower's collateral.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by EgisSecurity

View all

2 more disclosed reports, best first.

More from Teller Finance

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.