Because there is no min value in increasePosition()
; many small amounts can be added as stakes which malicious user can use to DOS runLiquidation()
so they can't be liquidated. However this could also be used by a user to grief the protocol as it is not expensive to cary out but will cost a lot of gas to anyone who calls runLiquidation()
In LiquidationPool::increasePosition()
there is no minimum value for the amounts to be added; apart from a zero value check.
```
function increasePosition(uint256 _tstVal, uint256 _eurosVal) external {
=> require(_tstVal > 0 || _eurosVal > 0);
consolidatePendingStakes();
ILiquidationPoolManager(manager).distributeFees();
=> if (_tstVal > 0) IERC20(TST).safeTransferFrom(msg.sender, address(this), _tstVal);
=> if (_eurosVal > 0) IERC20(EUROs).safeTransferFrom(msg.sender, address(this), _eurosVal);
pendingStakes.push(PendingStake(msg.sender, block.timestamp, _tstVal, _eurosVal));
addUniqueHolder(msg.sender);
}
```
This means many many positions can be added for a single wei
which will increase the size of the holders array that needs to be looped through in order to run runLiquidation()
. In this way a user csn avoid being liquidated.
To test, we need to update the code in 2 places:
In hardhat.config.js
update the code to config to increase the timeout:
Add this test to liquidationPoolManager.js
and run:
Malicious actors can add many stakes for 1 wei and brick liquidations in order to grief the protocol or to not be liquidated themselves. The attack would bary in its cost depending on how many existing hodlers there are; ,more holders means lower cost.
Manual Review
Hardhat Testing
Create a higher minimum amount to disincentivize malicious actors:
```diff
function increasePosition(uint256 _tstVal, uint256 _eurosVal) external {
- require(_tstVal > 0 || _eurosVal > 0);
+ require(_tstVal > 100 || _eurosVal > 100);
consolidatePendingStakes();
ILiquidationPoolManager(manager).distributeFees();
if (_tstVal > 0) IERC20(TST).safeTransferFrom(msg.sender, address(this), _tstVal);
if (_eurosVal > 0) IERC20(EUROs).safeTransferFrom(msg.sender, address(this), _eurosVal);
pendingStakes.push(PendingStake(msg.sender, block.timestamp, _tstVal, _eurosVal));
addUniqueHolder(msg.sender);
}
```
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.