Dandy Caramel Tortoise - Not updating state before making custom external call can cause borrower's to loose assets due to re-entrancy #42
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Dandy Caramel Tortoise
Medium
Not updating state before making custom external call can cause borrower's to loose assets due to re-entrancy
Summary
Not updating state before making custom external call can cause borrower's to loose assets due to re-entrancy
Root Cause
The details of the repayment is updated only after the external call to the
loanRepaymentListener
is madehttps://github.com/sherlock-audit/2024-11-teller-finance-update/blob/0c8535728f97d37a4052d2a25909d28db886a422/teller-protocol-v2-audit-2024/packages/contracts/contracts/TellerV2.sol#L865-L870
This allows a malicious lender to reenter the
TellerV2
contract and invokelenderCloseLoan
seizing the collateral of the borrower as well if the loan is currently defaultedInternal pre-conditions
External pre-conditions
No response
Attack Path
.repayLoanCallback
is calledloanRepaymentListener
and invokes thelenderCloseLoan
function further seizing the collateral of the borrowerImpact
Borrower will loose repayment amount and also the collateral
PoC
No response
Mitigation
Update the state before the
loanRepaymentListener
call is madeThe text was updated successfully, but these errors were encountered: