Juicebox contest - joestakey's results

The decentralized fundraising and treasury protocol.

General Information

Platform: Code4rena

Start Date: 18/10/2022

Pot Size: $50,000 USDC

Total HM: 13

Participants: 67

Period: 5 days

Judge: Picodes

Total Solo HM: 7

Id: 172

League: ETH

Juicebox

Findings Distribution

Researcher Performance

Rank: 18/67

Findings: 1

Award: $342.00

QA:
grade-a

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Awards

341.9967 USDC - $342.00

Labels

bug
documentation
disagree with severity
downgraded by judge
QA (Quality Assurance)
grade-a
Q-45

External Links

Lines of code

https://github.com/jbx-protocol/juice-nft-rewards/blob/f9893b1497098241dd3a664956d8016ff0d0efd0/contracts/JBTiered721Delegate.sol#L140

Vulnerability details

JBTiered721Delegate inherits from JB721Delegate, which inherits from ERC721

It implements JBTiered721Delegate.tokenURI(), a function overriding ERC721's tokenURI().

This function returns the metadata URI of the provided token ID.

The issue is that if queried for a token that does not have an owner or has not been minted, it returns the empty string ''.

This breaks compliance with EIP721, ERC721Metadata.which states that tokenURI():

Throws if `_tokenId` is not a valid NFT

Impact

It opens a risk for contracts that would interact with JBTiered721Delegate and query tokenId() - for instance to check contributors of a project, if a function performs some logic based on the tokenURI of a tokenId and expects the call to revert if queried for an unminted token.

Tools Used

Manual Analysis

Mitigation

Have the function JBTiered721Delegate.tokenURI() revert if queried for a tokenId that has not been minted yet.

+          _requireMinted(tokenId);
-140:      if (_owners[_tokenId] == address(0)) return '';

#0 - c4-judge

2022-11-08T15:10:45Z

Picodes changed the severity to QA (Quality Assurance)

#1 - c4-judge

2022-11-08T15:10:51Z

Picodes marked the issue as grade-a

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