hats-finance / SeeR-PM-0x899bc13919880db76edf4ccd72bdfa5dfa666fb7

1 stars 0 forks source link

Possible griefing attack on Router #45

Open hats-bug-reporter[bot] opened 3 hours ago

hats-bug-reporter[bot] commented 3 hours ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0xd0d4dfb88161e11f6a1660b3cd7229fdf721ad2b0d0999e4b915c6490f5c24dd Severity: medium

Description: In the Router contract, the splitPosition and mergePositions functions allow users to specify an amount of tokens to be split or merged. However, the contract does not validate the amount parameter, which means that if an attacker calls these functions with 0 as the amount, it could lead to unintended behavior. Specifically, this could allow the attacker to bypass the expected token transfer and splitting logic, potentially resulting in erroneous state changes or unexpected outcomes in the contract.

Attack Scenario\

In both cases, the lack of validation on the amount parameter allows for potentially malicious behavior without proper safeguards.

The fungible address becomes overwhelmed, processing these trivial deposits, and legitimate users face delays in having their transactions processed Attachments

  1. Proof of Concept (PoC) File

  2. Revised Code File (Optional)\ Set a minimum threshold for deposits to ensure only economically meaningful transactions are processed. To mitigate this vulnerability, the splitPosition and mergePositions functions should include validation to ensure that the amount parameter is greater than zero.

    function splitPosition(IERC20 collateralToken, Market market, uint256 amount) public {
+       require(amount > 0, "Amount must be greater than zero"); // Validation added
        // Existing logic...
    }

    function mergePositions(IERC20 collateralToken, Market market, uint256 amount) public {
+       require(amount > 0, "Amount must be greater than zero"); // Validation added
        // Existing logic...
    }
greenlucid commented 2 hours ago

For this to be a valid vulnerability you have to prove that you can break something through zero amount transactions, the burden of proof is on you