Tadle

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

Title: Missing Zero Address Check in PreMarket::settledAskOffer

Summary

The PreMarket::settledAskOffer function in the smart contract lacks a critical zero address check for the _offer parameter. This oversight could potentially lead to unintended state changes or errors when settling non-existent offer entries.

Vulnerability Details

The PreMarket::settledAskOffer lacks validation to ensure that the provided _offer address is not the zero address (0x0). The function directly accesses the offerInfoMap using the provided address without any preliminary checks

This means that if a zero address is passed (either accidentally or maliciously), the function will still execute, potentially updating a non-existent offer entry or causing unexpected behavior.

https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/PreMarkets.sol#L738-L749

Impact

The lack of a zero address check could lead to several issues:

  1. Silent failures: Settling a non-existent offer (zero address) would not throw an error but would not have any real effect, potentially leading to misconceptions about the system state.

  2. Potential for misuse: Malicious actors could exploit this to emit misleading events with a zero address offer.

  3. Financial implications: If the system relies on this function for financial settlements, it could lead to incorrect accounting or loss of funds.

Tools Used

Manual Review

Recommendations

To address this vulnerability, implement a zero address check at the beginning of the function:

function settledAskOffer(
address _offer,
uint256 _settledPoints,
uint256 _settledPointTokenAmount
) external onlyDeliveryPlace(tadleFactory, _msgSender()) {
if (_offer == address(0)) {
revert ZeroAddressOffer();
}
OfferInfo storage offerInfo = offerInfoMap[_offer];
offerInfo.settledPoints = _settledPoints;
offerInfo.settledPointTokenAmount = _settledPointTokenAmount;
offerInfo.offerStatus = OfferStatus.Settled;
emit SettledAskOffer(_offer, _settledPoints, _settledPointTokenAmount);
Updates

Lead Judging Commences

0xnevi Lead Judge
12 months ago
0xnevi Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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