Reproduced Exploit

Lucidly removeLiquidity never pays a pool whose token count is below 32

removeLiquidity takes uint256[32]. In Solidity that value's .length is the compile-time size, 32. The pool requires amounts.length == numTokens. A pool with 2 tokens can never pass.

Undated•Ethereum•input-validation•2 min read

Loss

200 of LP stays in a 2-token pool. The remove call pays 0

Chain

Ethereum

Category

input-validation

Date

Undated

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack replays in your browser. Step through it by Solidity line or by opcode.

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 36346-h-06-impossible-to-addremove-liquidity-if-numtokens-max-num. Standalone Foundry PoC and full write-up: 36346-h-06-impossible-to-addremove-liquidity-if-numtokens-max-num_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/input-validation/fixed-array-length · vuln/dos/frozen-funds

Key info#

FieldValue
Loss200 of LP stays in a 2-token pool. The remove call pays 0
Vulnerable contractPool.removeLiquidity
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit at 0x15452ec016c4dc8c549e7fe6ff4b26324ea8b7a4
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 1970-01
Compilersolc 0.8.27, cancun, via IR
Bug classamounts is uint256[32], so amounts.length is always 32
flowchart TD A["A 2-token pool holds 200 of liquidity for one LP"] --> B["removeLiquidity is called with a uint256 array of 32"] B --> C["VULN length 32 is not equal to numTokens 2"] C --> D["The call pays 0 and the 200 stays"] B --> E["Control uses a dynamic array of length 2"] E --> F["The LP is paid 200 and the reserves are cleared"]

TL;DR#

removeLiquidity takes uint256[32]. In Solidity that value's .length is the compile-time size, 32. The pool requires amounts.length == numTokens. A pool with 2 tokens can never pass.

The model seeds 200 of LP. The fixed-array call stores a payout of 0. The LP balance and the reserves both stay 200. The same amounts in a uint256[] of length 2 pay the 200 and clear both.

The finding has no month, so the date marker is 1970-01.

The vulnerable code#

SOLIDITY
function removeLiquidity(uint256[MAX_NUM_TOKENS] calldata amounts, address receiver) external returns (uint256 out) {
    uint256 given = amounts.length;
    if (given != numTokens) {
        lastOut = 0; // @> VULN: a uint256[32] always reports length 32, so a 2-token pool never pays
        return 0;
    }
}

The published function reverts on the length check. This model records 0 so the check is in the trace. Either way the LP is unpaid.

Impact#

Liquidity in any pool with fewer than 32 tokens cannot be removed through the quoted function. The 200 seeded here remains on the LP balance and in liquidity.

How to reproduce#

BASH
cd 36346-h-06-impossible-to-addremove-liquidity-if-numtokens-max-num_exp
forge test -vv

test_exploit_fixed_array_pays_nothing asserts the payout is 0 and both balances stay 200. test_control_dynamic_array_pays_200 asserts the dynamic array pays 200.

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.