NextGen - Norah'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: 243/243

Findings: 2

Award: $0.00

🌟 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/MinterContract.sol#L276 https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L57-L61 https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L134-L143 https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L104-L120

Vulnerability details

description

NextGen Protocol implements a phase where the creator can call mintAndAuction() for certain NFTs in collection for a fixed duration of time, during which users can bid the price they are willing to pay for the NFT, and the highest bidder at the end of the auction gets the NFT.

Every bidder has to pay the ETH amount they are willing to bid, and it has to be higher than the previous bid. In the end, the winner gets the NTF, and the rest of the bids are returned to the respective bidders.

vulnerability

Alll the bids are stored in an array of struct auctionInfoData[_tokenid], Each time a new bid is made, a struct containing the address of the bidder and their bid is pushed into the array.

Any user can make multiple bids in auction and are also allowed to cancel their bids before the auctions ends.

exploit

A malicious user can simply back-run the mintAndAuction() and place two bids:

  • First bid with 1 wei (it will be allowed as he is the first bidder)
  • Second bid of very high value (say two times or the three times the actual market value of NFT).

Then this malicious user simply waits till the auction is about to end.

Meanwhile other interested buyers won't make a bid seeing the absurd bid by our malicious user, and even if they tried to make one with a fair value (say of half or one third of our malicious user's second bid), it will be rejected as it wont be higher than the previous bid.

When the auction is just about to end, the malicious user will call cancelBid() for their second bid, cancelling it and getting his high value bid amount back.

As a result, there will be only one bid when the auction ends: that of 1 wei by attacker, allowing him to claim the NFT for just 1 wei.

Now, there is a possibility that the malicious user may get back-run or that the transaction does not go through before auction ends, but for precious NFT, he has a very good incentive to pay the Validators/Miners and brick the auction.

impact

  • Malicious users can claim NFT for 1 wei by blocking other bidders during the mintAndAuction() phase.
  • Attacker will have to lock their capital for the duration of the auction, but that won't be an issue when the rare (worthy) NFTs are involved.
  • Submitting this is high because, while there is risk involved on the attacker's end in case the cancelBid() transaction does not go through but MEV attacks are still very prevalent.

proof of concept

tools used

manual review

  • I think the feature of canceling bids introduced more security concerns than the convenience it provides, as those who are not interested in auctions anymore will get their bid back anyway, once the auction ends.
  • Therefore, I would recommend removing the cancelBid() functionality altogether.

Assessed type

MEV

#0 - c4-pre-sort

2023-11-15T07:18:46Z

141345 marked the issue as duplicate of #962

#1 - c4-judge

2023-12-02T15:12:23Z

alex-ppg marked the issue as not a duplicate

#2 - c4-judge

2023-12-02T15:14:53Z

alex-ppg marked the issue as duplicate of #1784

#3 - c4-judge

2023-12-07T11:50:51Z

alex-ppg marked the issue as duplicate of #1323

#4 - c4-judge

2023-12-08T17:17:31Z

alex-ppg marked the issue as partial-50

#5 - c4-judge

2023-12-08T17:27:54Z

alex-ppg marked the issue as satisfactory

#6 - c4-judge

2023-12-08T17:58:45Z

alex-ppg marked the issue as partial-50

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