Skip to content

Price Oracle Manipulation via Flashloan

Description

The price oracle can be manipulated via a flashloan, allowing an attacker to influence the price calculation. This can be achieved by exploiting the division operation in the price calculation function.

Examples

Insecure Code

solidity
function getPrice() public view returns (uint) { return underlying.div(totalSupply); }

Secure Code

solidity
function getPrice() public view returns (uint) { return movingAveragePrice(); }

Remediation

Implement a secure price oracle mechanism that is resistant to flashloan attacks, such as using a decentralized price feed or a moving average price calculation.

Rule Details

FieldValue
IDCODE-0768
CategoryCrypto
SeverityHIGH
CWECWE-682
ConfidenceLOW
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsprice oracle, flashloan, manipulation
OWASPN/A

References