Open c4-bot-6 opened 2 months ago
MarioPoneder marked the issue as primary issue
MarioPoneder marked the issue as selected for report
MarioPoneder marked the issue as satisfactory
Checking the stale interval or grace period of oracle price, it's maybe better do this as suggested, but it's hard to set or predict the appropriate interval time.
We suggest adjust the severity level to informative.
This finding looks like same with 24 (https://github.com/code-423n4/2024-07-benddao-findings/issues/24).
I like to keep this group of issues separate from the #24 group due to distinct core issues of stale oracle prices itself vs. sequencer down which both should be checked individually.
Historically, findings like this which can have a price impact were awarded with Medium severity on C4.
Lines of code
https://github.com/code-423n4/2024-07-benddao/blob/117ef61967d4b318fc65170061c9577e674fffa1/src/PriceOracle.sol#L124-L125
Vulnerability details
Impact
PriceOracle has invalid checks on price staleness.
Proof of Concept
There are two checks on price staleness in PriceOracle::getAssetPriceFromChainlink. But both checks are invalid. (1)
updatedAt != 0
In chainlink aggregator, the price is updated at a set heartbeat and a threshold of deviation.updatedAt
should be used to check if the answer is within the hearbeat or acceptable time limits. See doc.(2)
answeredInRound >= roundId
answeredInRound
is deprecated and shouldn't be used. see doc.(https://github.com/code-423n4/2024-07-benddao/blob/117ef61967d4b318fc65170061c9577e674fffa1/src/PriceOracle.sol#L124-L125)
Tools Used
Manual
Recommended Mitigation Steps
Consider using asset-specific hearbeat(e.g. ETH/USD has 1 hour hearbeat) and check against (block.timestamp - updatedAt).
Assessed type
Oracle