This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
ArmedGoose - Lack of staleness check in oracle consult()
function
#34
Labels
Non-Reward
This issue will not receive a payout
ArmedGoose
medium
Lack of staleness check in oracle
consult()
functionSummary
The function
consult()
ofTWAPOracleDollar3poolFacet.sol
allows for getting a price information. However, the price is directly pulled from storage and there is zero guarantee, that the price meets any staleness criteria - there is also no logic that enables such check. Therefore, arbitrageurs may take advantage from stale price to buy assets at premium, at cost of the protocol, wherever the oracle is used further.Vulnerability Detail
The core of the function,
consult()
in LibTWAPOracle.sol allows for retrieving the asset price in another token from the pool. However, there is no default or even optional staleness check - the price is retrieved from storage as it is. Due to this, it may be stale, but there is no option to verify it, or even check when the price was updated.Impact
Arbitrageurs and users may take advantage from stale price to buy assets at premium, at cost of the protocol, wherever the oracle is used further.
Code Snippet
TWAPOracleDollar3poolFacet.sol::consult()
callsLibTWAPOracle.sol::consult()
:Tool used
Manual Review
Recommendation
It is possible to check
ts.pricesBlockTimestampLast
value and add a condition to this function - if it doesn't meet a staleness threshold, which may be shared with chainlink staleness threshold or held in a separate variable - then force update.The text was updated successfully, but these errors were encountered: