Bid Beasts

First Flight #49
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Valid

Unrestricted token burning allows destruction of any NFT

Description:

The BidBeasts ERC721 contract contains a critical vulnerability in its burn() function that allows any user to burn (permanently destroy) any existing NFT without authorization checks. The function directly calls the internal _burn() method without verifying that the caller is the token owner or has been approved to manage the token. This occurs because the _burn() function passes address(0) as the authorization parameter to _update(), which bypasses OpenZeppelin's built-in authorization checks.

Attack path:

  1. Attacker identifies any existing NFT token ID in the BidBeasts collection

  2. Attacker calls burn(tokenId) function with the target token ID

  3. The function executes without checking if the attacker owns the token or has approval

  4. The NFT is permanently destroyed, removing it from the owner's balance and clearing its ownership record

  5. The attack can be repeated for any number of tokens, potentially destroying the entire collection

Impact:

Any NFT in the collection can be permanently destroyed by malicious actors

PoC

Place below in BidBeastsMarketPlaceTest.t.soland run forge test --mt test_burnNFT

function test_burnNFT() public {
_mintNFT();
assertEq(nft.ownerOf(TOKEN_ID), SELLER);
address Alice = makeAddr("Alice");
vm.prank(Alice);
nft.burn(TOKEN_ID);
vm.expectRevert();
nft.ownerOf(TOKEN_ID);
}

Recommended Mitigation:

Replace the current burn() function with a properly authorized version that includes ownership or approval checks:

function burn(uint256 _tokenId) public {
require(_isAuthorized(ownerOf(_tokenId), msg.sender, _tokenId),
"ERC721: caller is not token owner or approved");
_burn(_tokenId);
emit BidBeastsBurn(msg.sender, _tokenId);
}
Updates

Lead Judging Commences

cryptoghost Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

BidBeasts ERC721: Anyone Can Burn

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!