# Incorrect `minAnswer` check doesn't protect the protocol from massive price drops

ChainlinkSinglePriceOracle's minAnswer/maxAnswer check is inverted, so a Chainlink price floor (e.g. LUNA crash) is accepted as valid, letting users borrow against inflated collateral.

- Payout: Audit contest
- Severity: medium
- Program: Peapods Finance
- Found by: TessKimy
- Disclosed: 2025-01-08
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-01-peapods-finance-judging/issues/426
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-19
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:oracle-manipulation

**Target:** ChainlinkSinglePriceOracle.sol price validation
**Root cause:** The oracle rejects answers only when `_answer > _max || _answer < _min`, but Chainlink never returns below minAnswer, so the check never fires; the returned floor value is treated as valid.
**Steps:**
1. Read `ChainlinkSinglePriceOracle.sol#L117` validation `if (_answer > _max || _answer < _min) _isValid = false;`
2. Note Chainlink aggregator clamps answers to [minAnswer, maxAnswer], so `_answer < _min` is unreachable
3. When real price crashes below minAnswer, oracle still returns minAnswer and marks it valid
4. Protocol consumes inflated price for collateral valuation
**How found:** Code review of the oracle's min/max validation against Chainlink aggregator semantics: recognizing that the aggregator clamps to minAnswer means the `< _min` branch can never trigger.
**Exploitation:** During a crash like LUNA, attacker buys the asset cheaply on external pools at true price, pairs it with pTKN as collateral valued at the stale minAnswer price, and borrows against the inflated valuation.
**Insight:** When validating Chainlink answers, remember the aggregator clamps to minAnswer/maxAnswer, so a floor/ceiling comparison is dead code; check for a gap above minAnswer instead, since the last answer need not equal minAnswer.

## Proof of concept (copied exactly from the original report)

**Incorrect minAnswer/maxAnswer validity check**

```
if (_answer > _max || _answer < _min) {
            _isValid = false;
        }
```

