Killua
← All parts Bug Hunting Field Guide · Part 7 of 8

Re-callable initializers: taking over a proxy with one call

Killua · 7 min read

An initializer plays the role of a constructor for upgradeable contracts, so it must run exactly once. If it can be called again on live state, an attacker re-runs it to overwrite privileged pointers.

This guide covers what happens when an initializer stays open, and why the damage depends entirely on which storage slot it writes.

Why initializers exist at all

In a normal contract, the constructor runs once at deployment and then disappears. It can never be called again.

Upgradeable contracts (UUPS, transparent proxies, diamonds) lose that guarantee. The logic lives at a different address from the proxy that holds the funds and state, so a constructor can’t write the proxy’s storage. Developers use an ordinary external function instead, usually initialize(), which runs in the proxy’s context through delegatecall.

The catch: an ordinary function doesn’t disappear. It stays callable forever unless something stops it. Forget the one-shot guard, such as OpenZeppelin’s initializer modifier, and anyone can re-run initialization on live, funded state.

If that function writes the slot that decides who owns the protocol, or which address receives delegatecalls, the attacker gets to run their own code inside the vault.

The bug in one sentence

An initializer with no one-shot guard lets an attacker re-run it on a live proxy, overwrite an address that’s later used as a delegatecall target or admin, and run arbitrary code with the vault’s own identity.

A real case: Renegade Darkpool (Arbitrum, May 2026, about $210K)

Renegade’s darkpool ran behind a UUPS proxy holding about $210K across 26 tokens, including USDC, WBTC, WETH, PENDLE and ARB. The proxy delegated to an Arbitrum Stylus implementation, written in Rust and compiled to WASM.

That implementation exposed an initialize entry point with no one-shot guard. The sketch below is reconstructed from the storage operations seen on-chain. It’s not the original source:

// selector 0x92413afe: initialize(...) — no initializer guard
function initialize(address injectedExecutor, address token /*, ... */) external {
    assembly { sstore(0, injectedExecutor) } // overwrites slot 0 on the live proxy
}

// selector 0x803f430a: updateWallet(...) — a normal user entry point
function updateWallet(bytes calldata proof, bytes calldata data) external {
    address executor;
    assembly { executor := sload(0) }             // loads whatever is in slot 0
    (bool ok, ) = executor.delegatecall(data);    // runs that code as the vault
    require(ok, "Execution failed");
}

The attack took two steps:

  1. Call initialize(attackerContract, ...) on the proxy. Nothing stops it, so slot 0 now holds the attacker’s contract.
  2. Call updateWallet(...). It loads slot 0 and delegatecalls it with caller-supplied data. The attacker’s code runs with address(this) equal to the darkpool proxy.

The injected code was a simple loop:

function drainTokens(address recipient, address[] calldata tokens) external {
    for (uint256 i = 0; i < tokens.length; ++i) {
        uint256 bal = IERC20(tokens[i]).balanceOf(address(this)); // the proxy's balance
        if (bal > 0) IERC20(tokens[i]).transfer(recipient, bal);
    }
}

One transaction emptied all 26 tokens.

The lesson about non-Solidity engines: Stylus contracts still have to protect their storage like any EVM contract. A missing check in Rust is an open storage write on the proxy.

Why the slot matters

How bad an open initializer is depends on what it writes:

The attack, step by step

  1. Recon. Inspect the proxy and implementation for an initialize-style function with no guard, no initialized flag and no version counter.
  2. Prepare. Deploy a drain contract to serve as the injected target.
  3. Overwrite. Call initialize on the proxy, writing the drain contract into the executor slot.
  4. Trigger. Call the user entry point that delegatecalls that slot.
  5. Sweep. The drain loop sends every token to the attacker.

Why it worked: four facts

  1. An executable privileged pointer. A slot holds an address the contract later runs in its own context, or hands admin rights to.
  2. An unguarded initializer. Anyone can write that slot.
  3. A public trigger path. A normal entry point reaches the pointer without real authorization. At Renegade, an empty proof was accepted.
  4. Value in the execution frame. The proxy holds pooled assets or approvals, so code running there can move them.

Remove any one and the exploit fails. With an initializer modifier the slot can’t be rewritten. With a plain call instead of delegatecall, foreign code couldn’t touch the proxy’s balances.

How to hunt for it

Lookalikes that are safe, and why

Fixes that work

The same bug in other clothes

Test yourself

  1. initialize() is protected by onlyOwner. Safe? That’s a circular design. Before initialization the owner is usually address(0), so nobody can call it and the contract can’t be set up. If the owner gets set some other way first, you’re relying on that path being safe. Use a one-shot flag, not a role check.
  2. Why should implementation constructors call _disableInitializers()? The implementation has its own storage. If it’s left uninitialized, anyone can initialize it directly and become its owner.
  3. How is this different from part 2 (permissionless executors)? Part 2 runs attacker calldata in the same call, without changing storage. Here the attacker permanently corrupts a stored pointer, then uses a legitimate entry point to fire it.
  4. The open initializer only sets a fee percentage. Severity? No code execution, because no executable pointer is written. But setting fees to 100% can still cause denial of service or economic damage. Medium to High, depending on impact.

Recap