Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
wallet-wars-smart-accounts-vs-embedded-wallets
Blog

The Future of Auditing Is Context-Aware: Understanding UserOp Flows

Traditional smart contract auditing is obsolete for ERC-4337. Security now depends on the dynamic, multi-actor flow of a UserOperation. This post deconstructs the new attack surface and outlines the imperative for lifecycle-aware security analysis.

introduction
THE CONTEXT GAP

The Auditing Lie We Tell Ourselves

Static code audits are insufficient for securing user operations that span multiple protocols and chains.

Audits verify code, not behavior. They validate a smart contract's logic in isolation but fail to model the composability risks of a UserOp flow that interacts with Uniswap, Aave, and a cross-chain bridge like Stargate.

The attack surface is the transaction graph. A malicious intent solver can construct a valid UserOp that passes all individual contract checks but exploits the state transitions between them, a scenario a standard audit never simulates.

Evidence: The $200M Nomad bridge hack exploited a state inconsistency between chains, a failure of cross-protocol logic that no single-contract audit could have caught.

thesis-statement
THE PARADIGM SHIFT

Thesis: Security Is a Flow, Not a State

Static audits fail for dynamic intent-based systems; security must be analyzed across the entire user operation lifecycle.

Static audits are obsolete for systems like ERC-4337 Account Abstraction and UniswapX. They verify a contract's state at a single point, but user intents create multi-step, cross-domain flows where vulnerabilities emerge in the handoffs.

Security lives in the flow between signature validation, intent aggregation, and solver execution. A contract is secure, but the path a UserOp takes through Gelato's relayer network or Across's optimistic bridge creates new attack surfaces.

Context-aware tooling is mandatory. Future audits will map permission scopes across Pimlico's bundler and Safe{Wallet} modules, simulating adversarial solvers to find logic gaps that static analysis misses.

Evidence: The UniswapX Dutch auction exploit vector wasn't in a contract; it was in the flow of order fulfillment where a malicious solver could intercept and front-run the intent.

CONTEXT-AWARE AUDITING

The Anatomy of a Compromised UserOp Flow

Comparing the failure modes and detection capabilities for different stages of a malicious ERC-4337 UserOp.

Attack Vector / StageTraditional Static AnalysisContext-Aware SimulationOn-Chain Monitoring (e.g., Alerts, Forta)

Malicious Paymaster Logic

Signature Spoofing (e.g., EIP-1271)

Bundler Front-running

Gas Token Price Manipulation

Simulation State Poisoning

Time to Detection

Pre-deploy only

< 2 seconds

1-12 blocks

False Positive Rate

15%

< 2%

30%

Integration Required

SDK/Code

RPC Endpoint (e.g., Alchemy, Infura)

Node/Subgraph

deep-dive
THE USEROP FLOW

Deconstructing the Context-Aware Audit

Static code analysis fails for account abstraction; the future audit understands the dynamic intent flow.

Traditional audits are obsolete for ERC-4337. They check smart contract code in isolation, but the security of a UserOperation depends on its journey through Bundlers, Paymasters, and Aggregators. A context-aware audit maps the entire execution path.

The vulnerability is in the handoff. A safe EntryPoint and Wallet mean nothing if a malicious Bundler censors transactions or a Paymaster front-runs approvals. Audits must now evaluate the trust assumptions between Pimlico's Bundler and Biconomy's Paymaster network.

Evidence: The ERC-4337 vulnerability discovered by Nethermind, where a Bundler could steal funds by manipulating gas, existed at the protocol interaction layer, not in any single contract. This is the new attack surface.

protocol-spotlight
THE CONTEXT GAP

Who's Building the Audit Stack? (Spoiler: Not Enough)

Static smart contract audits are failing. The future requires understanding dynamic user operation flows across wallets, dApps, and chains.

01

The Problem: Blind Spots in UserOp Execution

Auditors see a contract's code, not the user's journey. A safe function can be weaponized when called via a malicious frontend or nested bundle.\n- ~$1B+ in losses from approval phishing and flow manipulation.\n- 0 visibility into cross-contract, cross-domain intent.

~$1B+
Flow-Based Losses
0 Context
In Static Audits
02

The Solution: Runtime Flow Graphs

Map the actual execution path of a UserOp from signer to settlement. This creates a context-aware audit trail.\n- Tracks cross-contract calls, delegatecalls, and bridge interactions.\n- Flags anomalous patterns like sudden fee spikes or unexpected token approvals.

100%
Path Visibility
~500ms
Anomaly Detection
03

Entity Spotlight: Tenderly

Already building the primitive with simulation and debugging. The next step is automated flow policy enforcement.\n- Simulates full transaction traces before execution.\n- Potential to layer risk scoring on top of live UserOp streams for wallets like Safe.

10M+
Traces Analyzed
Key Primitive
For Flow Audits
04

The Problem: No Standard for Intent Safety

Intents via UniswapX or CowSwap delegate execution complexity. Auditing the solver is not auditing the user's guaranteed outcome.\n- Solver risk becomes user risk.\n- Impossible to verify fulfillment matches signer's expectation without a flow standard.

