This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
0xnirlin - Lack of staleness check in the getLatestPrice(address _token) function can lead to triggering depeg even when there is no depeg. #462
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Escalation Resolved
This issue's escalations have been approved/rejected
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
0xnirlin
high
Lack of staleness check in the getLatestPrice(address _token) function can lead to triggering depeg even when there is no depeg.
Summary
In controller
triggerDepeg()
function is dependent on thegetLatestPrice(_token)
function to get the price from chainlink and than check whether de-peg has occured or not. But de-peg can be triggered even when there is no de-peg.Vulnerability Detail
Lets consider a scenario:
triggerDepeg()
can be called successfully as it takes the stale price and reward the beneficiaries causing loss for other user even though asset was pegged back before the epoch time.Concept ilustrated here: https://excalidraw.com/#json=zo0qQtXxpEBbrbU6ZJ70N,qKIIiwWfpJz5X8MphG4BgA
As chainlink round can be updated in few minutes to hour, chances of such scenerio to happen are very high.
Secondly the stale price check like this one is unnecessary for two reason :
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L315
Impact
Loss of funds for the collateral users even though depeg never occured.
Code Snippet
Tool used
Foundry, Manual Review
Recommendation
here.
Duplicate of #70
The text was updated successfully, but these errors were encountered: