Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Valid

Lack of Stale Price Check in NFT Price Oracle Call

Summary

The getNFTPrice function in the LendingPool contract retrieves the NFT price from the price oracle but fails to verify if the retrieved price data is up-to-date. Without a staleness check on the lastUpdateTimestamp, the contract may utilize outdated price information, leading to inaccurate collateral valuation and potential protocol risks.

Vulnerability Details

Within the getNFTPrice function, the NFT price is obtained as follows:

(uint256 price, uint256 lastUpdateTimestamp) = priceOracle.getLatestPrice(tokenId); //<- FOUND
if (price == 0) revert InvalidNFTPrice();

While the function reverts if the price is zero, it does not validate whether the lastUpdateTimestamp is recent. This lack of a staleness check means that outdated price data could be used in collateral calculations, which may result in incorrect assessments of a user’s collateral value. Even though prices are updated by oracle in RAACHousePrices.sol::setHousePrice, the oracle may be down for uncertain time, during this situation lastUpdateTimestampbecomes the last updated time which may be hours,days,weeks ago.

Impact

Inaccurate Collateral Valuation: Outdated NFT price data can lead to improper collateral evaluations, increasing the risk of wrongful liquidations or enabling over-borrowing.

Market Manipulation Risk: Attackers could exploit stale price data to manipulate collateral valuations, impacting the health factors of users and the overall stability of the protocol.

Tools Used

Manual audit

Recommendations

Implement a Staleness Check: Add logic to verify that the lastUpdateTimestamp is within an acceptable time window before using the price data.

Define a Staleness Threshold: Establish an appropriate threshold (e.g., a few minutes or hours) that determines when the price data should be considered stale.

Secure Fallback: If the price data is determined to be stale, revert the transaction with a specific error message (e.g., PriceDataStale) to prevent further processing.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

LendingPool::getNFTPrice or getPrimeRate doesn't validate timestamp staleness despite claiming to, allowing users to exploit outdated collateral values during price drops

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

LendingPool::getNFTPrice or getPrimeRate doesn't validate timestamp staleness despite claiming to, allowing users to exploit outdated collateral values during price drops

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!