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

[M] Hardcoded FOUR_DAY_TIMEOUT in LibChainlinkOracle results in incorrect valuations for deltaB and Fertilizer issuance.

Summary

Beanstalk uses the Chainlink oracle to derive the deltaB of wstETH:BEAN well for minting and converts, plus
to also ascertain the amount of Fertilizer issued to a fertilizer buyer.

However, a specific constant within the LibChainlinkOracle library, FOUR_DAY_TIMEOUT (set to 345,600 seconds),
dictates the maximum allowable age for oracle price data before it is considered outdated, which doesn't align with the actual heartbeat of the Chainlink oracle, which is set to 24 hours.

https://data.chain.link/feeds/ethereum/mainnet/steth-eth

Vulnerability Details

The discrepancy between the FOUR_DAY_TIMEOUT and Chainlink's actual update frequency introduces a potential
vulnerability, where price data up to four days old could be used.

We know below that maxTimeout == FOUR_DAY_TIMEOUT(345,600 seconds) and currentTimestamp is the current time.

function checkForInvalidTimestampOrAnswer(
uint256 timestamp,
int256 answer,
uint256 currentTimestamp,
uint256 maxTimeout
) private pure returns (bool) {
// Check for an invalid timeStamp that is 0, or in the future
if (timestamp == 0 || timestamp > currentTimestamp) return true;
// Check if Chainlink's price feed has timed out
if (currentTimestamp.sub(timestamp) > maxTimeout) return true;
// Check for non-positive price
if (answer <= 0) return true;
}

Impact

There will be a significant deviation from the actual frequency of updates from the stETH:ETH Oracle, considering its at around 24 hours per update.

The utilization of outdated price data due to the FOUR_DAY_TIMEOUT can have several adverse effects on
Beanstalk protocol and its users, including inaccurate deltaB`` calculations of the wstETH:BEAN`` well for minting/converts, and incorrect Fertilizer issuance to buyers.

Tools Used

Manual Review

Recommendations

Reduce the FOUR_DAY_TIMEOUT Value. Align the timeout value more closely with the actual update frequency of
Chainlink oracles to ensure that only current and relevant price data is utilized in protocol operations.

Updates

Lead Judging Commences

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

Chainlink timeout

Support

FAQs

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