Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: medium
Invalid

Insufficient Input Validation in createOffer Function

Vulnerability Details

The createOffer function in the PreMarkets contract lacks comprehensive input validation. While it checks for non-zero values of params.points and params.amount, it doesn't implement upper bound checks, potentially allowing extremely large values to be accepted.

Impact

Acceptance of extremely large values could lead to unexpected behavior, including potential overflow in subsequent calculations, excessive gas consumption, or economic imbalances in the system.

Proof of Concept

Link to code

function createOffer(CreateOfferParams calldata params) external payable {
if (params.points == 0x0 || params.amount == 0x0) {
revert Errors.AmountIsZero();
}
// Rest of the function...
}
// An attacker could call this function with extremely large values:
createOffer({
points: type(uint256).max,
amount: type(uint256).max,
// Other parameters...
});

Tools Used

Manual Review

Recommendations

  • Implement upper bound checks for params.points and params.amount:

require(params.points <= MAX_POINTS, "Points exceed maximum limit");
require(params.amount <= MAX_AMOUNT, "Amount exceeds maximum limit");

  • Consider implementing reasonability checks based on the expected use case of the contract.

  • Add checks for other parameters in the CreateOfferParams struct to ensure they are within acceptable ranges.

Updates

Lead Judging Commences

0xnevi Lead Judge
about 1 year ago
0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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