Skip to content
DoS Audit finding Intermediate

Unable to liquidate USDC blacklisted user's loan due to transferring leftover collateral back in USDC

The liquidation process transfers leftover collateral to the borrower as USDC, but if the borrower is blacklisted by the USDC contract, that transfer reverts and blocks liquidation. An attacker who is blacklisted could therefore prevent their loan from being liquidated, potentially causing bad debt.

Inspex Follow with jprod15, m9800 and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-04-jojo-judging/issues/206

Found by

Inspex, jprod15, m9800, monrel, peakbolt

Summary

During the loan liquidation process, any remaining collateral will be swapped to USDC tokens and transferred to the liquidated user. However, if the USDC contract blacklists the liquidated user, the liquidation transaction will be revert. As a result, the user's loan will be unable to be liquidated if they have been blacklisted by the USDC token contract.

Vulnerability Detail

During the liquidation process, any remaining tokens will be transferred to the owner of the loan. However, if the loan owner has been blacklisted by USDC token, this flow will be reverted due to the code shown below.

https://github.com/sherlock-audit/2023-04-jojo/blob/main/JUSDV1/src/Impl/JUSDBank.sol#L199-L204

As a result, users who have been blacklisted by USDC will be unable to liquidate their loan positions during the period of the blacklisting.

Impact

The liquidation process might DoS due to its reliance on paying back remaining tokens in USDC only. This will error where transferring USDC tokens to blacklisted users can cause the transaction to be reverted, disrupting the liquidation flow. This will result in a bad debt for the platform.

Code Snippet

https://github.com/sherlock-audit/2023-04-jojo/blob/main/JUSDV1/src/Impl/JUSDBank.sol#L199-L204

Tool used

Manual Review

Recommendation

We suggest implementing one or all of the following solutions:

  1. Prevent USDC blacklisted users from opening a loan position until they are no longer blacklisted. This can be done by implementing a blacklist check during the borrowing process.
  2. Remove the transfer of remaining USDC tokens to the liquidated user during the liquidation flow. Instead, allow the user to withdraw their remaining USDC tokens on their own after the liquidation process is complete.

Discussion

JoscelynFarr

We will allow partial liquidation to avoid this happened.

The original report as published on Sherlock, by Inspex. 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

Likely the liquidation function unconditionally transfers leftover collateral as USDC to the borrower, without handling the case where the USDC contract rejects transfers to that address.

Impact

Liquidation could be blocked for blacklisted borrowers, which may lead to bad debt for the platform.

What the attacker needed

Borrower is blacklisted by USDC; loan becomes eligible for liquidation

The fix

The project said it would allow partial liquidation to avoid the issue; the report also suggested checking the blacklist before opening a loan or letting users withdraw leftover USDC themselves.

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.

When a loan is closed out by the platform (liquidated), any collateral left over is converted to a stablecoin called USDC and sent back to the borrower. The USDC issuer can block specific addresses, and any transfer to a blocked address fails. So if a borrower is blocked, the whole liquidation fails and the loan cannot be closed.

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 Inspex

View all

2 more disclosed reports, best first.

More from JOJO Exchange

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.