agentleFS
mtarcuremtarcure/claude-vibe-squad/.agents/skills/erc1271-revert-data-check/SKILL.md

erc1271-revert-data-check

Skill220 starsChanged 19 days agoMITView on GitHub

Use when a contract validates a smart-contract-wallet signature by low-level-calling isValidSignature and you suspect the revert-data trick — the call's EVM success flag is discarded, so an attacker-deployed verifier that reverts with the 0x1626ba7e magic value in its reason is misread as a valid signature and authorizes a drain.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add a halmos/forge invariant: "no auth path accepts a signature whose verifier call returned success == false."

    line 34
  2. Distinctive:

    Every ERC-1271 / low-level-signer call site is enumerated with its success-flag handling classified.

    line 38

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ERC-1271 Revert-Data Confusion Check

Audit smart-contract-wallet signature validation for the "revert-data trick": a low-level staticcall/call to isValidSignature(hash,sig) whose EVM success flag is ignored, so an attacker-deployed verifier that reverts with the ERC-1271 magic value (0x1626ba7e) in its revert reason is misread as a valid signature — authorizing a drain.

Source: corpus A §I.3 — ChainSecurity / Zodiac Roles Modifier / Gnosis Pay, June 2026 (~$1.5M). Impact class: funds theft / full wallet drain (intrinsic — clears the impact bar). Governing method: a Phase-3a hypothesis lane of systematic-attacking; emits a lead only — it re-enters the Phase 4–8 verification spine (runnable PoC on a mainnet fork, negative control, G1–G4, cross-family repro) before it is ever a finding.

Method

  1. Grep the target for every ERC-1271 consumer: isValidSignature, the 0x1626ba7e magic value, and low-level staticcall/call into a signer address (slither, semgrep custom rule, cast for on-chain bytecode).
  2. For each call site, confirm the code checks the call's success boolean BEFORE decoding returnData. The bug pattern is (, bytes memory ret) = signer.staticcall(...) followed by ret[:4] == MAGIC with the success flag discarded, or an assembly { returndatacopy } that never checks success.
  3. Build the differential PoC in Foundry: deploy a malicious verifier that reverts with abi.encode(0x1626ba7e) (or raw bytes) in its reason; call the target's auth path with it as the declared signer.
  4. forge test on an anvil --fork of the real deployment: assert the drain succeeds against the live contract state, then assert a success-checked reference implementation rejects it (link-level negative control).
  5. Add a halmos/forge invariant: "no auth path accepts a signature whose verifier call returned success == false."

Acceptance

  • Every ERC-1271 / low-level-signer call site is enumerated with its success-flag handling classified.
  • The PoC drains against a real mainnet fork, not a mock, and the negative control (success-checked variant) rejects the same input.
  • Finding names the exact call site, the ignored success flag, and the realized fund impact; it is deduped against prior Zodiac/ERC-1271 disclosures before submission.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.