First Flight #18: T-Swap

First Flight #18
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Frontrun initial deposit to inflate poolToken price

Summary

Initial deposit can be frontrun by attacker and deposit some amount of weth and low amount of poolToken, this will bring the price of the poolToken too high depending on how much the attacker deposited.

Vulnerability Details

The deposit function does not care if the initial depositor is depositing any amount of poolToken and rewards the depositor with LP tokens that are equal to the weth deposited. The price of tokens depends on the initial deposit percent only.

Impact

Attacker can manipulate the price in the pool and take advantage of the initial price to buy high amount of weth for a low amount of poolToken.

Tools Used

Unit test.

Recommendations

In the initial deposit, check if the deposited amounts are not zero.
Use price oracle to force the initial deposit to match the actual price in other pools.

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Frontrun first deposit to steal all WETH

Support

FAQs

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