Core Contracts

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

Using a single `lastUpdateTimestamp` variable for all NFT price updates may lead to LendingPool consuming stale prices

Summary

RaacHousePrices uses same lastUpdateTimestamp variable to store the timestamp of the last price update for all NFTIds.
This may lead to LendingPool consuming stale prices: borrowers may borrow against a stale collateral value or be unfairly liquidated.

Vulnerability Details

The admin can interogate the offchain price of a house NFTId by calling BaseChainlinkFunctionsOracle::sendRequest.
When Chainlink process the request the token price is updated and the timestamp of the last price update is updated in setHousePrice function.

function setHousePrice(
uint256 _tokenId,
uint256 _amount
) external onlyOracle {
tokenToHousePrice[_tokenId] = _amount;
@> lastUpdateTimestamp = block.timestamp;
emit PriceUpdated(_tokenId, _amount);
}

The timestamp of the last price update is not stored per NFTId. The lastUpdateTimestamp can't be used as a price freshness indicator.
Consider the following scenario:

  • the price of nftId 1 is requested and fulfilled. the lastUpdateTimestamp is updated to timestamp1.

  • 1 year passes and the price of nftId2 is requested; lastUpdateTimestamp is set to timestamp2.

  • getLatestPrice(nftId 1) is called and (price NftId1, timestamp2) is returned.

Note: there is another issue reported in a separate submission related to the missing stale price check. This submission describe how the erroneously lastUpdateTimestamp update can lead to considering a stale price to be fresh and valid.

Impact

Borrowers may be liquidated unfairly.
Borrowers may borrow more than the collateral value.

Tools Used

Recommendations

Update the setHousePrice and store the timestamp of last price update for each tokenId, similarly to how prices are stored. getLatestPrice function should then retrive the timestamp for the corresponding tokenId.

Updates

Lead Judging Commences

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

RAACHousePrices uses a single global lastUpdateTimestamp for all NFTs instead of per-token tracking, causing misleading price freshness data

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

RAACHousePrices uses a single global lastUpdateTimestamp for all NFTs instead of per-token tracking, causing misleading price freshness data

Support

FAQs

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