The contract includes batch processing functions that iterate over unbounded arrays. If an excessively large array is passed as input, the transaction could run out of gas, causing it to fail. This creates a Denial of Service (DoS) vulnerability, where an attacker or even a legitimate user could unintentionally render certain functions unusable.
batchAddLiquidity(AddLiquidityArgs[] calldata _addLiquidityArgs)
batchRemoveLiquidity(RemoveLiquidityArgs[] calldata _removeLiquidityArgs)
batchRedeemWToken(RedeemWTokenArgs[] calldata _redeemWTokenArgs)
Denial of Service (DoS): Any user calling the function with a large enough array will cause the function to fail. This could make it impossible to batch process liquidity, effectively freezing assets.
Increased Gas Fees: The absence of an upper bound on loop iterations could lead to inefficient gas usage, making transactions unnecessarily expensive.
Chain-Wide Impact: In extreme cases, execution of large arrays could congest the network by consuming an excessive amount of block gas.
Hardhat: For testing and simulating the vulnerability.
Slither: For static analysis to detect unbounded loops.
Solidity Visual Auditor: For manual contract inspection.
The following test simulates calling the batchAddLiquidity function with a large input array to demonstrate the DoS attack via gas exhaustion.
Deploy the contract.
Call batchAddLiquidity with an excessively large array.
Verify that the transaction fails due to gas exhaustion.
failed due to gas exhaustion, proving the vulnerability.
To prevent this issue, implement one or both of the following solutions:
Limit the Batch Size
Introduce a maximum number of items that can be processed in a single batch.
Example:
Implement Partial Execution with State Tracking
Allow users to execute the function in multiple smaller batches and keep track of processed entries.
Example:
This allows processing in chunks rather than all at once.
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.