Malicious users can bloat the storage by creating positions with no liquidity #140
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
insufficient quality report
This report is not of sufficient quality
🤖_34_group
AI based duplicate group recommendation
Lines of code
https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/pool.rs#L75
Vulnerability details
Impact
The current version of the pool contract allows users to create new positions by providing address of the first token, tick lower and tick upper. The problem is that there is no liquidity providing when minting a position for the first time. This basically allows an attacker to create an infinite number of empty positions and bloat the storage by doing that. Over time, this may lead to DoS as iterating over storage can become too costly.
Proof of Concept
The current functionality of
mint_position_B_C5_B086_D()
:https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/lib.rs#L495-502
It calls
create_position()
in the pool contract that just adds new position to the storage:https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/pool.rs#L85
https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/position.rs#L35-39
https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/position.rs#L25-27
Tools Used
Manual review.
Recommended Mitigation Steps
When creating a new position, the user has to add liquidity right away to avoid the situation where storage can be filled with no liquidity positions.
Assessed type
Other
The text was updated successfully, but these errors were encountered: