-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad debt can occur if the collateral token blacklists a borrower leading to total loss of stake for all lenders on that term #691
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-1245
grade-a
high quality report
This report is of especially high quality
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Comments
c4-bot-1
added
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
labels
Dec 27, 2023
The issue is well demonstrated, properly formatted, contains a coded POC. |
c4-pre-sort
added
the
high quality report
This report is of especially high quality
label
Jan 2, 2024
0xSorryNotSorry marked the issue as high quality report |
0xSorryNotSorry marked the issue as primary issue |
c4-pre-sort
added
the
primary issue
Highest quality submission among a set of duplicates
label
Jan 2, 2024
This was referenced Jan 2, 2024
Closed
Closed
c4-pre-sort
added
duplicate-1245
and removed
primary issue
Highest quality submission among a set of duplicates
labels
Jan 3, 2024
0xSorryNotSorry marked the issue as duplicate of #1245 |
c4-judge
added
downgraded by judge
Judge downgraded the risk level of this issue
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
and removed
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
labels
Jan 27, 2024
Trumpero changed the severity to QA (Quality Assurance) |
Trumpero marked the issue as grade-b |
Open
Trumpero marked the issue as grade-a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-1245
grade-a
high quality report
This report is of especially high quality
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/LendingTerm.sol#L803-L809
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/LendingTerm.sol#L617-L621
Vulnerability details
Summary
When a borrower gets blacklisted by a collateral token with a blacklist (like for example USDC), the borrower is not able to repay the loan as the
repay
function tries to transfer the collateral back to the borrower which will revert. Therefore, sooner or later someone will call the loan for liquidation and an auction start. But nobody is able to bid on the auction as thebid
function call will revert too when trying to transfer funds to a blacklisted address. As nobody is able to bid on the auction, the auction will continue till themidPoint
is reached. The mechanism of thismidPoint
is as follows:During the first half of the auction (before the
midPoint
is reached), an increasing amount of the collateral is offered, for the full CREDIT amount.During the second half of the action (after the
midPoint
), all collateral is offered, for a decreasing CREDIT amount. Bad debt can occur.Therefore, the moment the auction can be called again is when the system is in a dangerous situation where bad debt can occur. Which is handled by the ECG in a way that all lenders of the given term lose their stake.
Vulnerability Details
The flow of the issue is as follows:
collateralToBorrower
is 0Even if the lenders are trying to instantly buy the auction at the midPoint and therefore prevent bad debt, depending on the current on chain activity the transaction could not get mined in the given block and therefore bad debt occurs anyway.
The following POC can be implemented in the
AuctionHouse.t.sol
test file:Impact
If any borrower gets blacklisted by a collateral token with a blacklist (like for example USDC), the system is forced into a dangerous situation where bad debt can occur and all lenders of the given term lose their stake.
Recommendations
Implement a two-step approach for the collateral token so that the borrower is able to withdraw the collateral instead of transferring it directly to the borrower in the
repay
andonBid
function.Assessed type
ERC20
The text was updated successfully, but these errors were encountered: