Art Gobblers contest - ak1's results

Experimental Decentralized Art Factory By Justin Roiland and Paradigm.

General Information

Platform: Code4rena

Start Date: 20/09/2022

Pot Size: $100,000 USDC

Total HM: 4

Participants: 109

Period: 7 days

Judge: GalloDaSballo

Id: 163

League: ETH

Art Gobblers

Findings Distribution

Researcher Performance

Rank: 76/109

Findings: 1

Award: $55.20

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-09-artgobblers/blob/d2087c5a8a6a4f1b9784520e7fe75afa3a9cbdbe/src/ArtGobblers.sol#L461-L463

Vulnerability details

Impact

This could truncate the price value of legendaryGobblerAuctionData.startPrice during mintLegendaryGobbler call.

Proof of Concept

https://github.com/code-423n4/2022-09-artgobblers/blob/d2087c5a8a6a4f1b9784520e7fe75afa3a9cbdbe/src/ArtGobblers.sol#L461-L463

legendaryGobblerAuctionData.startPrice = uint120( cost <= LEGENDARY_GOBBLER_INITIAL_START_PRICE / 2 ? LEGENDARY_GOBBLER_INITIAL_START_PRICE : cost * 2 );

value type of legendaryGobblerAuctionData.startPrice is uint128. This can hold value greater than uint120 But, during price calculation, incorrect typecast value is used. this could lead reduced price value than what is expected.

Tools Used

Manual code review

typecast as uint128 as done in below line of code. https://github.com/code-423n4/2022-09-artgobblers/blob/d2087c5a8a6a4f1b9784520e7fe75afa3a9cbdbe/src/ArtGobblers.sol#L324

Example :

legendaryGobblerAuctionData.startPrice = uint128(LEGENDARY_GOBBLER_INITIAL_START_PRICE);

#0 - Shungy

2022-09-28T09:46:18Z

The maximum cost is around ~4k. Even if you ignore supply limitation and assume all legendary gobblers are minted at max price, the last gobbler will cost69 * 2**9. That fits uint120.

That being said, this finding is not wholly invalid, as the type of startPrice is uint128, so it does not make sense to cast it to uint120 first. So should be informational in QA report.

#1 - GalloDaSballo

2022-10-09T18:46:41Z

Per the discussion above, the limit of the cast doesn't create a "Low Risk", however, for the sake of consistency a uint128 should be used.

I believe QA Refactoring to be more appropriate

R

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