In createSellOrder
and amendSellOrder
, the deadline of the order is calculated by adding seller-defined duration to the block.timestamp
. Sellers expect their order to be active only for a specific duration after they submitted the transaction to restrict the trades considering market condition. In addition, in buyOrder
there is a deadline comparison using block.timestamp
for checking whether the order is expired.
Since miners can influence block.timestamp
to a limited degree, they can manipulate the effective expiration date of a seller's order. This can extend or shorten an order's lifetime beyond the seller's intent, potentially forcing a trade under market conditions the seller sought to avoid, or causing a legitimate order to expire prematurely.
Likelihood:
Miner can include the seller's createSellOrder
and amendSellOrder
transaction in a block with a timestamp that is advantageous to the miner.
Miner can delay the buyer's buyOrder
transaction and include it in a block where the timestamp is after the deadlineTimestamp
.
Impact:
Forced Unfavorable Trades: The delayed seller's transaction can be outside the user's intended market conditions. This can force a user into a trade they no longer consider profitable.
Denial of Service: The delayed buyer's transaction can be reverted, forcing the user to lose their gas fee and preventing them from executing a trade they rightfully should have been able to make.
Below code shows both problems.
Forced Unfavorable Trades: Alice is willing to sell 1e8 WBTC with 100_000e6 USDC in just 2 days consdering the market condition. However, the timestamp is mainpulated while the BTC price goes up 5% in the period. Dan takes the profit.
Denial of Service: Bob creates sell order but the buying orders are rejceted due to the timestamp manipulation. Bob's order is expired so he needs to cancel it wihtout matched.
Use user defined UNIX deadline parameter instead of duration and block.timestamp
.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.