NextGen - 0xarno'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: 127/243

Findings: 3

Award: $5.96

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: smiling_heretic

Also found by: 00decree, 00xSEV, 0x180db, 0x3b, 0x656c68616a, 0xAadi, 0xAleko, 0xAsen, 0xDetermination, 0xJuda, 0xMAKEOUTHILL, 0xMango, 0xMosh, 0xSwahili, 0x_6a70, 0xarno, 0xgrbr, 0xpiken, 0xsagetony, 3th, 8olidity, ABA, AerialRaider, Al-Qa-qa, Arabadzhiev, AvantGard, CaeraDenoir, ChrisTina, DanielArmstrong, DarkTower, DeFiHackLabs, Deft_TT, Delvir0, Draiakoo, Eigenvectors, Fulum, Greed, HChang26, Haipls, Hama, Inference, Jiamin, JohnnyTime, Jorgect, Juntao, Kaysoft, Kose, Kow, Krace, MaNcHaSsS, Madalad, MrPotatoMagic, Neon2835, NoamYakov, Norah, Oxsadeeq, PENGUN, REKCAH, Ruhum, Shubham, Silvermist, Soul22, SovaSlava, SpicyMeatball, Talfao, TermoHash, The_Kakers, Toshii, TuringConsulting, Udsen, VAD37, Vagner, Zac, Zach_166, ZdravkoHr, _eperezok, ak1, aldarion, alexfilippov314, alexxander, amaechieth, aslanbek, ast3ros, audityourcontracts, ayden, bdmcbri, bird-flu, blutorque, bronze_pickaxe, btk, c0pp3rscr3w3r, c3phas, cartlex_, cccz, ciphermarco, circlelooper, crunch, cryptothemex, cu5t0mpeo, darksnow, degensec, dethera, devival, dimulski, droptpackets, epistkr, evmboi32, fibonacci, gumgumzum, immeas, innertia, inzinko, jasonxiale, joesan, ke1caM, kimchi, lanrebayode77, lsaudit, mahyar, max10afternoon, merlin, mrudenko, nuthan2x, oakcobalt, openwide, orion, phoenixV110, pontifex, r0ck3tz, rotcivegaf, rvierdiiev, seeques, shenwilly, sl1, slvDev, t0x1c, tallo, tnquanghuy0512, tpiliposian, trachev, twcctop, vangrim, volodya, xAriextz, xeros, xuwinnie, y4y, yobiz, zhaojie

Awards

0 USDC - $0.00

Labels

bug
3 (High Risk)
partial-50
duplicate-1323

External Links

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L116

Vulnerability details

Impact

Malicious bidders can steal ETH twice the amount they bid by exploiting cross-function reentrancy.

Proof of Concept

Consider the following scenario with participants Alice, Bob, and Bob's second account (let's call it Ron) in the auction:

1)Alice, Ron, and Bob bid 1 ETH, 2 ETH, and 3 ETH, respectively.

2)Bob, as the highest bidder, calls claimAuction when block.timestamp == minter.getAuctionEndTime(_tokenId).

3)The claimAuction function also refunds the amount to the bidders who lost the auction. Once the winner claims the auction or the function admin calls it.

4)During the loop iteration, the amount is refunded to Ron. Ron can then re-enter the cancelBid function to cancel the bid as soon as it receives the funds, effectively receiving the funds twice, Ron receives 4 ETH.

5)Upon the loop's third iteration, the NFT is sent to the winner, and the function execution finishes.

Link to relevant code - Line 116

Link to relevant code - Line 124

Tools Used

vscode

Ensure that the claimAuction function is called only after the auction has ended.

- require(block.timestamp >= minter.getAuctionEndTime(_tokenid) && auctionClaim[_tokenid] == false && minter.getAuctionStatus(_tokenid) == true);
+ require(block.timestamp > minter.getAuctionEndTime(_tokenid) && auctionClaim[_tokenid] == false && minter.getAuctionStatus(_tokenid) == true);

Assessed type

Reentrancy

#0 - c4-pre-sort

