Tadle

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

Reentrancy in PreMarktes::relistOffer function

Summary

Reentrancy in PreMarktes::relistOffer function implementation and state variables written after the call(s), This exposes the protocol to reentrancy attack

Vulnerability Details

function relistOffer(address _stock, address _offer) external payable { //@audit check for reentrancy
OfferInfo storage offerInfo = offerInfoMap[_offer];
StockInfo storage stockInfo = stockInfoMap[_stock];
if (stockInfo.offer != _offer) {
revert InvalidOfferAccount(stockInfo.offer, _offer);
}
if (offerInfo.authority != _msgSender()) {
revert Errors.Unauthorized();
}
if (offerInfo.offerStatus != OfferStatus.Canceled) {
revert InvalidOfferStatus();
}
/// @dev market place must be online
ISystemConfig systemConfig = tadleFactory.getSystemConfig();
MakerInfo storage makerInfo = makerInfoMap[offerInfo.maker];
MarketPlaceInfo memory marketPlaceInfo = systemConfig
.getMarketPlaceInfo(makerInfo.marketPlace);
marketPlaceInfo.checkMarketPlaceStatus(
block.timestamp,
MarketPlaceStatus.Online
);
/**
* @dev transfer refund token from user to capital pool
* @dev offer settle type is protected or original offer
*/
if (
makerInfo.offerSettleType == OfferSettleType.Protected ||
stockInfo.preOffer == address(0x0)
) {
uint256 depositAmount = OfferLibraries.getRefundAmount(
offerInfo.offerType,
offerInfo.amount,
offerInfo.points,
offerInfo.usedPoints,
offerInfo.collateralRate
);
ITokenManager tokenManager = tadleFactory.getTokenManager();
@> tokenManager.tillIn{value: msg.value}( // @audit check for reentrancy
_msgSender(),
makerInfo.tokenAddress,
depositAmount,
false
);
}
/// @dev update offer status to virgin
offerInfo.offerStatus = OfferStatus.Virgin;
emit RelistOffer(_offer, _msgSender());
}

Impact

Exposes the protocol to reentrancy attack, making the protocol to lose assets

Tools Used

manual review

Recommendations

You can implement a reentrancy guard
Implement Check-Effects-Interactions (CEI) Pattern

Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Lack of quality
Assigned finding tags:

[invalid] finding-PreMarkets-reentrancy

Invalid, all [vague generalities](https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity#vague-generalities) talking about possible reentrancies 11and afaik, reentrancy is not possible and not proven.

Support

FAQs

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