Skip to content
DoS Audit finding Intermediate

Using the same heartbeat for multiple price feeds, causing DOS

The protocol uses a single 30-minute heartbeat for all Chainlink price feeds across all chains, but different feeds have different heartbeats. On chains where the heartbeat is longer than 30 minutes, the staleness check fails and transactions revert, causing a denial of service.

000000 Follow with 0xAlix2, 0xAristos and 16 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-06-new-scope-judging/issues/9

Found by

000000, 0xAlix2, 0xAristos, 0xDemon, 0xMax1mus, 0xlrivo, A2-security, Bauchibred, EgisSecurity, HackTrace, Honour, Obsidian, aman, emmac002, iamnmt, perseus, sheep, theweb3mechanic, zarkk01

Summary

Chainlink price feeds usually update the price of an asset once it deviates a certain percentage. For example the ETH/USD price feed updates on 0.5% change of price. If there is no change for 1 hour, the price feed updates again - this is called heartbeat: https://data.chain.link/feeds/ethereum/mainnet/eth-usd.

According to the docs, the protocol should be compatible with any EVM-compatible chain. On the other hand, different chains use different heartbeats for the same assets.

Different chains have different heartbeats:

USDT/USD:

BNB/USD:

In PoolGetters::getAssetPrice, the protocol is using the same heartbeat for all assets/chains, which is 30 minutes.

This causes the protocol to regularly revert unexpectedly (DOS).

Root Cause

The same heartbeat is being used for all chains/assets, in PoolGetters::getAssetPrice.

Impact

Either constant downtime leading to transactions reverting or insufficient staleness checks leading to the possibility of the old price.

PoC

  1. User calls withdraw, to withdraw his collateral (in USDT) from a certain pool on Linea
  2. The withdraw function calls other multiple functions leading to GenericLogic::calculateUserAccountData (which gets the price of an asset)
  3. The contract calls the Oracle USDT/USD feed on Linea
  4. At the moment the heartbeat check for every price feed on every chain is set to 30 minutes
  5. The price was not updated for more than 2 hours since the heartbeat for the pair is 24 hours and also not changed 1% in either direction
  6. The transaction reverts causing DoS

Mitigation

Introduce a new parameter that could be passed alongside the oracle which refers to the heartbeat of that oracle, so that updatedAt could be compared with that value.

The original report as published on Sherlock, by 000000. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

The protocol hard-codes a single 30-minute staleness threshold for every Chainlink feed instead of using each feed's actual heartbeat.

Impact

Transactions that depend on asset prices could revert, causing downtime; alternatively, if the check were relaxed, stale prices could be used.

What the attacker needed

Protocol deployed on a chain with a long heartbeat; a price feed whose heartbeat exceeds 30 minutes; a user action that reads the asset price

The fix

The heartbeat should be passed as a per-oracle parameter and compared against the feed's updatedAt value.

How it was found

  1. A user calls withdraw to remove USDT collateral from a pool on Linea.
  2. The withdraw call reaches calculateUserAccountData, which fetches the asset price.
  3. The contract queries the USDT/USD Chainlink feed on Linea.
  4. The feed has not updated for over two hours, which is normal because its heartbeat is 24 hours.
  5. The 30-minute staleness check fails and the transaction reverts.

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 a service that regularly publishes an asset's price. Each feed has a 'heartbeat', the maximum time it can go without an update. The protocol assumed every feed updates at least every 30 minutes, but some feeds update less often, so the protocol wrongly treats fresh prices as stale and blocks transactions.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 000000

View all

32 more disclosed reports, best first.

More from ZeroLend One

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.