Reproduced Exploit

Wonderland Prophet: the callback module spends another user's bond

finalizeRequest is onlyOracle and then executes _params.target.call(_params.data). The module is the only address allowed to call Accounting.pay. A request whose callback target is Accounting and whose calldata is pay(victim, attacker, 1000) moves the victim's bond to the attacker when the oracle f…

May 2024•Other•access-control•3 min read

Loss

1000 USDC of the victim's bond transferred to the attacker

Chain

Other

Category

access-control

Date

May 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: 41800-use-of-low-level-calls-can-compromise-access-control-trailof. Standalone Foundry PoC and full write-up: 41800-use-of-low-level-calls-can-compromise-access-control-trailof_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/access-control/missing-auth

Key info#

FieldValue
Loss1000 USDC of the victim's bond transferred to the attacker
Vulnerable contractCallbackModule.finalizeRequest
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateLocal synthetic · 2024-05
Compilersolc 0.8.27, cancun, via IR
Bug classPrivileged module performs a user-chosen low-level call

TL;DR#

finalizeRequest is onlyOracle and then executes _params.target.call(_params.data). The module is the only address allowed to call Accounting.pay. A request whose callback target is Accounting and whose calldata is pay(victim, attacker, 1000) moves the victim's bond to the attacker when the oracle finalizes. A direct pay from the attacker reverts with onlyAllowedModule. A fixed callback that only pings a notifier leaves the bond in place.

The vulnerable code#

SOLIDITY
function finalizeRequest(bytes calldata finalityModuleData) external onlyOracle {
    RequestParameters memory _params = decodeRequestData(finalityModuleData);
    _params.target.call(_params.data); // @> VULN
}
SOLIDITY
function pay(address from, address to, uint256 amount) external {
    require(msg.sender == allowedModule, "onlyAllowedModule");
    bonded[from] -= amount;
    token.transfer(to, amount);
}

Root cause#

The callback target and calldata are chosen by the requester, but the call runs with the module's privilege. onlyAllowedModule checks msg.sender, which is the module, not the user who wrote the calldata.

Preconditions#

  • Accounting records a bond for the victim and holds the tokens (1000 USDC).
  • allowedModule is the callback module.
  • The oracle finalizes a request whose finalityModuleData decodes to that target and calldata. The report's scenario is a protocol that lets the end user set the callback.

Attack walkthrough#

  1. The attacker builds pay(victim, attacker, 1000) and wraps it as (accounting, data).
  2. The oracle calls finalizeRequest. onlyOracle passes.
  3. target.call(data) enters pay. msg.sender is the module, so onlyAllowedModule passes.
  4. The victim's bond goes to 0. The attacker holds 1000 USDC. Accounting's token balance is 0.

Diagrams#

flowchart TD A["User sets callback target to Accounting and data to pay"] --> B["Oracle calls finalizeRequest"] B --> C["Module does target.call of the user calldata"] C --> D["pay sees the module as msg.sender and transfers the bond"] D --> E["Victim bond is 0 and the attacker holds 1000 USDC"]

Impact#

Any user bond the module is allowed to pay can be redirected. This run moves the full 1000 USDC bond. The same authority can reach other onlyAllowedModule functions; the report names dispute-status updates on the oracle as a second sink.

How to reproduce#

BASH
cd 41800-use-of-low-level-calls-can-compromise-access-control-trailof_exp
forge test -vv

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.