Beginner FriendlyFoundryDeFiOracle
100 EXP
View results
Submission Details
Severity: medium
Valid

Manipulating the oracle price makes ThunderLoan vulnerable to flash loan attacks

Summary

Vulnerability Details

The ThunderLoan function "getCalculatedFee" calculates the token value based on the AMM spot price, which is vulnerable to a flash loan attack. When the oracle price is manipulated, calling ThunderLoan's "flashloan" function can result in an exchange rate that is significantly higher than before. As a result, an attacker can redeem tokens to gain more profit.

Impact

Tools Used

Recommendations

Calculating a token's value based solely on the AMM protocol and without any known update method can be risky. To address this issue, consider the following steps:

  1. Calculate the token's price using a reliable source. Implement a TWAP (Time-Weighted Average Price) oracle or utilize a Chainlink oracle for accurate price data.

  2. Calculate the token value based on an anti-flashloan formula. Alpha Finance's formula, as outlined in their blog (https://blog.alphafinance.io/fair-lp-token-pricing), can serve as a valuable reference for ensuring fair LP token pricing.

Updates

Lead Judging Commences

0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

weak oracle

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.