The return value success of the get function of the INFTOracle interface is not checked
The NFTPairWithOracle contract calls the INFTOracle.get function but ignores the returned success flag. If the oracle call fails, the contract may use stale price data, potentially leading to asset loss.
Submitted by cccz, also found by Ruhum, catchup, IllIllI, WatchPug, berndartmueller, plotchy, antonttc, hyh, and 0xf15ers
function get(address pair, uint256 tokenId) external returns (bool success, uint256 rate);
The get function of the INFTOracle interface returns two values, but the success value is not checked when used in the NFTPairWithOracle contract. When success is false, NFTOracle may return stale data.
Proof of Concept
Recommended Mitigation Steps
(bool success, uint256 rate) = loanParams.oracle.get(address(this), tokenId);
require(success);
cryptolyndon (AbraNFT) confirmed and commented:
Agreed, and the first report of this issue.
0xean (judge) increased severity to High and commented:
I am upgrading this to High severity.
This is a direct path to assets being lost.
3 — High: Assets can be stolen/lost/compromised directly (or indirectly if there is a valid attack path that does not have hand-wavy hypotheticals).
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
The contract does not check the boolean success value returned by the oracle's get function before using the rate.
Impact
If the oracle call fails, the contract may use stale price data, which could lead to assets being lost or stolen.
What the attacker needed
Oracle call returns success=false
The fix
The contract should check the success flag and revert if it is false, as shown in the recommended mitigation.
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 asks an oracle for a price. The oracle replies with a success flag and a price. The contract forgets to check the success flag, so it might use an old price even when the oracle failed. That could let someone trade at a wrong price and steal funds.