The RAACNFT::mint
function retrieves prices using RAACHousePrices::tokenToHousePrice
, which only returns the price without a timestamp. This prevents the contract from verifying whether the retrieved price is stale, potentially allowing users to mint NFTs using outdated price data.
The RAACHousePrices
contract provides two functions for retrieving house prices:
tokenToHousePrice(address token) → uint256
Returns the price of the token but does not include the timestamp.
getLatestPrice(address token) → (uint256 price, uint256 timestamp)
Returns both the latest price and the corresponding timestamp, allowing verification of price freshness.
However, RAACNFT::mint
currently uses tokenToHousePrice
instead of getLatestPrice
, meaning it does not check whether the price is stale. If an outdated price remains unchanged in RAACHousePrices
, users could potentially mint NFTs based on an invalid price, leading to economic discrepancies.
the price staleness is possible if the RAACHousePriceOracle::fulfillRequest
function receives an error response, which indicates an issue with the Chainlink function. Since the contract does not properly handle such errors, the outdated price could persist, leading to inaccurate NFT minting prices.
Consider the following scenario:
The price is updated using RAACHousePrices::setHousePrice
.
Due to a delay or malfunction in chainlink function, the price is not updated for an extended period.
A user calls RAACNFT::mint
, which retrieves the price using tokenToHousePrice
.
The minting process succeeds without verifying whether the price is up-to-date.
An attacker could exploit this by minting NFTs at a price that no longer reflects real conditions.
Minting NFTs at Incorrect Prices: Without a timestamp verification, NFTs can be minted based on outdated or manipulated price data.
Potential Economic Loss: If house prices change significantly, users might exploit stale prices to gain unfair advantages.
Manual Review
Modify RAACNFT::mint
to use getLatestPrice
instead of tokenToHousePrice
and introduce a time threshold to verify price freshness before minting.
This ensures that only recent price data is used for minting NFTs, preventing stale price exploits and maintaining economic fairness in the contract.
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.