Tadle

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

Incorrect Equality Comparisons in DeliveryPlace Contract

Summary:

The DeliveryPlace contract contains several instances of strict equality checks that could lead to incorrect behavior due to their reliance on fixed values. These checks, if not handled correctly, may result in vulnerabilities or unintended behavior in contract execution.

Vulnerability Details:

ID-16: Incorrect Equality Check in settleAskTaker

Function: DeliveryPlace.settleAskTaker(address, uint256)
Source Location: src/core/DeliveryPlace.sol#L335-L433
Problematic Code:
solidity
if (status == MarketPlaceStatus.AskSettling)
Issue: Strict equality check against a fixed status value might lead to issues if status is not correctly set or if the value of MarketPlaceStatus.AskSettling is manipulated.
ID-17: Incorrect Equality Check in settleAskMaker

Function: DeliveryPlace.settleAskMaker(address, uint256)
Source Location: src/core/DeliveryPlace.sol#L222-L325
Problematic Code:
solidity

if (status == MarketPlaceStatus.AskSettling)
Issue: Similar to ID-16, this strict equality check may not handle all scenarios where status is involved.
ID-18: Incorrect Equality Check for Offer Type in settleAskMaker

Function: DeliveryPlace.settleAskMaker(address, uint256)
Source Location: src/core/DeliveryPlace.sol#L222-L325
Problematic Code:
solidity

if (offerInfo.offerType == OfferType.Bid)
Issue: Incorrect assumption about the offer type can lead to incorrect processing if offerInfo.offerType is not as expected.
ID-19: Incorrect Equality Check in closeBidTaker

Function: DeliveryPlace.closeBidTaker(address)
Source Location: src/core/DeliveryPlace.sol#L96-L212
Problematic Code:
solidity

if (makerInfo.offerSettleType == OfferSettleType.Protected)
Issue: Strict equality might fail if offerSettleType is not correctly set or if unexpected values are assigned.
ID-20: Incorrect Equality Check for Offer Status in closeBidTaker

Function: DeliveryPlace.closeBidTaker(address)
Source Location: src/core/DeliveryPlace.sol#L96-L212
Problematic Code:
solidity

if (offerInfo.offerStatus == OfferStatus.Virgin)
Issue: This check might not properly account for all valid offer statuses, leading to improper handling of offerInfo.
ID-21: Incorrect Equality Check for Offer Status in settleAskMaker

Function: DeliveryPlace.settleAskMaker(address, uint256)
Source Location: src/core/DeliveryPlace.sol#L222-L325
Problematic Code:
solidity

if (offerInfo.offerStatus == OfferStatus.Virgin)
Issue: The fixed status check might not handle all states of offerInfo.
ID-22: Incorrect Equality Check for Offer Type in closeBidOffer

Function: DeliveryPlace.closeBidOffer(address)
Source Location: src/core/DeliveryPlace.sol#L35-L87
Problematic Code:
solidity

if (offerInfo.offerType == OfferType.Ask)
Issue: Similar to previous issues, assuming a specific offerType can lead to unintended behavior if offerInfo does not match.
ID-23: Incorrect Equality Check for Settled Points in settleAskMaker

Function: DeliveryPlace.settleAskMaker(address, uint256)
Source Location: src/core/DeliveryPlace.sol#L222-L325
Problematic Code:
solidity

if (_settledPoints == offerInfo.usedPoints)
Issue: Strict equality might not accommodate all valid states of _settledPoints and offerInfo.usedPoints.

Impact:

The reliance on strict equality checks can lead to:

Incorrect State Handling: The contract may not correctly handle all possible states or transitions, leading to improper state changes or failed operations.
Exploitable Conditions: An attacker could potentially exploit these equality checks to manipulate contract behavior or gain unauthorized access to contract functions.

Tools Used:

Slither

Recommendations:

Use Safe Comparisons: Instead of strict equality, consider using safer comparison logic that accounts for potential variations in state or offer types.
Validate Input: Ensure that all inputs and states are properly validated before making critical decisions based on equality checks.

Updates

Lead Judging Commences

0xnevi Lead Judge
12 months ago
0xnevi Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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