Closed sherlock-admin2 closed 1 year ago
2 comment(s) were left on this issue during the judging contest.
141345 commented:
m
n33k commented:
unhandled stale price returned from latestRoundData()
In the event that the price is stale, we should still use the price as it is he best approximation of what the incentive reward should be. If we instead revert (as per the recommendation) then the entire system will be fully blocked, even disallowing keepers who are willing to take a loss to keep the system running.
0x73696d616f
medium
Missing
updatedAt
and recommended timeout checks inKept.sol
fetched chainlink pricesSummary
PythOracle
incentivizes thekeeper
with an amount pro-rata to the ether price, fetched from a Chainlink oracle. When using chainlink prices, it's important to check that theupdatedAt
return value from thelatestRoundData()
call is different than 0. Additionaly, a timeout should be added after which theupdatedAt
value is no longer valid (not fresh enough).Vulnerability Detail
Here is a great article from 0xmacro explaining in detail these 2 important measures. The
updatedAt
value should be different than 0 and smaller than the current timestamp by only a hardcode timeout.Impact
The
keeper
is incorrectly incentivized and could incur in losses. Would place the system in a DoS state as no one would want to incur losses to update the oracle prices (or losses to the protocol team).Code Snippet
In
Kept.sol
, notice thekeep()
modifier and_etherPrice()
functions. There are no checks in the Chainlink answer (besides it being negative, as it would underflow when converted toUFixed18
).Tool used
Vscode, Hardhat, Manual Review
Recommendation
Add the following checks to
_etherPrice()
: