# Malicious lender can prevent borrower from repayment due to try/catch block revert

Lender selfdestructs the repayment listener contract in the same tx, so the try/catch repay callback reverts and borrowers can never repay, enabling collateral seizure.

- Payout: Audit contest
- Severity: high
- Program: Teller
- Found by: OpaBatyo
- Disclosed: 2024-11-16
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-11-teller-finance-update-judging/issues/39
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-teller-finance-update%3AH-2
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:business-logic vuln:dos

**Target:** TellerV2 repayLoan repayment listener callback
**Root cause:** setRepaymentListenerForBid only checks extcodesize>0, which a selfdestruct in the same transaction bypasses; the subsequent try/catch call to a codeless address reverts, and the try/catch does not swallow that revert.
**Steps:**
1. Lender deploys a contract with a selfdestruct function.
2. Lender calls `setRepaymentListenerForBid(_bidId, listener)` where listener has code.
3. In the same transaction, lender calls selfdestruct on the listener, deleting its code.
4. Borrower calls repayLoan; the `try ILoanRepaymentListener(loanRepaymentListener).repayLoanCallback{gas:80000}(...)` call to a codeless address reverts.
5. Repayment permanently blocked; loan defaults and lender seizes collateral.
**How found:** Reviewer noticed the try/catch around repayLoanCallback does not catch a call to a non-contract address, and that the extcodesize guard in setRepaymentListenerForBid can be defeated by selfdestruct within the same transaction (EIP-6780).
**Exploitation:** Lender bundles listener deployment, setRepaymentListenerForBid, and selfdestruct into one transaction so the extcodesize check passes but the address has no code at repay time. Every repayLoan attempt reverts, forcing default and collateral liquidation to the lender.
**Insight:** extcodesize>0 checks are unreliable when the same transaction can selfdestruct the contract; also, a try/catch around an external call still reverts if the target has no code, so guard with a low-level .call or re-check codesize at use time.

