iktok90-design/ai-smart-contract-auditor/erc1271-contract-signatures

Claude Code and agent skill by iktok90-design/ai-smart-contract-auditor

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Detect ERC-1271 contract-signature bugs — magic-value handling, signature validation edge cases, smart-wallet interactions (Safe, Argent), replay-via-signature-update. Activate on `isValidSignature`, ERC1271 imports, smart-wallet integration, signed orders that may originate from contracts.

Install

npx vskill@latest install iktok90-design/ai-smart-contract-auditor/erc1271-contract-signatures

SKILL.md

ERC-1271 contract signatures detection

Background

ERC-1271 lets contract accounts (smart wallets, multisigs) sign messages. Verification call:

solidity
IERC1271(signer).isValidSignature(hash, sig) returns (bytes4 magicValue);
// magicValue must equal 0x1626ba7e

Without ERC-1271, smart-wallet users can't sign anything (no private key).

When this applies

  • Off-chain order signing (Seaport, Blur, X2Y2)
  • Permit2 with smart-wallet senders
  • EIP-712 verification paths
  • Any ecrecover(...) == signer check that might accept contract signers

Detection patterns

Bypass via ecrecover for smart wallet (HIGH)
solidity
require(ecrecover(hash, v, r, s) == signer, "bad sig");
// ← signer is a smart wallet, ecrecover returns address(0), check fails legitimately

The bug: contract owners can't sign at all. Add an ERC-1271 fallback:

solidity
if (signer.code.length > 0) {
require(IERC1271(signer).isValidSignature(hash, abi.encodePacked(r, s, v)) == 0x1626ba7e);
} else {
require(ecrecover(hash, v, r, s) == signer);
}
Wrong magic value check (HIGH)
solidity
require(IERC1271(signer).isValidSignature(hash, sig) == 0x1626ba7c); // ← typo: should be 0x1626ba7e
Pre-EIP-1271 magic value (HIGH)

Some old impls return 0x20c13b0b (the legacy bytes-based variant). Spec is hash-based 0x1626ba7e. Mixing → reject valid sigs.

Replay via signature-update on smart wallet (HIGH)

A Safe's isValidSignature checks owner approvals. If signature is approved via on-chain approveHash then consumed, can it be re-approved later? Replay risk.

Smart wallet rotation breaks past sigs (LOW-MEDIUM)

If owner rotates, previously-validated signatures may now be valid by different signer logic. Depends on wallet impl.

Returning data length issues (HIGH)

ERC-1271 returns bytes4. Naive callers using staticcall + manual returndata parsing can mis-decode.

Gas griefing in isValidSignature (MEDIUM)

Smart wallet impl can spend unbounded gas in isValidSignature → relayer griefing.

ERC-1271 + Permit2 (HIGH)

Permit2 must handle contract signers. Apps that wrap Permit2 must too.

Severity rubric

PatternSeverity
App rejects smart-wallet users entirely (no 1271 fallback)High (usability — but also gives an exploitable bypass if mixed)
Wrong magic valueHigh
Pre-EIP magic value not handledHigh
Replay via approve-on-chain on SafeHigh
Returning data length not validatedHigh
Unbounded gas in isValidSignatureMedium

Remediation patterns

  • Use OZ SignatureChecker.isValidSignatureNow(signer, hash, sig) — handles both EOA and contract paths cleanly.
  • Validate magicValue == 0x1626ba7e exactly.
  • For Safe integration: use SignMessageLib and pre-approval flow.
  • Bound gas: (bool ok, bytes memory ret) = signer.staticcall{gas: 100_000}(...).

False-positive notes

  • Apps that explicitly don't support contract wallets (e.g. anti-Sybil) may intentionally reject. Confirm intent.

Related

  • [[signature-replay]]
  • [[permit2-patterns]]
  • [[aa-specialist]] (subagent)

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
37
Repository forks
5
7-day trend score
18

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/iktok90-design/ai-smart-contract-auditor/erc1271-contract-signatures/badge)](https://verified-skill.com/skills/iktok90-design/ai-smart-contract-auditor/erc1271-contract-signatures)

Something wrong with this skill or its page? Tell us.