2023-11-15T05:24:38Z

141345 marked the issue as duplicate of #962

#1 - c4-judge

2023-12-04T21:41:57Z

alex-ppg marked the issue as duplicate of #1323

#2 - c4-judge

2023-12-08T17:49:06Z

alex-ppg marked the issue as partial-50

Lines of code

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

Vulnerability details

Impact

The winner of the auction can render the claimAuction function useless for a particular ID by bidding through a smart contract and not adding the onERC721Received callback hook. This callback is called by the NFT contract to ensure that the smart contract is capable of receiving and transferring the NFT. The malicious bidder will lose funds for a particular auction, and other bidders will not receive refunds because the function will revert each time.

Proof of Concept

Consider the following scenario with participants Alice and Bob in the auction:

A) Alice bids 1 ETH for tokenId = 2. B) Other bidders participate in the auction for the same tokenId. C) Bob places the highest bid (for tokenId = 2) and becomes the winner of the auction after it ends. However, he bid using a smart contract that did not implement the onERC721Received callback hook, either intentionally or unintentionally. D) If the winner or admin calls the claimAuction function for the same tokenId, IERC721(gencore).safeTransferFrom(ownerOfToken, highestBidder, _tokenId); will revert. This is because the callback checks whether the recipient contract is capable of receiving ERC721, but in this case, it is not, resulting in a revert.

Link to relevant code - Line 112

Tools Used

VSCode

Use transferFrom instead of safeTransferFrom.

Assessed type

DoS

#0 - c4-pre-sort

2023-11-20T13:57:07Z

141345 marked the issue as duplicate of #486

#1 - c4-judge

2023-12-01T22:09:44Z

alex-ppg marked the issue as not a duplicate

#2 - c4-judge

2023-12-01T22:10:07Z

alex-ppg marked the issue as duplicate of #1759

#3 - c4-judge

2023-12-08T22:05:36Z

alex-ppg marked the issue as partial-50

#4 - c4-judge

2023-12-09T00:23:42Z

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

Awards

5.4864 USDC - $5.49

Labels

bug
2 (Med Risk)
downgraded by judge
partial-50
duplicate-175

External Links

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L58 https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L58

Vulnerability details

Impact

In the AuctionDemo.sol contract, a bidder can participate in the auction using the participateToAuction function. However, there is an edge case where bidders can lose money if they bid when block.timestamp == AuctionEndTime and their transaction is below the winner's transaction in the block. In this scenario, the winner may intentionally or unintentionally pay a high gas fee to include their transaction at the top of the block, causing other transactions to be processed after theirs. Participants cannot cancel their bids because the time would have passed, and there is no recovery function to retrieve ETH from the contract.

Proof of Concept

Let's consider the following scenario with participants Alice, Ron, and Bob in the auction:

  1. Alice bids 1 ETH using participateToAuction(tokenId = 1).
  2. Bob waits until the last moment to bid, checking for other bidders.
  3. Bob bids 1.1 ETH for tokenId 1 in the block where time = AuctionEndTime.
  4. Alice sees this transaction in the mempool and calls the claimAuction function with tokenId = 1, using a higher gas price than Bob. Alternatively, Alice can use MEV to include her transaction in the specific block.
  5. Although Alice has already claimed the auction, Bob's bidding transaction will be processed after Alice's transaction. As a result, he will lose his 1.1 ETH because the time period has already passed, and there are no other bidders for Alice.

Tools Used

vscode

start claiming of auction only after bidding is finished

Assessed type

Other

#0 - c4-pre-sort

2023-11-20T13:54:33Z

141345 marked the issue as duplicate of #962

#1 - c4-judge

2023-12-02T15:33:07Z

alex-ppg marked the issue as not a duplicate

#2 - c4-judge

2023-12-02T15:35:00Z

alex-ppg marked the issue as duplicate of #1926

#3 - c4-judge

2023-12-08T18:49:33Z

alex-ppg marked the issue as partial-50

#4 - c4-judge

2023-12-09T00:21:41Z

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