First take a look at https://github.com/Cyfrin/2024-04-beanstalk-2/blob/27ff8c87c9164c1fbff054be5f22e56f86cdf127/protocol/contracts/libraries/Oracle/LibChainlinkOracle.sol#L165-L177
This function is called in all instances of querying prices from chainlink, whether it being an ETH/USD feed that has a 1 hour heartbeat, or any other price feed that could have as high as a day as their heartbeat.
This function is used to get the WstethEth
price and evidently it calls the LibChainlinkOracle
and passes the argument to the getPrice/getTwap
functions depending on if the lookback is attached or not, case however is that this function hardcodes the maxTimeout
value to a whooping value of 345600
.
Keep in mind that this is not the same with the previously accepted issue where protocol uses a hardcoded 4 hours for the Eth/Usd feed, protocol currently do not fix this and seem to conclude that this is an "accepted fault" this can be seen by navigating to the known accepted risk for protocol as stated during the contest, however this report pertains to a new contract in scope, i.e WstethEth.sol and also the new variable stated in the new LibChainlinkOracle.sol contract
So now back to this instance https://github.com/Cyfrin/2024-04-beanstalk-2/blob/27ff8c87c9164c1fbff054be5f22e56f86cdf127/protocol/contracts/libraries/Oracle/LibWstethEthOracle.sol#L68-L98 in the WstethEth.sol
contract, we can see that protocol uses a hardcoded 345600
for the stale data check, whereas the WstethEth/Usd
feed that's provided by chainlink and going to be used by protocol 0x86392dC19c0b719886221c78AB11eb8Cf5c52812
has a 1 day heartbeat... this setting now allows for heavy stale data usage, putting this in a layman's logic, a price from Thursday evening could be integrated to protocol the next week
on a Monday morning/afternoon.
Protocol would ingest heavily outdated/stale prices, keep in mind that this is even more dangerous compare to the current accepted risk cause here we are talking about having protocol ingest price data that could be > 3.9 days old
Also keep in mind that according to the current state and the docs around the
LibChainlinkOracle
contract this setting can be seen to be the go to for all feeds that have a 1 day heartbeat, this can be seen here https://github.com/Cyfrin/2024-04-beanstalk-2/blob/27ff8c87c9164c1fbff054be5f22e56f86cdf127/protocol/contracts/libraries/Oracle/LibChainlinkOracle.sol#L25-L27
Reconsider the logic of applying value for 345600
seconds as the timeout for Chainlink feeds that have their heartbeat set as 1 day
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.