Tadle

Tadle
DeFi
30,000 USDC
View results
Submission Details
Severity: medium
Invalid

Unchecked Integer Overflow in offerId Increment

Vulnerability Details

In the PreMarkets contract, the offerId is incremented without checking for potential overflow:

offerId = offerId + 1;

If offerId reaches its maximum value (2^256 - 1 for uint256), it will wrap around to zero on the next increment.

Impact

An overflow of offerId could lead to reuse of existing IDs, potentially causing conflicts in offer management, corrupting data structures, and compromising the integrity of the entire system.

Proof of Concept

Link to code

Link to code

function demonstrateOverflow() public {
uint256 maxUint = type(uint256).max;
offerId = maxUint;
// This will cause offerId to overflow
offerId = offerId + 1;
assert(offerId != 0);
// This assertion will fail, demonstrating the overflow
}

Tools Used

Recommendations

  • Use OpenZeppelin's SafeMath library

  • Consider implementing a maximum limit for offerId and handle the case when this limit is reached.

Updates

Lead Judging Commences

0xnevi Lead Judge
11 months ago
0xnevi Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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