As indicated in the Known Issues, there is 'No length check for the number of stakeholders,' but more importantly, anyone could make the holder array excessively long, making liquidation of unhealthy positions impossible.
In the increasePosition()
function, there is no minimum requirement to join the pendingStakes
array and become eligible for fee distribution. After 24 hours, it is possible to become eligible for asset distribution by joining the holders
array, even with a stake of 1 wei in EUROs or TST.
A holder array that is too long would cause the call to the runLiquidation()
function to revert, making liquidation impossible and thereby depriving holders of the distribution of assets, which serves as an incentive for them to liquidate unhealthy positions.
Additionally, unhealthy positions would accumulate since there is no other mechanism to liquidate them.
An attacker could create numerous EAO tokens, send 1 wei of TST to each, and then call increasePosition()
with each EAO to enter the holders array, potentially making it excessively long.
Attacker: Creates EOAs and send 1 wei to each of them.
random EOA: increasePosition()
to enter the holders array.
Set mocha timeout in hardhat.config.js
:
Paste the following test case in liquidationPoolManager.js
inside describe('distributeFees') block:
Manual review
Add a check in increasePosition() function to ensure that the amount is greater than a certain minimum amount. This would make the attack much more costly, even rendering it impossible depending on the defined minimum amount.
Ideally, this check could verify that the amount is greater than or equal to the required minimum if it's the initial opening of a position and not for increasing the size of an existing position.
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.