Oracle data feed is insufficiently validated.
The smart contract read the oracle's latest answer without checking whether the price was stale or the round complete. An attacker could exploit a stale or incomplete price to cause the contract to return an incorrect value.
Submitted by Jujic, also found by hickuphh3
Price can be stale and can lead to wrong answer return value.
Proof of Concept
Oracle data feed is insufficiently validated. There is no check for stale price and round completeness. Price can be stale and can lead to wrong answer return value.
function _collateralPriceUsd() internal view returns (uint256) {
int256 answer = oracle.latestAnswer();
uint8 decimals = oracle.decimals();
require(answer > 0, "invalid_oracle_answer");
...
FungibleAssetVaultForDAO.sol#L105
Recommended Mitigation Steps
Validate data feed
function _collateralPriceUsd() internal view returns (uint256) {
(uint80 roundID, int256 answer, , uint256 timestamp, uint80 answeredInRound) = oracle.latestRoundData();
require(answer > 0, "invalid_oracle_answer");
require(answeredInRound >= roundID, "ChainLink: Stale price");
require(timestamp > 0, "ChainLink: Round not complete");
...
0xJPEG (JPEG’d) confirmed, but disagreed with High severity and commented:
Can add validation for round not being complete yet and potentially for stale pricing. This should be medium risk, as shown in past contests (1) (2) (3)
spaghettieth (JPEG’d) resolved and commented:
Fixed in jpegd/core#9.
LSDan (judge) decreased severity to Medium and commented:
Agree with sponsor on the medium risk rating. An oracle with a bad value is by definition an external requirement.
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 used the deprecated latestAnswer function without validating the round ID, timestamp, or answeredInRound, so it could accept stale or incomplete price data.
Impact
A stale or incomplete price could cause the contract to return an incorrect value, potentially leading to financial loss, though the sponsor rated this as medium risk because it depends on an external oracle failure.
What the attacker needed
Oracle returns stale or incomplete data
The fix
The contract was fixed by adding checks for round completeness and stale pricing using latestRoundData.
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.
A smart contract uses an oracle to get the price of an asset. The contract did not check if the price was old or if the data round was finished, so it might use a wrong price. This could lead to incorrect calculations in the contract.