-
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
Auction manipulation by block stuffing and reverting on ERC-777 hooks #685
Comments
0xSorryNotSorry marked the issue as sufficient quality report |
0xSorryNotSorry marked the issue as primary issue |
I'm skeptical of this being a valid finding (despite fomo3d), at least it's not a high. It is true that there is more spam/censorship risk on Optimism & Arbitrum. On mainnet liquidators can use flashbots etc, while on Arbitrum the sequencer is first come first served. If the liquidator raises the gas price of one tx, the spammer has to raise the gas price of all tx that fill the block. Costs can get out of hand pretty quickly. Take-away I think is that on L2s, the auctions should be long enough to account for this. We've also been discussing very long auctions internally to minimize liquidity risk (and allow people to have time to bridge assets in order to participate in auctions), which also mitigates this vector. |
eswak (sponsor) acknowledged |
eswak marked the issue as disagree with severity |
Trumpero changed the severity to QA (Quality Assurance) |
Trumpero marked the issue as grade-b |
This previously downgraded issue has been upgraded by Trumpero |
After reviewing again, I consider this to be an issue of block stuffing attack on the auction—a hypothetical attack path that could be profitable for attacker and result in losses for protocol. So I believe this should be a med, and only #463 is duplicate. |
Trumpero marked the issue as satisfactory |
Trumpero marked the issue as selected for report |
Hey @Trumpero, could you please take another look? The PoC seems impractical, assuming a constant gas price, which doesn't reflect reality. As the sponsor noted, "Costs can get out of hand pretty quickly," and auction profits wouldn't cover such expenses. Also, note that ERC777 is excluded from the scope, as mentioned in the Discord channel by the sponsor. Check @RunSoul22's comment for details. Edit: The report didn't consider EIP1559:
Ref: https://consensys.io/blog/what-is-eip-1559-how-will-it-change-ethereum |
@0xbtk The use of ERC-777 tokens is optional for this attack vector and only showcases a possibility to reduce the costs of the attack. Also, the maximum increase of the base fee on optimism (which was the blockchain taken as an example in this report) is 10% (https://docs.optimism.io/chain/differences#eip-1559). You are right that the costs of the attack are increased, but could still be profitable depending on the size of the loan. The attacker does also not need to stuff blocks for the full 30 minutes. Even one or a few blocks could be profitable depending on the size of the loan and the costs of stuffing a few blocks when the first one costs $6 and increases by 10% is pretty low. |
Although it is very unlikely to make profits, I still consider it as a possible hypothetical path with low likelihood. With the current configuration (30 minutes for auction duration), it doesn't guarantee that block stuffing might not be possible, so this issue should be a med. |
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/test/proposals/gips/GIP_0.sol#L175-L179
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/AuctionHouse.sol#L118-L196
Vulnerability details
HIGH: Auction manipulation by block stuffing and reverting on ERC-777 hooks
GitHub Links
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/test/proposals/gips/GIP_0.sol#L175-L179
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/AuctionHouse.sol#L118-L196
Summary
The protocol stated out in the C4 description that the deployment script of the protocol, located in test/proposals/gips/GIP_0.sol is also in scope, as protocol deployment/configuration mistakes could be made. A low immutable auction duration set in this deployment script can lead to profitable block stuffing attacks on the desired L2 chains. This attack vector can be further improved under the condition that the collateral token is ERC-777 compatible.
Vulnerability Details
The auction house contract is deployed with the following parameters (auctionDuration and midPoint are immutables):
During the first half of the auction (before midPoint), an increasing amount of the collateral is offered, for the full CREDIT amount.
During the second half of the action (after midPoint), all collateral is offered, for a decreasing CREDIT amount.
The calculation can be seen in the
getBidDetail
function:This means that as longer the auction goes till a bid is made (which instantly buys the auction), the more profit can be made by executing the auction.
The following conditions allow an attacker to manipulate auctions by stuffing blocks to increase profits:
But the impact increases further in terms of griefing as loss for terms can occur after the midPoint which will instantly lead to slashing and therefore all stakers of the given term will lose all their credit tokens weighted on this term.
The following code snippets showcase the slashing mechanism that lead to a total loss for the stakers if the term receives any loss during these block stuffing attack:
This attack vector can be further improved under the condition that the collateral token is ERC-777 compatible. It is advised to first read the report called
Bad debt can occur if the collateral token blacklists a borrower leading to total loss of stake for all lenders on that term
which showcases how the auction time is increased till the midPoint of the auction if transferring the collateral tokens to the borrower reverts.The attack path would be as follows:
Impact
The attacker can prevent other users from bidding on the auction and therefore manipulate the auction to a point where the attacker would be able to buy the full collateral for almost zero credit tokens. As loss for the term occurs in such an event, all stakers of the given term will lose all their credit tokens weighted on this term. If the given collateral token is ERC-777 compatible, the costs of such an attack can be drastically reduced. And the attack can potentially become a self liquidation attack.
Recommendations
Increase the auction duration, as the longer the auction goes the less profitable such an attack would be and implement the mentioned fix in the
Bad debt can occur if the collateral token blacklists a borrower leading to total loss of stake for all lenders on that term
report.Assessed type
MEV
The text was updated successfully, but these errors were encountered: