Reproduced Exploit
Berachain: the first post-genesis deposit overwrites a genesis validator and locks 1 ETH
Genesis already occupies deposit index 0, but depositCount starts at 0. deposit pulls 1 ETH and enqueue writes the new pubkey at that index. The genesis record is replaced. depositCount advances to 1, which equals genesisCount, so the beacon does not see a new validator. There is no withdraw functi…
Loss
1 ETH locked; genesis index 0 is replaced and no new index is allocated
Chain
Other
Category
logic
Date
Jan 2025
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
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.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 53114-first-deposits-will-be-ignored-and-lost-cantina-none-beracha. Standalone Foundry PoC and full write-up: 53114-first-deposits-will-be-ignored-and-lost-cantina-none-beracha_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/logic/state-update·vuln/dos/frozen-funds
Key info#
| Field | Value |
|---|---|
| Loss | 1 ETH locked; genesis index 0 is replaced and no new index is allocated |
| Vulnerable contract | DepositStore.enqueue |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Local synthetic · 2025-01 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | depositCount starts at 0 while genesis already occupies index 0 |
TL;DR#
Genesis already occupies deposit index 0, but depositCount starts at 0. deposit pulls 1 ETH and enqueue writes the new pubkey at that index. The genesis record is replaced. depositCount advances to 1, which equals genesisCount, so the beacon does not see a new validator. There is no withdraw function.
The vulnerable code#
function enqueue(uint256 index, bytes32 pubkey, uint256 amount) external {
deposits[index] = Deposit(pubkey, amount, true);
}
function deposit(bytes32 pubkey, uint256 amount) external {
ethToken.transferFrom(msg.sender, address(this), amount);
store.enqueue(depositCount, pubkey, amount);
depositCount += 1;
}
Seed depositCount from genesisCount, or reject an index below genesisCount.
Root cause#
The live counter and the genesis map share an index space, and the live counter is not initialized from genesis.
Preconditions#
- Index 0 holds a genesis pubkey and a 32 ETH accounting amount.
genesisCountis 1. depositCountis still 0. The depositor has 1 ETH.
Attack walkthrough#
- The depositor sends 1 ETH and a new pubkey.
- The deposit contract pulls the ETH.
enqueueoverwrites index 0 with the new pubkey.- The stored key is the new key.
depositCountreads back as 1, equal togenesisCount. The 1 ETH is still in the deposit contract.
Diagrams#
Impact#
The first post-genesis deposit replaces a genesis validator and cannot be withdrawn. This run locks 1 ETH.
How to reproduce#
cd 53114-first-deposits-will-be-ignored-and-lost-cantina-none-beracha_exp
forge test -vv
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/53114-first-deposits-will-be-ignored-and-lost-cantina-none-beracha.md
- Cantina report: https://cdn.cantina.xyz/reports/cantina_competition_berachain_january2025.pdf
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 53114-first-deposits-will-be-ignored-and-lost-cantina-none-beracha_exp (evm-hack-registry mirror).
- AuditVault finding: 53114-first-deposits-will-be-ignored-and-lost-cantina-none-beracha.
Alerts & third-party analyses
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.