Account abstraction security

From PlamenTSV/plamen · View interactive version

Account abstraction security is an AI agent skill from the GitHub repository PlamenTSV/plamen. Protocol Type Trigger account_abstraction (detected when ERC-4337 interfaces, EntryPoint, UserOperation, or Paymaster patterns found) - Inject Into Breadth agents, depth-external

How to use this skill

Skill file

Injectable Skill: Account Abstraction Security

Protocol Type Trigger: account_abstraction (detected when ERC-4337 interfaces, EntryPoint, UserOperation, or Paymaster patterns found)

Inject Into: Breadth agents, depth-external

Language: EVM only (other VMs handle account abstraction natively without smart contract validation stacks)

Finding prefix: [AA-N]

Orchestrator Decomposition Guide

When decomposing this skill into depth agent investigation questions, map sections to domains:

When This Skill Activates

Recon detects ERC-4337 patterns: UserOperation, IAccount, IPaymaster, EntryPoint, validateUserOp, validatePaymasterUserOp, postOp, isValidSignature (ERC-1271), or smart account/wallet factory patterns.


1. UserOperation Validation Flow

For each validateUserOp implementation:

1a. Signature Verification

1b. Nonce Management

1c. Return Value Correctness

Tag: [TRACE:validateUserOp → sig_scheme={scheme} → hash_includes_chainId={YES/NO} → nonce_check={method}]


2. Paymaster Validation

For each validatePaymasterUserOp implementation:

2a. Pre-Validation vs Post-Execution

2b. Payment Token Handling

If paymaster accepts ERC-20 for gas payment:

2c. Paymaster Context Integrity

Tag: [TRACE:paymaster_validate → deferred_checks={list} → postOp_can_fail={YES/NO} → payment_collected={guaranteed/conditional}]


3. Signature Validation Modules (ERC-1271)

For each isValidSignature implementation:

3a. Delegation Security

3b. Module Interaction Safety

3c. Session Key Constraints

If session keys or scoped permissions are supported:

Tag: [TRACE:isValidSignature → delegated_to={module} → registry_access={control} → always_valid={YES/NO}]


4. Factory and Initialization

4a. Counterfactual Address Binding

4b. Pre-Deployment Fund Safety

4c. Re-Initialization Protection

Tag: [TRACE:factory_deploy → salt_binds_owner={YES/NO} → pre_deploy_funds={safe/vulnerable}]


Key Questions (must answer all)

  1. Does validateUserOp correctly verify signatures against the operation hash including chain ID?
  2. Can the paymaster be drained by operations that validate but fail to pay in postOp?
  3. Are signature validation modules restricted to a trusted registry with access control?
  4. Is the wallet's CREATE2 address bound to its initialization parameters (owner, config)?
  5. Can session keys or scoped permissions be exceeded through calldata manipulation?

Common False Positives

Step Execution Checklist (MANDATORY)

| Section | Required | Completed? | Notes |

|---------|----------|------------|-------|

| 1. UserOperation Validation | IF validateUserOp present | | Signature, nonce, return value |

| 2. Paymaster Validation | IF paymaster present | | Pre/post validation, payment token |

| 3. Signature Validation Modules | IF ERC-1271 / modules | | Delegation, session keys |

| 4. Factory and Initialization | IF wallet factory present | | Address binding, re-init |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.