The function KeeperProxy._validatePrice()
(lines 155-180) in contracts/KeeperProxy.sol
fails to check important return values from AggregatorV2V3Interface.latestRoundData()
. Specifically:
updatedAt
is ignored – This means the contract may use stale price data.
answeredInRound
is ignored – This could allow using an incomplete or manipulated price feed.
As a result, the function might execute transactions based on outdated or incorrect price data, leading to financial risks, failed transactions, or oracle manipulation attacks.
Problematic Code in _validatePrice()
The function only checks answer
and startedAt
but completely ignores updatedAt
and answeredInRound
.
There is no validation to ensure the retrieved price data is fresh and comes from a valid round.
If the Chainlink oracle experiences downtime or returns outdated data, stale prices might be used, leading to incorrect price calculations and financial loss.
Use of Stale Prices: The contract may use outdated price data, leading to incorrect trades or liquidations.
Oracle Exploitation Risk: Attackers could manipulate price feeds by using outdated but favorable price data.
Failed Transactions: If the contract executes based on old data, users may experience failed or unfair trades.
Vs code
updatedAt
Before Using Price DataEnsure the price data is recent before proceeding with any operations:
answeredInRound
to Prevent Invalid RoundsEnsure that the returned data is from a valid round:
Fixed _validatePrice()
Function
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.