You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
sherlock-admin opened this issue
Mar 27, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
After the function latestRoundData is called (ControllerPeggedAssetV2.sol line 300), some checks for staleness are missing:
There is no check for an invalid roundID.
There is also no check for an invalid timestamp (updatedAt). According to the Chainlink docs, it is recommended to:
Your application should track the latestTimestamp variable or use the updatedAt value from the latestRoundData() function to make sure that the latest answer is recent enough for your application to use it. If your application detects that the reported answer is not updated within the heartbeat or within time limits that you determine are acceptable for your application, pause operation or switch to an alternate operation mode while identifying the cause of the delay.
During periods of low volatility, the heartbeat triggers updates to the latest answer. Some heartbeats are configured to last several hours, so your application should check the timestamp and verify that the latest answer is recent enough for your application.
The Y2K protocol is sensitive to the token price to function properly. Therefore it is important to use fresh token prices from the oracle. In the time of volatility, it may happen that the oracle fails to agree on the price, returning stale price information. If the stale price information is used, the protocol can function in unexpected ways.
Chainlink doc suggests comparing the updatedAt return against the current timestamp and check if the difference between them is within an admissible deviation.
require(roundID >0, "Invalid roundID");
require(block.timestamp- updatedAt < SECONDS_PER_HOUR); // Check for freshness of feedrequire(updatedAt !=0, "Incomplete round");
dmitriia
added
Medium
A valid Medium severity issue
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
and removed
Excluded
Excluded by the judge without consulting the protocol or the senior
labels
Apr 10, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
lemonmon
medium
ControllerPeggedAssetV2 token price can be influenced by stale oracle price
Summary
ControllerPeggedAssetV2.getLatestPrice
is missing some checks for stale oracle price.Vulnerability Detail
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L299-L315
After the function
latestRoundData
is called (ControllerPeggedAssetV2.sol line 300), some checks for staleness are missing:There is no check for an invalid roundID.
There is also no check for an invalid timestamp (
updatedAt
). According to the Chainlink docs, it is recommended to:https://docs.chain.link/data-feeds/#check-the-timestamp-of-the-latest-answer
Impact
The Y2K protocol is sensitive to the token price to function properly. Therefore it is important to use fresh token prices from the oracle. In the time of volatility, it may happen that the oracle fails to agree on the price, returning stale price information. If the stale price information is used, the protocol can function in unexpected ways.
Code Snippet
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L299-L315
Tool used
Manual Review
Recommendation
Chainlink doc suggests comparing the updatedAt return against the current timestamp and check if the difference between them is within an admissible deviation.
Duplicate of #70
The text was updated successfully, but these errors were encountered: