DepositReceipt_Base.sol#L21 : HEARTBEAT_TIME gap is too huge
The smart contract used a fixed 24-hour heartbeat for an oracle, which could allow stale price data to be used. An attacker could potentially front-run transactions to exploit the stale data.
Source: https://github.com/sherlock-audit/2022-11-isomorph-judging/issues/256
Found by
ak1
Summary
HEARTBEAT_TIME = 24 hours could not be safe. The oracle data still be stale one.
Vulnerability Detail
oracle is using the HEARTBEAT_TIME as 24 hours. Since the price of oracle could vary in the time gap of 3 hours, using 24 hours could be still dangerous.
Impact
Stale data used. Front runnable issue.
Code Snippet
Tool used
Manual Review
Recommendation
Use 3 hours as hearbeat.
Discussion
kree-dotcom
3 hours as recommended by the auditor does not seem sufficient. Some Optimism price feeds such as ETH/USD and OP/USD have Heartbeats of 1200s or 20min. Currently we cannot find a method to fetch this via the oracle address and it looks like the Heartbeat sensitivity would have to be set per deployment of the depositReceipt.
kree-dotcom
Fixed, https://github.com/kree-dotcom/Velo-Deposit-Tokens/commit/398f40cce538461396966ac22273f846d56f6f27
HEARTBEAT_TIME is now an immutable var that is set by the deployer for each instance of a depositReceipt.
0x00052
Fixes look good. HEARTBEAT_TIME changed to an immutable
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 contract hardcoded a 24-hour heartbeat for the oracle, which was too long given that prices could change significantly within 3 hours.
Impact
Stale oracle data could be used, and the issue is front-runnable, potentially allowing an attacker to profit from outdated prices.
What the attacker needed
Access to front-run transactions
The fix
The fix made HEARTBEAT_TIME an immutable variable set by the deployer for each instance, allowing a shorter heartbeat per deployment.
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 smart contract relied on price data from an oracle (a service that provides external data) but only checked if the data was updated within 24 hours. If the price changed significantly in a shorter time, the contract would still use old data, which could be exploited by someone who notices and acts quickly.