The RAACNFT.sol
contract contains a critical reentrancy vulnerability in its mint
function that allows attackers to bypass intended minting limits and exploit the refund mechanism. This is caused from using _safeMint
without proper reentrancy protection, combined with a token refund mechanism that occurs after the mint. This creates a scenario where an attacker can recursively mint multiple NFTs in a single transaction through the onERC721Received callback
, effectively bypassing any rate limiting or supply controls while also manipulating refund amounts.
The vulnerability is particularly severe because:
It breaks the core NFT minting and pricing mechanism
Allows unlimited minting in a single transaction
Manipulates the protocol's token economics through refund exploitation
Creates an imbalance in the lending protocol where these NFTs are used as collateral
The vulnerability exists in the mint
function: https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/tokens/RAACNFT.sol#L32
The attack flow:
Attacker creates a malicious contract implementing onERC721Received
. * Attacker calls mint
with excess amount to trigger refund
During _safeMint
, the onERC721Received
callback is triggered.
Inside callback, attacker recursively calls mint
again
Process repeats until attacker has desired number of NFTs
Proof of code:
Economic Impact:
Unlimited NFT minting in single transaction
Multiple refund claims
Token drain through refund manipulation
Artificial inflation of NFT supply
Protocol Security:
Bypass of minting limits
Circumvention of price controls
Breaking of NFT uniqueness guarantees
Manipulation of lending collateral values
System Integrity:
Broken NFT supply controls
Compromised price oracle relationship
Undermined lending protocol security
Loss of NFT scarcity value
Lending Protocol Risks:
Over-collateralization with exploited NFTs
Artificial inflation of borrowing power
Potential for mass liquidations
System-wide economic imbalance
Implement ReentrancyGuard
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.