The getNFTPrice
function in Lending.sol is responsible for fetching the latest price of an NFT from the RAACHousePrices
contract. While the function's NatSpec comment suggests that it checks for stale prices, the actual implementation only verifies whether the price is 0
, without checking how recent the last price update was. This omission can lead to outdated NFT valuations being used, potentially mispricing loans or triggering unnecessary liquidations.
First off, the sponsor contest discord has clarified that RAACHousePrices
is updated via Chainlink Functions, pulling off-chain property valuation data from an audited API into the blockchain through a decentralized oracle network. The onlyOracle
modifier ensures that only Chainlink oracle nodes can update house prices.
This allows external contracts querying the price of the NFT via:
So when the function LendingPool.getNFTPrice()
fetches the price of an NFT along with the timestamp of the last update, it only checks if the price is zero and does not validate whether the price is outdated:
Now, unlike Chainlink Price Feeds that have built-in staleness safeguards with heartbeat updates and deviation thresholds, Chainlink functions is simply a generic off-chain computation service that fetches API data and off-ramps it onto the blockchain. The latter is devoid of the staleness safeguards.
The protocol team confirmed that house prices may only be updated once every several months (1-3 times a year). If the oracle does not update for an extended period, old prices might be used for loan calculations, affecting the security of the lending pool.
Overvaluation Risk: If an NFT’s value drops significantly but the stored price remains high, users may borrow more than they should, leading to under-collateralized loans.
Unfair Liquidations: If an NFT’s price has appreciated, but the system still relies on an outdated price, borrowers might get liquidated at an unfair rate.
Loss of Trust in the Protocol: If users lose assets due to outdated price data, the protocol’s credibility and user trust may decline.
Manual
To mitigate this issue, implement a configurable price staleness check in LendingPool.sol:
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.