burn function allows any caller to destroy others’ NFTs, causing permanent asset lossLike a typical ERC721 contract, the burn function inside the BidBeasts_NFT_ERC721 contract is intended to allow the owner of an NFT to destroy (burn) their token, effectively removing it from circulation.
However, that's not the case here. The BidBeasts_NFT_ERC721::burn function lacks any access control mechanism, meaning that anyone can call this function to burn any NFT, regardless of ownership. This is a significant security flaw as it allows malicious actors to destroy NFTs they do not own.
Likelihood: High
Any user with knowledge of the contract can call burn for any valid token ID, requiring only a valid transaction.
Impact: High
In a less worse case, the NFT owner will be directly affected as their asset will vanish in the blink of an eye. There's no way to recover it as well.
But what if that NFT was in a mid-auction? Now, it not just affects the owner of the NFT, but also the highest bidder who might have placed a significant bid on it; his bid amount will be stuck in the contract, forever (see PoC).
The following PoCs demonstrate two scenarios: (1) unauthorised burning of an owned NFT, and (2) burning an NFT mid-auction, locking bidder funds.
First, add this test_UnauthorizedBurn in the test file.
Run the above test using the following command:
Now, add the following test_BurnDuringAuction in the test file:
Run the above test using the command:
The output we get from the 2nd test:
There's a need for access control on the burn function. Either include a direct check or add a modifier instead:
In the BidBeasts ERC721 implementation, the burn function is publicly accessible, allowing any external user to burn NFTs they do not own. This exposes all tokens to unauthorized destruction and results in permanent asset loss.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.