Reproduced Exploit

Primev: a second registerAndStake overwrites a BLS key and takes the 10 ether bid

_registerAndStake writes blockBuilderBLSKeyToAddress[key] = provider for every 48-byte key. It does not revert when that key is already mapped. The honest provider registers first. The attacker registers the same key. recordL1Block reads the mapping and names the attacker as the winner. openCommitm…

Oct 2024•Ethereum•logic•3 min read

Loss

Honest provider is not paid. Attacker receives the 10 ether bid locked for that BLS key

Chain

Ethereum

Category

logic

Date

Oct 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: 46245-blockbuilderblskeytoaddress-can-be-overwritten-in-providerre. Standalone Foundry PoC and full write-up: 46245-blockbuilderblskeytoaddress-can-be-overwritten-in-providerre_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/missing-check · vuln/logic/state-update

Key info#

FieldValue
LossHonest provider is not paid. Attacker receives the 10 ether bid locked for that BLS key
Vulnerable contractProviderRegistry._registerAndStake
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run() with 0.2 ether
Chain / block / dateEthereum model · block 0 · 2024-10
Compilersolc 0.8.27, cancun, optimizer 200
Bug classMapping write does not reject an occupied BLS key

TL;DR#

_registerAndStake writes blockBuilderBLSKeyToAddress[key] = provider for every 48-byte key. It does not revert when that key is already mapped. The honest provider registers first. The attacker registers the same key. recordL1Block reads the mapping and names the attacker as the winner. openCommitment pays the 10 ether escrow to the attacker. The honest provider's open reverts.

Background#

Cantina's Primev competition, October 2024, reported by amaron. The new blockBuilderBLSKeyToAddress mapping was added so BlockTracker.recordL1Block could resolve a block winner from a BLS key. The write has no occupancy check. The report's first attack path is a second registrant taking the winner slot so the original provider cannot open the commitment.

The vulnerable code#

SOLIDITY
require(key.length == 48, "len");
blockBuilderBLSKeyToAddress[key] = provider; // @> VULN: an existing BLS key is overwritten

The report's fix is to revert when the key is already populated.

DIFF
- blockBuilderBLSKeyToAddress[key] = provider;
+ require(blockBuilderBLSKeyToAddress[key] == address(0), "key taken");
+ blockBuilderBLSKeyToAddress[key] = provider;

Root cause#

Registration is unique per provider address, not per BLS key. Two providers can pass the same 48 bytes. The later write wins, and the oracle trusts the mapping.

Preconditions#

  • An honest provider has staked minStake (0.1 ether) on a 48-byte key.
  • A bid is escrowed against the block that key will win.
  • The attacker can stake another 0.1 ether and register a different address with that key before recordL1Block.

Attack walkthrough#

  1. Honest provider registers the key and stakes 0.1 ether.
  2. Bidder locks 10 ether on block 1.
  3. Attacker calls registerAndStake with the same key.
  4. Oracle records the winner. The mapping returns the attacker.
  5. Honest provider's openCommitment reverts.
  6. Attacker opens the commitment and receives 10 ether.

Diagrams#

flowchart TD A["Honest provider stakes the BLS key"] --> B["Bidder locks 10 ether"] B --> C["VULN: second registerAndStake overwrites the key"] C --> D["recordL1Block names the attacker"] D --> E["Honest openCommitment reverts"] E --> F["10 ether is paid to the attacker"]

Impact#

The honest provider's bid-token balance stays 0. The attacker holds 10 ether. The key now resolves to the attacker, so any later reward or slash aimed at that key hits the wrong account. The report rates this high because the original provider loses the payment and the bidder's escrow goes to someone who did not build the block.

Remediation#

Revert in _registerAndStake when blockBuilderBLSKeyToAddress[key] is already non-zero. The report notes a front-run of the honest registration remains a separate discussion.

How to reproduce#

BASH
cd 46245-blockbuilderblskeytoaddress-can-be-overwritten-in-providerre_exp
forge test -vv

test_overwrite_pays_bid_to_the_second_registrant sends 0.2 ether, asserts the honest open was blocked, the attacker received 10 ether, and winnerOf(1) is the attacker.

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.