High
Solver Trust Assumption
0 Standards
For Intent Safety
05

The Solution: Cross-Chain State Proof Integration

Audit stacks must verify claims about remote state. Did the funds actually arrive on the destination chain?\n- Integrates with light clients like Succinct or Herodotus.\n- Closes the loop for bridges like Across and messaging layers like LayerZero.

Trustless
State Verification
Full-Stack
Audit Coverage
06

The Gap: Missing Economic & MEV Context

Even a perfectly secure flow can be economically hostile. The audit stack must model extractable value.\n- Analyzes gas auctions, sandwichability, and PBS dynamics.\n- Quantifies the real cost of a UserOp beyond gas fees.

$200M+
Annual MEV
Critical Blind Spot
In Current Tools
counter-argument
THE CONTEXT GAP

The Lazy Rebuttal: "Just Use Formal Verification"

Formal verification is necessary but insufficient for securing Account Abstraction, as it fails to capture the emergent complexity of cross-protocol UserOp flows.

Formal verification is a component, not a solution. It proves a smart contract's logic matches its specification, but it cannot validate the specification's correctness or the safety of its interactions with external systems like Uniswap or LayerZero.

The attack surface is the flow, not the function. A wallet contract can be formally verified yet still be exploited via a malicious ERC-20 token's approval hook or a manipulated price oracle from Chainlink, risks that exist outside the contract's pure logic.

Static analysis misses runtime composition. Tools like Slither or Certora excel at intra-contract analysis but are blind to the dynamic, cross-protocol intent pathways a UserOp traverses, which is where novel reentrancy and ordering attacks manifest.

Evidence: The ERC-4337 EntryPoint contract is formally verified, yet bundlers must implement complex mempool policies to prevent DoS—a security requirement dictated by system-level interaction, not contract logic.

FREQUENTLY ASKED QUESTIONS

CTO FAQ: Navigating the New Audit Reality

Common questions about context-aware auditing and analyzing UserOp flows in account abstraction (ERC-4337) environments.

A context-aware audit analyzes a smart contract's behavior within its specific transaction flow, not in isolation. Traditional audits check code logic, but context-aware reviews examine how a contract interacts with bundlers, paymasters, and other contracts in an ERC-4337 UserOp. This catches integration risks that static analysis misses.

takeaways
BEYOND THE SINGLE TRANSACTION

TL;DR: The Non-Negotiables for Smart Account Security

Static analysis is dead. Modern smart account threats are in the composition of intents and the flow of UserOperations.

01

The Problem: Blind Signature Verification

ERC-4337 Bundlers execute UserOps without understanding the full intent chain. A harmless swap approval can be front-run by a malicious dApp to drain assets.\n- Vulnerability: Isolated tx checks miss cross-contract dependencies.\n- Attack Vector: Session keys or validateUserOp logic exploited post-verification.

>70%
of DeFi hacks
~0ms
Exploit Window
02

The Solution: Intent-Aware Simulation

Auditors must simulate the full UserOp flow, not just the entry point. This requires tracking state changes across all involved contracts like Uniswap, Aave, and layerZero.\n- Key Benefit: Catches logic errors in batched operations (e.g., swap-then-bridge).\n- Key Benefit: Validates gas sponsorship and fee logic end-to-end.

100%
Path Coverage
10x
Context Depth
03

The Problem: Paymaster Centralization Risk

Paymasters like Biconomy or Stackup abstract gas, but create a single point of censorship and failure. A compromised or malicious paymaster can block, front-run, or tamper with UserOps.\n- Vulnerability: Trusted third party controls transaction lifecycle.\n- Attack Vector: Paymaster rug-pull or regulatory compliance shutdown.

$1B+
TVL at Risk
1
Failure Point
04

The Solution: Decentralized Verifier Networks

Security requires a network of independent verifiers (e.g., a zk-Proof of Solvency model) to validate paymaster behavior and UserOp integrity. Think of it as a decentralized watchtower for 4337.\n- Key Benefit: Eliminates single-entity trust for gas sponsorship.\n- Key Benefit: Enables real-time fraud proof submission to the EntryPoint.

N of M
Trust Model
<2s
Slash Time
05

The Problem: Opaque Aggregator Logic

Intent solvers like UniswapX, CowSwap, and Across use complex, off-chain algorithms. Users delegate routing decisions, creating a black box risk where the optimal route may be manipulated for validator/MEV profit.\n- Vulnerability: No on-chain guarantee of execution quality.\n- Attack Vector: Solver extracts value via sandwich attacks or poor exchange rates.

~30bps
Hidden Slippage
Off-Chain
Logic
06

The Solution: Verifiable Execution Graphs

Auditing must shift to verifying the cryptographic proofs of execution correctness provided by intent solvers. This requires new standards for disclosing routing logic and proving best execution.\n- Key Benefit: On-chain verification of solver performance claims.\n- Key Benefit: Enables enforceable SLAs and automatic slashing for violations.

ZK-Proofs
Verification
100%
Auditability
ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Context-Aware Auditing: The Future of Smart Account Security | ChainScore Blog