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
Rank: 78/98
Findings: 1
Award: $19.87
๐ Selected for report: 0
๐ Solo Findings: 0
19.8705 USDC - $19.87
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
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:
รฐ
Poison bytes string:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0
รข
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e2
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
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