Description:
There is a potential DoS attack risk in the increasePosition()
function due to the addUniqueHolder()
method iterating over unbounded array lengths of holders
, When a user wants to increase their position.
Impact:
If the holders
array becomes excessively long, leading to an unresponsive state due to an Out of Gas error, users' funds will be permanently locked in the contract. This could mean death for the protocol as new liquidity can't enter the system.
Proof of Concept:
A malicious actor could disrupt the network by creating numerous addresses and spamming the network with transactions. This could result in the holders
array becoming too long to iterate over efficiently. Effectively preventing withdrawals.
Proof of Code:
The provided test suite demonstrates the vulnerability's validity and severity.
Due to the file size required to run this PoC, the suite is hosted on Github.
To run the PoC, clone the repository.
Minor changes, such as modifying function visibility, were made to enable successful test runs.
All changes and additional files made to the original code are documented in the README and the respective files where the changes are made.
Requirements:
Install Foundry.
Clone the project codebase into your local workspace.
Run the following commands to install dependencies:
Run the following command to execute the PoC:
Tools Used:
Manual review
Foundry
Recommended Mitigation Steps:
Consider alternative design structures that are more gas-efficient. For example, explore the use of mappings instead of arrays or incorporate the EnumerableMap library by OpenZeppelin.
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.