Usage of deprecated ChainLink API in EIP1271Wallet
The EIP1271Wallet contract uses the deprecated Chainlink latestAnswer API, which returns 0 if no answer is available and may have inconsistent decimals. An attacker could exploit this to cause incorrect pricing, potentially leading to loss of funds.
Submitted by cmichel, also found by 0x1f8b, defsec, leastwood, pauliax, sirhashalot, TomFrenchBlockchain, UncleGrandpa925, and WatchPug
The Chainlink API (latestAnswer) used in the EIP1271Wallet contract is deprecated:
This API is deprecated. Please see API Reference for the latest Price Feed API. Chainlink Docs
This function does not error if no answer has been reached but returns 0. Besides, the latestAnswer is reported with 18 decimals for crypto quotes but 8 decimals for FX quotes (See Chainlink FAQ for more details). A best practice is to get the decimals from the oracles instead of hard-coding them in the contract.
Recommended Mitigation Steps
Use the latestRoundData function to get the price instead. Add checks on the return data with proper revert messages if the price is stale or the round is uncomplete, for example:
(uint80 roundID, int256 price, , uint256 timeStamp, uint80 answeredInRound) = priceOracle.latestRoundData();
require(answeredInRound >= roundID, "...");
require(timeStamp != 0, "...");
Valid finding. I am hesitating whether this should be low or medium but decided to leave it as a medium because the likeliness is low but the impact would be huge, and all the wardens submitted this with a medium severity. Also: “Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.”
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the contract uses the deprecated latestAnswer function without checking for stale or incomplete rounds, and hard-codes decimals.
Impact
The impact could be huge if the price feed returns zero or stale data, but the likelihood is low.
What the attacker needed
None
The fix
The contract should use latestRoundData and add checks for stale or incomplete rounds.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This report is about a smart contract that relies on an old way to get price data from Chainlink, a price oracle. The old method can return zero when no price is available, which could make the contract behave incorrectly and lose money.