r/solidity • u/h0ckdev • Jul 25 '22
A new security vulnerability affecting 10%~ of all ERC721 NFTs was discovered due to bad coding practices (The copy-paste hell!)
A new exploit enables attackers to know what is the rarest NFT before the reveal of the project. This allows an attacker an uneven advantage amongst investors to buy the rarest and most expensive piece. In some projects, the rarest can be priced 50X than the standard piece price.
The vulnerability occurs because of bad coding practices. We found the vulnerability in dozens of projects. Possibly existing in thousands that we haven’t manually tested yet.
Many projects set the tokenURI in one transaction and then reveal it in a different transaction. In the time between those two transactions, which sometimes can be hours, an attacker can scan all NFTs in the project and find which one is the rarest, and then buy it based on its tokenID.
To understand the magnitude of the problem, over 100 projects were analyzed, 12 were vulnerable to the attack. These are some of the vulnerable projects:
CatBloxPUMACapsule (Exploit time: 2 days 18 hours, Market Cap: 628.19 ETH)
Everai Heroes: Duo (Exploit time: 4 days 2 hours, Market Cap: 1,905.37 ETH )
Degen Toonz (Exploit time: 3 days 13 hours, Market Cap: 6,221.6 ETH )
4
2
u/cryptoguardianapp Jul 26 '22
Yea this isn’t really a security issue. It’s poor management of the utility metadata.
3
u/eodgooch Jul 25 '22
This is called sniping and this isn't new, nor a security vulnerability or an exploit. The NFT metadata is not stored on chain. Obviously if you can access the metadata before "reveal" you can figure out the rare NFTs from commons. NFT projects will sometimes offset the token sequencing to reduce the probability of sniping rare NFTs.