Incorrect `minAnswer` check doesn't protect the protocol from massive price drops
The Chainlink single price oracle validates the returned answer against the aggregator's minAnswer and maxAnswer bounds, but because the aggregator never returns a value outside those bounds, the check can never fire. If an asset's real price collapses below minAnswer, the protocol keeps using the stale floor price and cannot detect the bad data.
Source: https://github.com/sherlock-audit/2025-01-peapods-finance-judging/issues/426
Found by
TessKimy, X77, pkqs90
Summary
Incorrect minAnswer check doesn't protect the protocol from massive price drops
Root Cause
In Chainlink Single Price Oracle, minAnswer and maxAnswer checks are handled incorrectly. Let say Chainlink returns 1e17 minAnswer value for ETH/USD pair. It means aggregator will never return lesser this value. But single price oracle checks it's lower than that value or not.
if (_answer > _max || _answer < _min) {
_isValid = false;
}
In conclusion, this if check will never triggered in time correctly.
Internal Pre-conditions
No need
External Pre-conditions
- Actual price of the assets should be lower than
minAnsweror higher thanmaxAnswer
Attack Path
- I can give an example from LUNA's massive price drop
- LUNA's price drops through zero
- Chainlink won't return lower than
minAnswervalue - Protocol will use wrong price information and it can't even detect it as bad data
Impact
This is low likelihood issue but it's happened before in history ( LUNA ). Users can buy from real price in external pools and they can use it as collateral by pairing it with pTKN and then they can borrow asset using this inflated price.
Mitigation
Decide a reasonable gap for it. Because Chainlink won't update the price of the asset's price is lower than min answer and the last answer doesn't have to be equal to minAnswer value.
minAnswer + gap > returned value
This check is much better than just checking minimum answer
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 oracle compares the returned answer against the aggregator's own minAnswer and maxAnswer, which the aggregator can never violate, instead of comparing against a separately chosen safety gap.
Impact
Users could buy at the real external price and use the inflated oracle price as collateral to borrow more than they should; the report calls this low likelihood but notes it has happened before.
What the attacker needed
Asset price falls below minAnswer; oracle used as collateral pricing
The fix
The check should compare the returned value against minAnswer plus a reasonable gap rather than the raw bound.
How it was found
- LUNA's price drops through zero
- Chainlink won't return lower than `minAnswer` value
- Protocol will use wrong price information and it can't even detect it as bad data
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.
Chainlink price feeds have a built-in floor and ceiling, so they stop reporting once a price falls below the floor. The oracle here tries to reject answers outside those limits, but that situation can never occur, so the safety check does nothing. When a token crashes hard, the protocol still trusts the old floor price and treats it as real.