SuperRare Exploit Post-Mortem: How Mutation Testing Could Have Pr
The SuperRare staking contract had inverted access control logic in its updateMerkleRoot function, allowing any address to change the Merkle root. An attacker used this to generate valid proofs and drain 11,907,875 RARE tokens worth $730,000.
The SuperRare NFT platform suffered a $730,000 exploit due to a critical access control vulnerability in its staking contract. The vulnerability was caused by inverted logic in the updateMerkleRoot() function, which allowed any address to modify the Merkle root instead of restricting access to authorized addresses…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The access control check used '!=' instead of '==' and '&&' instead of '||', inverting the intended permission logic.
Impact
The attacker could drain 11,907,875 RARE tokens worth $730,000, and the exploit was actually executed by a front-runner.
What the attacker needed
None
The fix
The function should require that the caller is the owner or an authorized address, using '==' and '||' instead of '!=' and '&&'.
How it was found
- The attacker identified the vulnerability in the permission check.
- The attacker called updateMerkleRoot() with a malicious Merkle root under their control.
- The attacker used the malicious root to generate valid proofs for claiming 11,907,875 RARE tokens.
- The actual exploit was executed by a front-runner who detected the vulnerability one block after the original exploit contract was deployed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A smart contract is a program on a blockchain that can hold and move funds. This one had a check that was supposed to stop strangers from changing a key list, but the check was written backwards, so strangers could change it. The attacker changed the list to include their own address and then claimed a huge number of tokens.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.