Submitted by reassor, also found by Wander, ulqiorra, ulqiorra, mjmoonwalker, reassor, dingo2077, Jerry0x, Parad0x, adriro, Kek, Kek, Respx, Viktor_Cortess, Viktor_Cortess, Haipls, J4de, Haipls, Englave, bin2chen, MiniGlome, djxploit, jasonxiale, and rokso
The Bio Protocol allows users to mint Bio NFTs that represent users bio. Once NFT is minted anyone can trigger tokenURI to retrieve JSON data with the bio and generated svg image. Example JSON content (decoded from Base64):
The issue is that function Bio.tokenURI is vulnerable to JSON injection and it is possible to inject " character into bio completely altering the integrity of JSON data. User sends following data as bio:
This is will result in following JSON data (new name key was injected):
Depending on the usage of Bio Protocol by frontend or 3rd party applications this will have serious impact on the security. Some examples of the attacks that can be carried:
https://github.com/code-423n4/2023-03-canto-identity/blob/077372297fc419ea7688ab62cc3fd4e8f4e24e66/canto-bio-protocol/src/Bio.sol#L103-L115
Manual Review / Foundry / VSCode
It is recommended to properly encode users bio to make sure it cannot alter returned JSON data.
OpenCoreCH (Canto Identity) disagreed with severity and commented:
0xleastwood (judge) commented:
OpenCoreCH (Canto Identity) commented:
0xleastwood (judge) decreased severity to Medium and commented:
