Skip to content

Commit 6c1f15e

Browse files
committed
docs: record Trail of Bits PR #60 response and TOB-11 rationale
1 parent c0e193d commit 6c1f15e

2 files changed

Lines changed: 89 additions & 1 deletion

File tree

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Response — Trail of Bits, Kernel v4 PR #60 (Summary Report, 2026-08-28)
2+
3+
Assessed revision: `62db9981ab921129be67637df9a5f3095dda2749`
4+
Response branch: `feat/permission-hook-module-type`
5+
6+
| ID | Finding | Severity | Disposition |
7+
|----|---------|----------|-------------|
8+
| TOB-KERNEL-1 | Raw ERC-1271 validator replay | Medium | **Fixed** — `b8861c6` |
9+
| TOB-KERNEL-2 | Modules active during uninstall callbacks | Medium | **Fixed** — `ded1250`, `dc7a748` |
10+
| TOB-KERNEL-3 | Bundle-level revocation finality | Undetermined | **Acknowledged** |
11+
| TOB-KERNEL-4 | Signed-install front-running | Medium | **Acknowledged** |
12+
| TOB-KERNEL-5 | Raw validation aborts ERC-7739 | Informational | **Fixed (raw path)** — `b8861c6`; residual acknowledged |
13+
| TOB-KERNEL-6 | Replayable mode violates ERC-7562 | Informational | **Acknowledged** |
14+
| TOB-KERNEL-7 | Root permission policy removal | Medium | **Fixed** — `498a61e` |
15+
| TOB-KERNEL-8 | Shared scoped-hook deinitialization | Low | **Acknowledged** |
16+
| TOB-KERNEL-9 | In-flight scoped-hook removal | Medium | **Fixed** — `73e64bb` |
17+
| TOB-KERNEL-10 | Unchecked initData decoding | Medium | **Fixed** — `d92c9a2` |
18+
| TOB-KERNEL-11 | Ignored executor callback failures | Medium | **Acknowledged** (documented in code) |
19+
| TOB-KERNEL-12 | Missing executor installation check | Medium | **Fixed** — `bac0d4b` |
20+
| TOB-KERNEL-13 | Unbound userOpHash in executeUserOp | Low | **Fixed** — `6fabfea` |
21+
22+
Every fix ships with a regression test named for its window (`test/unit/`): `Erc1271AccountBinding`,
23+
`ExecutorRevocation`, `PolicyRootUninstall`, `WrongTypeUninstall`, `SetRootTeardownOrder`,
24+
`HookFrameGuard`, `InstallDataBounds`, `ExecuteUserOpBinding`.
25+
26+
## Fix notes
27+
28+
- **TOB-1** — raw ERC-1271 now resolves only against the fallback signer
29+
(`ModuleManager._erc1271Raw`), whose key *is* the account address. Type-prefixed signatures always
30+
take the nested EIP-712 path; the prefixed-raw convention (`0x00 ‖ sig`) was deliberately dropped
31+
and its test flipped to assert rejection.
32+
- **TOB-2** — `_uninstall` revokes state before the callback; `setRoot(removeCurrent)` teardown is
33+
fully two-phase (all state — hook pointer, policies, signer, installed — cleared before any
34+
`onUninstall` fires). Callback failures never block removal.
35+
- **TOB-7** — `_uninstallPolicy` now enforces `CannotUninstallRoot`, matching validators and
36+
signers. Root policy changes require an explicit root rotation.
37+
- **TOB-9** — a transient `hookFrameDepth` counter brackets every hook-protected frame
38+
(`executeUserOp`, `executeFromExecutor`, fallback); scoped-hook removal reverts with
39+
`ScopedExecutionHookFrameActive` while nonzero.
40+
- **TOB-10** — `installModule`/`uninstallModule` route through `_decodeModuleData`, which requires
41+
both dynamic fields of `InstallModuleDataFormat` to lie entirely within the declared `initData`.
42+
- **TOB-12** — `_uninstallExecutor` requires `installed`; same-class checks added to
43+
`_uninstallValidator` (installed) and `_uninstallSelector` (module must match the selector's
44+
target). New error: `ModuleNotInstalled`.
45+
- **TOB-13** — `executeUserOp` is EntryPoint-only, and `_processUserOp` rejects
46+
`executeUserOp`-wrapping-`executeUserOp` (the delegatecall-nested variant keeps
47+
`msg.sender == ENTRYPOINT`, so the auth change alone would not have closed it).
48+
49+
## Acknowledgment rationale
50+
51+
- **TOB-3 (bundle-level revocation)** — the described bundle attack is strictly dominated by plain
52+
front-running: an attacker who can observe the revocation operation can equally submit their own
53+
transaction with the still-valid authority ahead of it, which no ERC-4337 account can prevent.
54+
Revocation finality is therefore bounded by transaction ordering, not by the bundle mechanics.
55+
The proposed per-`userOpHash` authorization epoch would add a storage write to every operation
56+
without changing that bound. Won't fix.
57+
- **TOB-4 (signed-install front-running)** — the attacker gains no authority: replaying the signed
58+
install through the standalone route installs exactly the modules the owner signed; the impact is
59+
griefing (the victim's pending enable-mode operation fails and the bundle may revert). We accept
60+
this rather than domain-separating the two routes, which would break signature compatibility for
61+
integrators. Wallets can avoid the race by preferring the standalone route or fresh nonce keys.
62+
- **TOB-5 (residual)** — the raw-path abort is fixed (`b8861c6`); what remains is that a validator
63+
that *reverts* instead of returning a failure value inside one nested branch aborts the sibling
64+
branch. Module quality requirement: validators must return `0xffffffff`-style failures rather
65+
than reverting on malformed input, which the module guidelines document.
66+
- **TOB-6 (ERC-7562)** — acknowledged as a deployment constraint, not fixed: replayable-mode
67+
UserOperations call `eip712Domain()` on the EntryPoint during validation and are rejected by
68+
conformant public bundlers. Replayable mode remains supported for self-bundled flows and direct
69+
`handleOps` submission, which is how it is used today. Revisit (precompute the sans-chain-id
70+
domain separator at construction) if public-mempool support becomes a requirement.
71+
- **TOB-8 (shared scoped hooks)** — hooks receive a per-attachment `id` in `preCheck`/`postCheck`
72+
and are expected to key their state by `(account, id)`; a hook written to that contract is
73+
unaffected by an account-wide `onUninstall` for a sibling attachment. We document the reuse
74+
contract instead of adding per-hook attachment refcounting. Note that TOB-9's frame guard already
75+
prevents the in-flight variant of this issue.
76+
- **TOB-11 (executor install ignores onInstall)** — intentional, now documented at the site
77+
(`ExecutorManager._installExecutor`): executors may be 7702-delegated EOAs or non-`IModule`
78+
contracts whose `onInstall` reverts on the unknown selector. (A plain EOA does not need the
79+
exemption — calls to codeless addresses succeed.) The exploitable half of the reported chain is
80+
closed by `ded1250` (revocation is unconditional); the remaining trade-off — reinstalling a
81+
stateful executor whose `onInstall` reverts re-activates its previous state — is accepted and
82+
placed on the installer.

‎src/core/ExecutorManager.sol‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ abstract contract ExecutorManager {
2929
/// @notice Installs an executor module.
3030
function _installExecutor(address _executor, bytes calldata _internalData, bool) internal {
3131
require(_internalData.length == 0, InvalidDataLength());
32-
// Executor installation intentionally does not depend on onInstall success.
32+
// Executor installation intentionally does not depend on onInstall success (acknowledged in
33+
// TOB-KERNEL-11): executors may be 7702-delegated EOAs or contracts that do not implement
34+
// IModule, whose onUninstall/onInstall calls revert on the unknown selector. (A plain EOA is
35+
// NOT the reason — calls to codeless addresses always succeed.) The trade-off: reinstalling
36+
// a STATEFUL executor whose onInstall reverts re-activates its previous state, so installers
37+
// of stateful executors must verify the onInstall effects themselves. Revocation is
38+
// unaffected: uninstall clears `installed` regardless of callback outcome.
3339
_executorConfig(IExecutor(_executor)).installed = true;
3440
}
3541

0 commit comments

Comments
 (0)