The RAACNFT.mint()
function assumes that the house price and the payment token amount are in the same decimal format, which could lead to incorrect payment processing when using tokens with different decimal places (e.g., USDC with 6 decimals vs. price oracle reporting in 18 decimals).
The vulnerability stems from the direct comparison between the oracle-provided house price and the user's token payment amount without accounting for potential decimal differences:
The oracle reports house prices in 18 decimals, but the payment token could be USDC (6 decimals) or another token with different decimal places.
The code directly compares price
and _amount
without any decimal normalization:
The refund calculation is also affected:
For example, if the house price is 100,000 USD (reported as 100_000 * 10^18 by the oracle), and the user pays with USDC (100_000 * 10^6), the transaction would revert due to insufficient funds, even though the correct amount was provided.
Oracle sets house price for tokenId 1 as 100,000 USD (100_000 * 10^18)
Alice attempts to mint tokenId 1 using USDC (6 decimals)
Alice approves and sends 100,000 USDC (100_000 * 10^6)
Transaction reverts with RAACNFT__InsufficientFundsMint()
because 100_000 * 10^6 < 100_000 * 10^18
Users cannot mint NFTs when using tokens with fewer decimals than the oracle's price format
Potential overcharging or undercharging when using tokens with different decimal places
Incorrect refund calculations leading to lost funds
Manual code review
Add a decimal scaling factor in the contract to normalize between oracle prices and token decimals:
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.