Reproduced Exploit
Biconomy Nexus: enable-mode signature can be replayed
The enable-mode digest is keccak256(abi.encode(MODULE_ENABLE_MODE_TYPE_HASH, module, keccak256(initData))). It does not include the user operation hash. The owner signs that digest once. After they uninstall the module, a second user operation with a different hash still validates, reinstalls the m…
Loss
1000 USDC pulled from the account after the owner uninstalled the module
Chain
Ethereum
Category
auth
Date
Oct 2024
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: 43810-enable-mode-signature-can-be-replayed-spearbit-none-biconomy. Standalone Foundry PoC and full write-up: 43810-enable-mode-signature-can-be-replayed-spearbit-none-biconomy_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/auth/signature-replay
Key info#
| Field | Value |
|---|---|
| Loss | 1000 USDC pulled from the account after the owner uninstalled the module |
| Vulnerable contract | Account._getEnableModeDataHash |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2024-10 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | Enable-mode digest omits userOpHash |
TL;DR#
The enable-mode digest is keccak256(abi.encode(MODULE_ENABLE_MODE_TYPE_HASH, module, keccak256(initData))). It does not include the user operation hash. The owner signs that digest once. After they uninstall the module, a second user operation with a different hash still validates, reinstalls the module, and the module's onInstall transfers the 1000 USDC that arrived in between.
The vulnerable code#
digest = _hashTypedData(
keccak256(abi.encode(MODULE_ENABLE_MODE_TYPE_HASH, module, keccak256(initData))) // @> VULN: userOpHash is not in the enable-mode digest, so one signature installs the module again
);
The type string is ModuleEnableMode(address module,bytes32 initDataHash), matching the pre-fix Nexus hash. The recommended fix adds userOpHash (and the module type) to the struct, so the entry-point nonce that already binds a user operation also binds the enable-mode signature.
Preconditions#
- The owner has installed a validator that accepts a digest it has signed.
- The signed payload names a module whose
onInstallcallsexecuteand sends the account's tokens to a fixed recipient. - The owner uninstalls that module. Later, 1000 USDC is credited to the account.
- A bundler submits a new user operation that carries the old enable-mode signature and a different userOpHash.
Attack walkthrough#
- The owner signs the digest of the module and the recipient init data. The signature is used once.
- The first enable installs the module. The account is empty, so nothing moves. The owner uninstalls it.
- 1000 USDC is minted to the account.
- The same signature and init data are submitted with a new userOpHash. The digest is unchanged, so the validator still accepts it.
- The module is installed again and
executesends the 1000 USDC to the caller. - The control hashes
userOpHashinto the struct. The second user operation reverts and the 1000 USDC stays on the account.
Diagrams#
Impact#
The account owner removed the module and then received 1000 USDC. The old enable-mode signature installs that module again and the module transfers all 1000 USDC to the caller. The owner did not sign the second user operation.
How to reproduce#
cd 43810-enable-mode-signature-can-be-replayed-spearbit-none-biconomy_exp
forge test -vv
test_exploit_replays_enable_mode_signature asserts the module is reinstalled and the account balance is 0. test_control_user_op_hash_stops_replay asserts the bound digest rejects the second hash and the attacker is paid nothing.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/43810-enable-mode-signature-can-be-replayed-spearbit-none-biconomy.md
- Spearbit report: https://github.com/spearbit/portfolio/blob/master/pdfs/Biconomy-Spearbit-Security-Review-October-2024.pdf
- Pre-fix hash: https://github.com/Cyfrin/2024-07-biconomy/blob/d2adadc0f3105eb789329eb3c958472638692a2d/contracts/base/ModuleManager.sol
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 43810-enable-mode-signature-can-be-replayed-spearbit-none-biconomy_exp (evm-hack-registry mirror).
- AuditVault finding: 43810-enable-mode-signature-can-be-replayed-spearbit-none-biconomy.
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.