Boxy Ash Ant
High
The modifyOrder
functions across all contracts (Bracket, StopLimit, OracleLess) lack validation to prevent modification of cancelled or filled orders. An attacker can cancel an order to receive their funds, then modify the cancelled order to receive the order amount again.
The contracts track orders in two separate data structures. However, modifyOrder only checks ownership and there is no check if order is canceled or filled. This allows user to withdraw funds twice for canceled or filled orders by modifying their orders.
function modifyOrder(uint96 orderId, ...) external nonReentrant {
Order memory order = orders[orderId];
require(msg.sender == order.recipient, "only order owner");
// @audit No check if order is still active in pendingOrderIds
if (amountInDelta != 0) {
if (increasePosition) {
newAmountIn += amountInDelta;
// ... transfer tokens ...
}
}
// ... update order ...
}
No response
No response
- User create initial order
- Cancel order to receive funds
- Modify cancelled order to decrease order amount and receive more funds
Multiple withdrawals of the same order amount
No response
Update order amount when canceled or filled