NextGen - spark's results

Advanced smart contracts for launching generative art projects on Ethereum.

General Information

Platform: Code4rena

Start Date: 30/10/2023

Pot Size: $49,250 USDC

Total HM: 14

Participants: 243

Period: 14 days

Judge: 0xsomeone

Id: 302

League: ETH

NextGen

Findings Distribution

Researcher Performance

Rank: 175/243

Findings: 1

Award: $0.47

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/AuctionDemo.sol#L112

Vulnerability details

Impact

The refund process can be blocked by the auction winner.

Proof of Concept

The ERC721.safeTransferFrom requires the callback process with IERC721Receiver-onERC721Received when the receiver is a contract.

When claiming an auction, the refund will be processed at the same time.

for (uint256 i=0; i< auctionInfoData[_tokenid].length; i ++) { if (auctionInfoData[_tokenid][i].bidder == highestBidder && auctionInfoData[_tokenid][i].bid == highestBid && auctionInfoData[_tokenid][i].status == true) { IERC721(gencore).safeTransferFrom(ownerOfToken, highestBidder, _tokenid); // @audit try revert in highestBidder contract. (bool success, ) = payable(owner()).call{value: highestBid}(""); emit ClaimAuction(owner(), _tokenid, success, highestBid); } else if (auctionInfoData[_tokenid][i].status == true) { (bool success, ) = payable(auctionInfoData[_tokenid][i].bidder).call{value: auctionInfoData[_tokenid][i].bid}(""); emit Refund(auctionInfoData[_tokenid][i].bidder, _tokenid, success, highestBid); } else {} }

As a result, the attacker can implement the receiver contract with following function to block the refund.

bool flag = true; function onERC721Received(address, address, uint256, bytes memory) public returns (bytes4) { require(!flag, "block"); return this.onERC721Received.selector; }

Tools Used

Manual

Let the user invoke the refund or NFT claim instead of through the loop.

Assessed type

DoS

#0 - c4-pre-sort

2023-11-17T08:01:39Z

141345 marked the issue as duplicate of #486

#1 - c4-judge

2023-12-01T22:17:50Z

alex-ppg marked the issue as not a duplicate

#2 - c4-judge

2023-12-01T22:18:06Z

alex-ppg marked the issue as duplicate of #1759

#3 - c4-judge

2023-12-08T22:08:38Z

alex-ppg marked the issue as partial-50

#4 - c4-judge

2023-12-09T00:23:12Z

alex-ppg changed the severity to 2 (Med Risk)

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter