Art Gobblers contest - arcoun'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: 12/109

Findings: 2

Award: $2,830.23

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: wagmi

Also found by: 0x52, CertoraInc, Lambda, RaymondFam, arcoun

Labels

bug
duplicate
2 (Med Risk)

Awards

2775.0325 USDC - $2,775.03

External Links

Lines of code

https://github.com/code-423n4/2022-09-artgobblers/blob/main/src/ArtGobblers.sol#L457-L458 https://github.com/code-423n4/2022-09-artgobblers/blob/main/src/ArtGobblers.sol#L469 https://github.com/code-423n4/2022-09-artgobblers/blob/main/src/utils/token/GobblersERC721.sol#L166

Vulnerability details

Impact

During a Legendary Gobbler mint, the number of gobblers owned by the user is wrongly updated. After the mintLegendaryGobbler() call, the gobblersOwned variable in the user's data will have one more gobbler than expected. Any caller of the balanceOf() method will get a wrong result and may make bad assumptions.

The issue is due to the fact that the minted Legendary token is added two times:

  • During mintLegendaryGobbler(), the number of burned gobblers is removed and one token is added for the minted Legendary token
  • During _mint() the minted token is also added, although it has already be added

Proof of Concept

  • A legendary can be minted with gL gobblers
  • A user has gU gobblers, with gu >= gL
  • The user call mintLegendaryGobbler to mint a legendary
  • gU will first be updated to gU - gL + 1
  • gU will be increased by 1 during _mint()
  • The number of owned gobbler will then be equal to gU - gL + 2 instead of gu - gL + 1

The minted token should not be added during mintLegendaryGobbler() as it will already be added during _mint().

QA Report

Low Risk Issues

1. ArtGobblers is not EIP-1155 compliant as an ERC1155TokenReceiver

https://github.com/code-423n4/2022-09-artgobblers/blob/main/src/ArtGobblers.sol

The ArtGobblers contract can receive ERC1155 tokens using the safe receiver functions inherited from ERC1155TokenReceiver but it does not return the related interface in the supportsInterface method (ERC165).

EIP-1155 states that:

Smart contracts MUST implement the ERC-165 supportsInterface function and signify support for the ERC1155TokenReceiver interface to accept transfers.

The supportsInterface method is currently inherited from ERC721 which does not support ERC1155. The ArtGobblers contract should implement its own supportsInterface method to support both ERC721 and ERC1155TokenReceiver interfaces.

2. ArtGobblers are not ERC1155 NFTs

https://github.com/code-423n4/2022-09-artgobblers/blob/main/README.md?plain=1#L213 https://github.com/code-423n4/2022-09-artgobblers/blob/main/src/ArtGobblers.sol#L83

The README.md file states that Art Gobblers are ERC1155 NFTs but they are not. The ArtGobblers contract implements the token as an ERC721 token which can receive ERC1155 NFTs.

Non-critical Issues

1. Use 1e18 instead of 1000000000000000000

https://github.com/transmissions11/solmate/blob/bff24e835192470ed38bf15dbed6084c2d723ace/src/utils/SignedWadMath.sol

Use 1e18 instead of 1000000000000000000 to increase readability.

#0 - GalloDaSballo

2022-10-14T00:28:00Z

1. ArtGobblers is not EIP-1155 compliant as an ERC1155TokenReceiver

Edit: Per https://eips.ethereum.org/EIPS/eip-1155#:~:text=ERC1155TokenReceiver%20ERC%2D165%20rules%3A If you're looking to receive a ERC1155 you want to signify it via the ERC1155TokenReceiver token support on supportsInterface

Meaning the finding is valid

L

2. ArtGobblers are not ERC1155 NFTs

NC

1. Use 1e18 instead of 1000000000000000000

R

1L 1R 1NC

Genuine work, but missing a few more findings, good start!

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