Core Contracts

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

Missing oracle staleness check enables use of outdated NFT prices

Summary

The LendingPool's getNFTPrice() function retrieves NFT prices from the oracle without validating the age of the price data. While the function receives a timestamp from the oracle, it does not implement any staleness checks, potentially allowing critically outdated price data to be used for collateral calculations.

Vulnerability Details

The getNFTPrice() function in LendingPool retrieves prices from the oracle but ignores the timestamp:

function getNFTPrice(uint256 tokenId) public view returns (uint256) {
(uint256 price, uint256 lastUpdateTimestamp) = priceOracle.getLatestPrice(tokenId);
if (price == 0) revert InvalidNFTPrice();
return price;
}

The function:

  1. Retrieves both price and lastUpdateTimestamp from the oracle

  2. Validates the price is non-zero

  3. Ignores the lastUpdateTimestamp completely

  4. Returns the price regardless of how old it is

This price data is used in critical collateral calculations, including:

  • Calculating user health factors

  • Determining maximum borrow amounts

  • Making liquidation decisions

Impact

Without staleness checks, the system could use severely outdated price data for critical operations:

  1. In normal market conditions:

    • House prices typically move slowly, mitigating some risk

    • However, even normal market movements could become significant if prices are months or years old

  2. In crisis conditions:

    • Real estate prices can experience rapid declines

    • Using stale prices could prevent timely liquidations

    • System could allow borrowing against inflated historical valuations

  3. In oracle failure scenarios:

    • If the oracle stops updating, the system would continue using the last known price indefinitely

    • No mechanism exists to detect or prevent this condition

The impact is somewhat mitigated by the natural stability of real estate prices compared to more volatile assets, but remains significant given the critical nature of price data in lending operations.

Recommendations

Implement appropriate staleness checks in the getNFTPrice() function:

function getNFTPrice(uint256 tokenId) public view returns (uint256) {
(uint256 price, uint256 lastUpdateTimestamp) = priceOracle.getLatestPrice(tokenId);
if (price == 0) revert InvalidNFTPrice();
+
+ // Revert if price data is too old
+ uint256 maxAge = 30 days; // Adjust based on protocol requirements
+ if (block.timestamp > lastUpdateTimestamp + maxAge) revert StalePrice();
+
return price;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 2 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 2 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.