LiquidationPoolManager.runLiquidation() can be frontrun such that any distributed fees can be largely siphoned off to the frontrunner. This is because the protocol calculates how much rewards to give to the user based on the amount of TST they added in a pending stack. A frontrunner can add TST in a pending stake before liquidation occurs and receive most of those distribution fees.
When LiquidationPoolManager.runLiquidation() is called, fees are distributed via calling LiquidationPool.distributeFees(). We can see that function below:
Notice that rewards are distributed pro-rata based on how much TST is deposited into a pendingStake. Because of this, a user can call LiquidationPool.increasePosition() and generate their own pendingStake:
This allows them to take a large portion of the fees of a liquidation they are attempting to frontrun. The specific scenario can occur below:
State:
100e18 TST staked
Step 1:
hacker increases position by 900e18 TST creating a pendingStake
Step 2:
Liquidation occurs where 100e18 EUROs are distributed as fees
Step 3:
Liquidation calls LiquidationPool.distributeFees()
distributeFees() leads to hacker receiving 90e18 EUROs since they own 90% of the TST (900e18 / 1000e18).
Distributed fees will be siphoned off to frontrunners who can purchase large amounts of TST and then deposit the TST before a liquidation occurs.
This should be treated as a MEDIUM because the frontrunner must have a substantial amount of TST compared to the total amount of TST staked in the pool and must be ok with holding on to the TST while they wait for their withdrawal request to be accepted.
Manual Review
Consider not distributing fees to pending stakes or only allow distributing fees to pending stakes that weren't created in the past few hours. This will ensure that only existing stakers receive the reward and that no one can game the system.
anyone can frontrun by creating a pendingStake with an exorbiant amount of TST locked in their pendingStake. This will cause them to receive more EUROs than everyone else. Medium bug. Step to attack is increasePosition() and then runLiquidation(). Mediation is to not consider pendingStakes created within time period or not at all as earning reward (they can wait a day).
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.