Orders with tokenAmt of type(uint256).max cannot be cancelled by GolomTrader.sol#cancelOrder
An order whose token amount is the maximum unsigned integer value cannot be cancelled, because the cancellation routine adds one to that amount and the arithmetic overflows, making the transaction revert every time. An attacker could therefore leave such an order permanently uncancellable.
Submitted by 0x52, also found by GimelSec
Order unable to be cancelled by cancelOrder.
Proof of Concept
filled[hashStruct] = o.tokenAmt + 1;
cancelOrder will overflow in the line shown above if o.tokenAmt is type(uint256).max causing the transaction to always revert for that order.
Recommended Mitigation Steps
I don’t see any reason why 1 should be added to o.tokenAmt, change to:
filled[hashStruct] = o.tokenAmt;
0xsaruman (Golom) acknowledged, but disagreed with severity
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the cancellation logic adds one to the order's token amount to mark it as filled, which overflows when the amount is already the maximum value.
Impact
An order with the maximum token amount can never be cancelled, leaving it stuck on the contract.
What the attacker needed
Order with tokenAmt set to the maximum value
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract stores numbers in fixed-size slots, and the largest possible value in such a slot cannot be increased by one without wrapping around. The cancellation code tries to add one to the order's amount, so for that maximum amount the addition fails and the whole cancellation is rejected. The result is an order that can never be cancelled.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.