The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Chainlink's latestRoundData might return stale or incorrect results

Summary

The distributeAssets function in the provided Solidity contract raises concerns regarding the potential usage of stale or outdated price data obtained from Chainlink's latestRoundData. The absence of explicit checks for data freshness could lead to inaccurate asset valuations during fee distribution.

Vulnerability Details

In the distributeAssets function, the code snippet below relies on Chainlink's latestRoundData to fetch asset prices for valuation. However, it lacks checks for stale data, potentially resulting in incorrect asset valuations.

for (uint256 j = 0; j < holders.length; j++) {
Position memory _position = positions[holders[j]];
uint256 _positionStake = stake(_position);
if (_positionStake > 0) {
for (uint256 i = 0; i < _assets.length; i++) {
ILiquidationPoolManager.Asset memory asset = _assets[i];
if (asset.amount > 0) {
(,int256 assetPriceUsd,,,) = Chainlink.AggregatorV3Interface(asset.token.clAddr).latestRoundData();
// Missing stale data check
}
}
}
}
  • The code directly uses the latest data from Chainlink without checking its freshness.

  • Stale data could lead to inaccurate asset valuations and impact the fairness of fee distribution

Impact

The potential impact is the usage of stale prices, leading to inaccurate asset valuations during fee distribution.

Tools Used

Manual

Recommendations

Include a mechanism to check the freshness of the data obtained from Chainlink, taking into consideration the guidelines provided in the Chainlink documentation on historical data. Historical-data

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Chainlink-price

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

Chainlink-price

Support

FAQs

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