Same heartbeat for multiple price feeds is vulnerable
The contract applies a single freshness window to several Chainlink price feeds that actually update on different schedules. Because the window must accommodate the slowest feed, data from the faster feed can be accepted long after it has gone stale, or the contract reverts constantly if the window is set tight.
newspacexyz Follow with 0xDemon, 0xgh0st and 20 others
Originally disclosed on Code4rena
Submitted by newspacexyz, also found by 0xDemon, 0xgh0st, 0xVI, boredpukar, dd0x7e8, dimah7, dimulski, honey-k12, hrmneffdii, ironsidesec, itsravin0x, KlosMitSoss, natachi, Olugbenga, oxchsyston, queen, rashmor, slowbugmayor, vesko210, Yaneca_b, ZanyBonzy, and ZeroEx
Finding description and impact
ChainLinkDataConsumer uses the same heartbeat allowedPriceUpdateDelay for multiple feeds when checking if the data feed is fresh. The issue with this is that the USDC/USD oracle has a 24 hour heartbeat, whereas the average has a heartbeat of 1 hour. Since they use the same heartbeat, the heartbeat needs to be slower of the two or else the contract would be nonfunctional most of the time. The issue is that it would allow the consumption of potentially very stale data from the non-USDC feed.
Impact is that either near constant downtime or insufficient staleness checks will happen.
Recommended Mitigation Steps
Use individual heartbeat periods
ref: code423n4 mentioned this on Aug 5, 2023
Using the same heartbeat for all Chainlink feeds will either result in frequent reverts or stale prices: code-423n4/2023-07-tapioca-findings#1505
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a single shared staleness threshold is used for feeds whose documented heartbeats differ, instead of a per-feed threshold.
Impact
The contract either suffers near constant downtime or accepts potentially very stale prices from the faster feed, which could affect anything that relies on those prices.
What the attacker needed
Multiple feeds with different heartbeats
The fix
Each feed should be given its own heartbeat period rather than sharing one value.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A price feed is an outside service that regularly reports the current price of something, and each feed promises to update at least every so often. This contract checks that a price is recent using one fixed time limit for every feed, but the feeds update at different speeds. So the limit has to be loose enough for the slowest feed, which means a price from a faster feed can be quite old and still be accepted.