The DutchTrade contract implements a Dutch auction mechanism for liquidations, but it does not account for potential sequencer downtime on L2s. This oversight could lead to auctions executing at unfair prices, causing losses for the protocol.
The auction price is calculated in the _price() function based on the current block.timestamp. If the sequencer goes offline during an auction and comes back online before the auction ends, the timestamp used for price calculation will have advanced, but no bids could have been placed during the downtime.
This can result in the auction executing at a lower price than the fair market value, as the price decay would have continued during the offline period.
Sequencer downtimes happen occasionally on L2s. For instance, Arbitrum suffered an hour-long outage several months ago.
Impact
Auctions may execute at unfairly low prices if the sequencer is offline for a portion of the auction duration
Proof of Concept
A Dutch auction starts with a 15-minute duration
After 2 minutes (13% of auction time), when the price is still in the geometric decay phase, the sequencer goes offline for 10 minutes
When the sequencer comes back online, there are only 3 minutes left in the auction (80% of auction time has passed)
The _price() function calculates the price as if 12 minutes had passed normally, setting the price in the linear decay phase between bestPrice and worstPrice
A bidder immediately places a bid at this unfairly low price, missing the entire geometric and first linear decay phases
Tools Used
Manual review
Recommended Mitigation Steps
Consider integrating an external uptime feed such as Chainlink's L2 Sequencer Feeds and disallowing bids if it was offline during the auction's duration.
Lines of code
https://github.com/code-423n4/2024-07-reserve/blob/3f133997e186465f4904553b0f8e86ecb7bbacbf/contracts/plugins/trading/DutchTrade.sol#L1
Vulnerability details
The
DutchTrade
contract implements a Dutch auction mechanism for liquidations, but it does not account for potential sequencer downtime on L2s. This oversight could lead to auctions executing at unfair prices, causing losses for the protocol.The auction price is calculated in the
_price()
function based on the currentblock.timestamp
. If the sequencer goes offline during an auction and comes back online before the auction ends, thetimestamp
used for price calculation will have advanced, but no bids could have been placed during the downtime.This can result in the auction executing at a lower price than the fair market value, as the price decay would have continued during the offline period.
Sequencer downtimes happen occasionally on L2s. For instance, Arbitrum suffered an hour-long outage several months ago.
Impact
Auctions may execute at unfairly low prices if the sequencer is offline for a portion of the auction duration
Proof of Concept
_price()
function calculates the price as if 12 minutes had passed normally, setting the price in the linear decay phase between bestPrice and worstPriceTools Used
Manual review
Recommended Mitigation Steps
Consider integrating an external uptime feed such as Chainlink's L2 Sequencer Feeds and disallowing bids if it was offline during the auction's duration.
Assessed type
Other