Severity: High
The contract reads a price from a single oracle source at the exact moment of the transaction. An attacker who can influence the oracle (e.g. via a flash loan) can set an arbitrary price for one block, then exploit the contract at that manipulated price.
- Attacker takes a flash loan to move the oracle price to an extreme value.
- Attacker calls the contract function that reads the oracle price.
- Contract executes at the manipulated price; attacker profits and repays the flash loan.
let price = oracle::get_price(&env); // ❌ single instant read
let value = amount * price;let price = oracle::get_twap(&env, TWAP_WINDOW); // ✅ time-weighted average
let value = amount * price;See the inline secure.rs module inside this crate for the full corrected implementation.