The LendingPool contract's reliance on unvalidated external price oracle data creates a critical vulnerability that allows attackers to manipulate asset prices, potentially forcing unauthorized liquidations or enabling excessive borrowing. This vulnerability could result in significant financial losses to the protocol and its users.
The vulnerability exists in the getNFTPrice
function:
This implementation lacks essential security controls, making it vulnerable to price manipulation attacks.
Single Oracle Dependency - Contract relies on a single price oracle without redundancy
No validation mechanisms for price data integrity
Direct use of oracle prices in critical calculations
Lack of Security Controls - No price deviation checks
No historical price validation
No time-weighted average price (TWAP) implementation
The vulnerability enables two primary attack vectors:
Forced Liquidation Attack - Attacker manipulates NFT prices downward
Users are forced into liquidation despite sufficient collateral
Attacker can acquire assets at discounted prices
Excessive Borrowing Attack - Attacker manipulates NFT prices upward
Users can borrow more assets than collateral value
Protocol faces potential insolvency risk
Static Analysis - I do Manual code review of price oracle implementation
Analysis of security patterns and best practices
Review of collateralization and liquidation logic
Dynamic Testing - Hardhat test environment setup
Simulation of price manipulation scenarios
Verification of attack vectors
Here's a Hardhat test demonstrating the vulnerability:
Test Output:
Implement Multiple Oracle Validation
This vulnerability represents a critical risk to the protocol's security and should be addressed immediately, it's one of the top most Defi attack vectors. The proof of concept i write demonstrates how an attacker could manipulate prices to force liquidations, and the mitigation strategies provide a comprehensive solution to prevent such attacks.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.