Reproduced Exploit

Balmy: Lido withdrawal hints are searched up to the request count, so the claim reverts

The adapter loads hints with findCheckpointHints(requestsToClaim, 1, requestsToClaim.length + 1). Lido requires the last index to be getLastCheckpointIndex(), and it returns 0 when the request's checkpoint is outside the range. Request 59498 was finalized at checkpoint 555. The queue's last checkpo…

Nov 2024•Ethereum•dos•4 min read

Loss

1 ETH for request 59498 stays in the queue. The claim reverts on hint 0

Chain

Ethereum

Category

dos

Date

Nov 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

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: 46432-the-hint-is-not-fetched-properly-from-lido-withdrawal-queue. Standalone Foundry PoC and full write-up: 46432-the-hint-is-not-fetched-properly-from-lido-withdrawal-queue_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/dos/frozen-funds · vuln/logic/missing-validation

Key info#

FieldValue
Loss1 ETH for request 59498 stays in the queue. The claim reverts on hint 0
Vulnerable contractLidoAdapter.withdraw
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2024-11
Compilersolc 0.8.27, cancun, via IR
Bug classfindCheckpointHints last index is requestsToClaim.length + 1

TL;DR#

The adapter loads hints with findCheckpointHints(requestsToClaim, 1, requestsToClaim.length + 1). Lido requires the last index to be getLastCheckpointIndex(), and it returns 0 when the request's checkpoint is outside the range. Request 59498 was finalized at checkpoint 555. The queue's last checkpoint is 562. One request makes the last index 2, so the hint is 0. claimWithdrawalsTo reverts. The 1 ETH stays in the queue and the user is paid 0. Passing last index 562 returns hint 555 and pays the 1 ETH.

Background#

Cantina, Balmy, November 2024. The blamed line in LidoSTETHDelayedWithdrawalAdapter before pull 113 was:

SOLIDITY
uint256[] memory hints = _queue.findCheckpointHints(requestsToClaim, 1, requestsToClaim.length + 1);

The report's mainnet example is request 59498, hint 555, and getLastCheckpointIndex() 562. Searching only to index 2 returns 0. Searching to 562 returns 555. Searching past 562 reverts. Balmy applied the getLastCheckpointIndex() change in earn-periphery pull 113.

The vulnerable code#

SOLIDITY
uint256[] memory requestsToClaim = pending;
// @> VULN: last index is requestsToClaim.length + 1, not getLastCheckpointIndex()
uint256[] memory hints = queue.findCheckpointHints(requestsToClaim, 1, requestsToClaim.length + 1);
// FIX: queue.findCheckpointHints(requestsToClaim, 1, queue.getLastCheckpointIndex())
queue.claimWithdrawalsTo(requestsToClaim, hints, recipient);

The queue returns hint 555 only when checkpoint 555 is inside [first, last]. claimWithdrawalsTo reverts unless the hint is 555.

Root cause#

The last index is the length of the request array. It is not the checkpoint list's last index. For any real Lido queue the checkpoint index is far above the number of requests in one claim, so the hint is 0 and the claim reverts.

Preconditions#

  • One pending request, id 59498, finalized at checkpoint 555.
  • getLastCheckpointIndex() is 562.
  • The queue holds 1 ETH for that request.
  • Hint 0 is not a valid claim hint.

Attack walkthrough#

  1. The user asks the adapter to withdraw the pending request.
  2. requestsToClaim.length + 1 is 2.
  3. findCheckpointHints accepts the range because 2 is below 562, then returns 0 because 555 is not in [1, 2].
  4. claimWithdrawalsTo reverts with BadHint.
  5. The queue still holds 1 ETH. The user holds 0. The request is unclaimed.
  6. The control calls findCheckpointHints with last index 562, gets hint 555, and the claim pays 1 ETH to the caller. The queue balance is then 0.

Diagrams#

flowchart TD A["Request 59498 is finalized at checkpoint 555"] --> B["Adapter claims one request"] B --> C["VULN last index is length plus 1 which is 2"] C --> D["Search of checkpoints 1 to 2 returns hint 0"] D --> E["claimWithdrawalsTo reverts with BadHint"] E --> F["1 ETH stays in the queue and the user is paid 0"] C --> G["Control last index is getLastCheckpointIndex 562"] G --> H["Hint is 555 and the claim pays 1 ETH"]

Impact#

The user's finalized withdrawal does not pay. The 1 ETH remains in the queue and claimed stays false. Every claim that uses this adapter hits the same short range, which is the report's "all Lido delayed withdrawals revert" case when the checkpoint index is above the request count. The control pays the 1 ETH once the last index is 562.

Remediation#

Pass getLastCheckpointIndex() as the last index, which is the change in Balmy pull 113. Do not use requestsToClaim.length + 1.

How to reproduce#

BASH
cd 46432-the-hint-is-not-fetched-properly-from-lido-withdrawal-queue_exp
forge test -vv

test_exploit_short_hint_range_locks_the_eth asserts the queue still holds 1 ETH and the user holds 0. test_control_last_checkpoint_index_pays_the_eth asserts hint 555 and a 1 ETH payout. Captured output is output.txt.

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.