Canto Identity Subprotocols contest - dingo2077's results

Subprotocols for Canto Identity Protocol.

General Information

Platform: Code4rena

Start Date: 17/03/2023

Pot Size: $36,500 USDC

Total HM: 10

Participants: 98

Period: 3 days

Judge: leastwood

Total Solo HM: 5

Id: 223

League: ETH

Canto Identity Subprotocols

Findings Distribution

Researcher Performance

Rank: 78/98

Findings: 1

Award: $19.87

๐ŸŒŸ Selected for report: 0

๐Ÿš€ Solo Findings: 0

Findings Information

Awards

19.8705 USDC - $19.87

Labels

bug
2 (Med Risk)
satisfactory
duplicate-212

External Links

Lines of code

https://github.com/code-423n4/2023-03-canto-identity/blob/main/canto-bio-protocol/src/Bio.sol#L121 https://github.com/code-423n4/2023-03-canto-identity/blob/main/canto-bio-protocol/src/Bio.sol#L43

Vulnerability details

Impact

In Bio.sol contract there is ability to mint NFT with special poison strings. After minting if user call tokenURI(id) he will get en error [FAIL. Reason: Index out of bounds] Impact: USER can't use his NFT if it minted with some special characters mentioned below. For example:

  1. String:รฐ Poison bytes string: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0
  2. String:รข 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e2

Proof of Concept

  1. You can just fuzz run ~2048 and see an error
  2. You can use custom foundry test:
bytes public posion = hex"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0"; function testCustom() public { string memory text = string(posion); bio.mint(text); uint256 tokenId = bio.numMinted(); string memory uri = bio.tokenURI(tokenId); //here is the error; }

https://i.imgur.com/i5EkCnE.png

Tools Used

VScode + foundry;

There is high probability that function tokenURI() can't handling appropriately many poison characters. It is necessary to fuzz test it and may be avoid poison characters using posionArray.

#0 - c4-judge

2023-03-28T03:56:49Z

0xleastwood marked the issue as duplicate of #212

#1 - c4-judge

2023-04-11T19:35:50Z

0xleastwood marked the issue as satisfactory

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