Lender force Loan become default
The repay function sends the debt token straight to the lender, so if the lender is on the token's blacklist the transfer always reverts. A malicious lender can therefore block repayment and let the loan expire, then take the borrower's collateral.
hansfriese Follow with 0x52, wagmi and 10 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2023-01-cooler-judging/issues/23
Found by
hansfriese, 0x52, wagmi, IllIllI, bin2chen, Zarf, dipp, libratus, simon135, Trumpero, zaskoh, TrungOre, cccz
Summary
in repay() directly transfer the debt token to Lender, but did not consider that Lender can not accept the token (in contract blacklist), resulting in repay() always revert, and finally the Loan can only expire, Loan be default
Vulnerability Detail
The only way for the borrower to get the collateral token back is to repay the amount owed via repay(). Currently in the repay() method transfers the debt token directly to the Lender.
This has a problem:
if the Lender is blacklisted by the debt token now, the debtToken.transferFrom() method will fail and the repay() method will always fail and finally the Loan will default.
Example:
Assume collateral token = ETH,debt token = USDC, owner = alice
1.alice call request() to loan 2000 usdc , duration = 1 mon
2.bob call clear(): loanID =1
3.bob transfer loan[1].lender = jack by Cooler.approve/transfer
Note: jack has been in USDC's blacklist for some reason before
or bob in USDC's blacklist for some reason now, it doesn't need transfer 'lender')
4.Sometime before the expiration date, alice call repay(id=1) , it will always revert, Because usdc.transfer(jack) will revert
5.after 1 mon, loan[1] default, jack call defaulted() get collateral token
function repay (uint256 loanID, uint256 repaid) external {
Loan storage loan = loans[loanID];
...
debt.transferFrom(msg.sender, loan.lender, repaid); //***<------- lender in debt token's blocklist will revert , example :debt = usdc
collateral.transfer(owner, decollateralized);
}
Impact
Lender forced Loan become default for get collateral token, owner lost collateral token
Code Snippet
https://github.com/sherlock-audit/2023-01-cooler/blob/main/src/Cooler.sol#L122
Tool used
Manual Review
Recommendation
Instead of transferring the debt token directly, put the debt token into the Cooler.sol and set like: withdrawBalance[lender]+=amount, and provide the method withdraw() for lender to get debtToken back
Discussion
hrishibhat
Sponsor comment:
Niche case + lender can transfer lender role to different, non-blacklisted wallet if needed.
IllIllI000
The attacker in this case is the lender, so they wouldn't transfer to another wallet
hrishibhat
Agree with Lead Watson as the lender themself is the attacker here
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
Likely the repay logic pushes the debt token directly to the lender instead of holding it in the contract, so a blocked lender address makes every repayment revert.
Impact
The borrower could lose their collateral because repayment is permanently blocked, though the sponsor argues the case is niche and the lender role can be moved to another wallet.
What the attacker needed
A lender address blacklisted by the debt token; an active loan with collateral locked
The fix
The debt token should be held in the contract as a withdrawable balance for the lender rather than sent directly, so a blocked lender address cannot block repayment.
How it was found
- The borrower requests a loan of a debt token against collateral.
- A lender clears the request, creating the loan.
- The lender role ends up with an address that is blacklisted by the debt token.
- Before expiry the borrower calls repay, which always reverts because the transfer to the lender fails.
- After the duration passes the loan defaults and the lender calls defaulted to take the collateral.
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.
Some tokens, like USDC, let the issuer block specific wallets so they cannot send or receive that token. Here the contract pays the lender back by sending tokens directly to their wallet, so a lender who is blocked makes every repayment attempt fail. The borrower then cannot get their collateral back and the lender keeps it.
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.