Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Invalid

`ChainlinkARBOracle.addTokenMaxDelay` function is missing upper & lower bound checks

Summary

ChainlinkARBOracle.addTokenMaxDelay function is missing upper & lower bound checks

Vulnerability Details

  • ChainlinkARBOracle.addTokenMaxDelay function is used by the contract owner to add a maximum delay for a chainlimk response for a specific token, and this value is used to check if the chainlink token price is frozen before returning the token price:

    function _chainlinkIsFrozen(
    ChainlinkResponse memory response,
    address token
    ) internal view returns (bool) {
    return (block.timestamp - response.timestamp) > maxDelays[token];
    }
  • So if the maxDelays[token] is set to a very low value; this will lead to not returning the price as the above check will alwasy return true indicating that chainlink is frozen.

  • And if this value is set to a very high value; then the _chainlinkIsFrozen will return fals indicating that the chainlink is not frozen if it's frozen and the price it returned is stale

Impact

Since there's no check on the maxDelay value before assigning it; this will result in an incorrect staleness check on the returned answer from the aggregators; which will lead to using invalid/corrupted token price in the protocol.

Proof of Concept

ChainlinkARBOracle.addTokenMaxDelay function

function addTokenMaxDelay(address token, uint256 maxDelay) external onlyOwner {
if (token == address(0)) revert Errors.ZeroAddressNotAllowed();
if (feeds[token] == address(0)) revert Errors.NoTokenPriceFeedAvailable();
if (maxDelay < 0) revert Errors.TokenPriceFeedMaxDelayMustBeGreaterOrEqualToZero();
maxDelays[token] = maxDelay;
}

Tools Used

Manual Review.

Recommendations

Add a lower bound and upper bound check for this value before assigning/updating it.

Updates

Lead Judging Commences

hans Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

INFO: Unnecessary maxDelay/maxDeviation check

Redundant check on maxDelay and/or maxDeviation in ARBOracle

Support

FAQs

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