-
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
ERC777 can break the term and cause every lender to get liquidated #184
Comments
0xSorryNotSorry marked the issue as sufficient quality report |
0xSorryNotSorry marked the issue as duplicate of #685 |
Trumpero changed the severity to QA (Quality Assurance) |
Trumpero marked the issue as grade-b |
This previously downgraded issue has been upgraded by Trumpero |
Trumpero marked the issue as not a duplicate |
Trumpero marked the issue as primary issue |
I consider this issue to be distinct from issue #685, as a borrower can just use ERC777's hook to prevent bidding and create losses for lending terms. Since the contest docs didn't exclude ERC777, I believe this should be a medium. |
Trumpero marked the issue as satisfactory |
Trumpero marked the issue as selected for report |
eswak (sponsor) acknowledged |
Hi @Trumpero, The sponsor confirmed to us in Discord that ERC-777 is not supported. |
@serial-coder Thanks for providing information. Based on the sponsor's statement in the public channel, this issue should be marked as OOS. |
Trumpero marked the issue as unsatisfactory: |
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/loan/LendingTerm.sol#L804-L817
Vulnerability details
Impact
One of the attack vectors that the developers want us to check is malicious collateral. One such vector could be ERC777, as its use as collateral could result in every liquidation causing bad debt.
Proof of Concept
After borrowers miss their partial payments, anyone can call them and start an auction. When a user thinks they will profit from the liquidation, they can bid on the auction. In this process, they pay the bad debt for some collateral, and the remaining collateral is returned to the borrower.
However, this can be dangerous, as borrowers can revert the transaction when they receive the collateral. This way, they can prevent any bid below the mid-point, and after the mid-point, bids can cause bad debt.
Example:
A competitor of ECG wants to harm its reputation, so he borrows the minimum allowed amount.
He leaves the loan open and intentionally misses his first payment.
Alice tries to liquidate this borrower, however, every transaction before the mid-point is reverted by the borrower's smart contract.
The mid-point passes, and the borrower no longer receives collateral, preventing them from reverting the transaction.
Alice successfully liquidates the borrower after the mid-point, but this causes the gauge to be slashed as a very small amount of bad debt accrues.
Note that the borrower can borrow the maximum allowed loan token for their collateral. If the minimum ratio is worth 100 USD, and
maxDebtPerCollateralToken
is 80%, the borrower can borrow 80 USD, effectively causing the gauge to be slashed for only 20 USD.Tools Used
Manual review.
Recommended Mitigation Steps
Implement push instead of pull. This way, borrowers will not be able to cause unnecessary damage to the protocol.
Assessed type
ERC20
The text was updated successfully, but these errors were encountered: