-
Notifications
You must be signed in to change notification settings - Fork 1
ABA - Inadequate price oracle checks #154
Comments
We will consider this, however, given that the controller should be able to read multiple chainlink oracles, one oracle could have a different heartbeat which makes defining a priceUpdateThreshold hard. |
To clarify, this is about price stability in general and cannot be a dup of mere |
Escalate for 10 USDC Sherlock docs clearly states that external oracle manipulations are not considered valid med/high. "External Oracle Price Manipulation: Issues related to price manipulation in an external oracle used by the contracts are not considered valid high/medium." |
You've created a valid escalation for 10 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
I consider this as an important surface for project to think about due to substantial reliance on Oracle feed. But yes, this is about external Oracle manipulation/malfunction, have to agree. |
This issue's escalations have been accepted! Contestants' payouts and scores will be updated according to the changes made on this issue. |
ABA
medium
Inadequate price oracle checks
Summary
Price of premium vault token, when triggering a depeg, is taken via Chainlink's
latestRoundData
function.Not all checks are not on the
latestRoundData
output, thus leaving a possibility for the price to be outdated or have suffered a price manipulation that in turn would go undetected.Concrete the issues are:
latestRoundData
There is not checked if the answer was received from
latestRoundData
was given an accepted time window.Note: This is different from the sequencer's uptime, where there is a check in place.
This missing check consists of saving previously received price and compare it with the new price. If the difference is above a certain threshold then stop the execution.
Vulnerability Detail
For the second issue, see Summary, for the first issue, in
ControllerPeggedAssetV2
the price for premium vault tokens when triggering a depeg is retrieved via thegetLatestPrice
function.https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L273
getLatestPrice
retrieves the Chainlink feed price vialatestRoundData
and does several checks. What it does not check is if the retrieved price is a stale one.https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L299-L318
latestRoundData
's 4th return value isupdatedAt
: Timestamp of when the round was updated.https://docs.chain.link/data-feeds/api-reference/#latestrounddata
This value is not stored or checked for an outdated price.
Another, not so common check relating to time is to see if the round was incomplete, by checking if
updateTime
is 0.Impact
The price impacts where or not a trigger depeg call reaches the strike price or not, this ultimately means the correct execution of the protocol functionality.
Code Snippet
Tool used
Manual Review
Recommendation
For issue 1:
ControllerPeggedAssetV2
contract, also include apriceUpdateThreshold
variable that stores what is the tolerated age (in seconds) of the retrieved price.updatedAt
return data fromlatestRoundData
priceUpdateThreshold
seconds agoFor issue 2:
previousValidPrice
while also providing a deviation threshold for which to accept a new price.Duplicate of #70
The text was updated successfully, but these errors were encountered: