Submitted by Cosine, also found by HighDuty, Byteblockers, and OMEN
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
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.
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 long as the auction goes until 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:
Blocks in optimism are minted every 2s. The block gas limit of optimism is 30M as in ethereum mainnet. At the time of writing this, the cost of stuffing a full block on optimism is around $6.39. See here.
Therefore, preventing a bid for one minute costs $6.39 * 30 blocks = $191.7, and preventing a bid for 30 minutes costs $191.7 * 30 minutes = $5751.
But the attacker will almost never need to stuff blocks for around 30 minutes, as the system of the auction is not profitable in the beginning and it starts to be really profitable after the midpoint. It also starts to be much more damaging to the system at this point. Which is after 10m 50s and the costs to stuff blocks for 10m 50s is $191.7 * 10.5 minutes = $2012.85. As mentioned before, the auction is not profitable at the beginning; therefore, no one will bid on second one and the attacker does not need to stuff blocks instantly. This means the attack will most likely cost less than $2000.
Therefore, if at any given timestamp the profit of the auction outweighs the cost of stuffing blocks for the time till the deal becomes profitable for the attacker a system damaging incentive appears and manipulating auctions becomes a profitable attack vector.
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 until the midPoint of the auction if transferring the collateral tokens to the borrower reverts.
The attack path would be as follows:
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.
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.
MEV
eswak (Ethereum Credit Guild) acknowledged, but disagreed with severity and commented:
TrungOre (judge) decreased severity to Low
TrungOre (judge) increased severity to Medium and commented:
btk (warden) commented:
Cosine (warden) commented:
TrungOre (judge) commented:
Note: For full discussion, see here.
