The profileToToken
mapping in SoulboundProfileNFT
incorrectly allows users to re-mint a new profile NFT after burning their previous one. This flaw results in users bypassing the soulbound nature of the NFT, allowing them to obtain multiple profiles by burning and re-minting, violating profile uniqueness
The profileToToken
mapping is used to track a user’s NFT token ID.
When a user mints a profile, their profileToToken
is set to their tokenId.
If they burn the profile, their profileToToken
is reset to 0
.
The contract only prevents minting if profileToToken[msg.sender] != 0
.
Since profileToToken[msg.sender] == 0
after burning, the user can mint again, bypassing restrictions.
POC
copy this test and paste in the testSoulboundProfileNFT.t.sol
and run it
The result goes as thus
Ran 1 test for test/testSoulboundProfileNFT.t.sol:SoulboundProfileNFTTest
[FAIL: next call did not revert as expected] test_ProfileToTokenMappingCollision() (gas: 328344)
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 235.36ms (37.45ms CPU time)
Ran 1 test suite in 5.08s (235.36ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests)
Failing tests:````Encountered 1 failing test in test/testSoulboundProfileNFT.t.sol:SoulboundProfileNFTTest````[FAIL: next call did not revert as expected] test_ProfileToTokenMappingCollision() (gas: 328344)
Encountered a total of 1 failing tests, 0 tests succeeded
Meaning:
The test expected the second mintProfile
call to revert, but it succeeded instead.
This confirms that the mapping collision bug exists—the contract allows a user to mint a second profile after burning the first one.
Users can mint multiple profiles instead of being limited to one.
Soulbound NFTs are meant to be non-transferable and one per user. This bug breaks that assumption.
manual review and foundry
The contract needs a hasMintedBefore
mapping to track if a user ever minted before
2.Modify mintProfile
to check this flag
Design choice to update your age, name and photo. Scam is not a valid impact.
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.