In the LiquidationPool::distributionFees function, the process is as follows:
The function utilizes getTstTotal() to determine the total TST in the contract, including the TST in the pendingStakes array.
It adds EUROs proportionally based on the number of TST staked by position and pending stake.
The issue arises when any user can inject a significant amount of TST into the contract before any mint / burn / swap operation of any vault. An attacker can exploit this by frontrunning the mint / burn / swap function of any vault, injecting a substantial stake, and then strategically invoking LiquidationPoolManager::distributeFees to claim the majority of the fees.
This vulnerability leads to a loss of rewards for all other users of the pool.
To address this issue, implement a function that retrieves only TST in the positions array and excludes pending stakes from the fees distribution. The example below adheres to the current implementation logic, but it's advised to create a uint256 variable to track TST in positions and avoid using a for loop on a dynamic array, which could potentially grow and result in a denial-of-service scenario.
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.