The OrderBook::amendSellOrder
function does not check for OrderBook::allowedSellToken[order.tokenToSell]
, allowing sellers to amend orders for tokens disabled via OrderBook::setAllowedSellToken(_token, false)
possibly because the admin has considered them compromised. While createSellOrder enforces the allowedSellToken check, amendSellOrder does not, permitting modifications to orders for disabled tokens.
Sellers can amend orders for disallowed tokens, violating token restrictions and potentially leading to invalid order states. This could allow manipulation of orders that should no longer be active, undermining the order book's integrity and risking unexpected behavior whereby a malicious seller can increase the amounts of tokens on sell and since OrderBook::buyOrder
function does not check for it as well, it'll be bought by a victim; a buyer buys the huge amount of compromised token unbeknownst to him in subsequent trades.
Deploy the OrderBook contract with valid addresses for wETH, wBTC, wSOL, and USDC.
Alice creates a sell order for wETH via createSellOrder(address(iWETH), 1e18, 2500e6, 1 days), transferring 1 wETH to the contract.
Owner disables wETH by calling setAllowedSellToken(address(iWETH), false).
Alice amends the wETH order via amendSellOrder(orderId, 0.5e18, 1250e6, 1 days), which succeeds, updating the order despite wETH being disabled.
Add this to test/TestOrderBook.t.sol
Add a check in OrderBook::amendSellOrder
to ensure the token is still allowed in OrderBook::allowedSellToken
.
Any current order with a delisted token can be amended.
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.