Skip to content
DoS Audit finding Intermediate

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.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52, also found by GimelSec

GolomTrader.sol#L312-L317

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


The original report as published on Code4rena, by 0x52. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by 0x52

View all

211 more disclosed reports, best first.

More from Golom contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.