An AI agent that holds a wallet key can be talked into an irreversible transfer by a single injected instruction, and on-chain there is no fraud team to call and no chargeback. Agents are now being given wallets to pay for APIs, trade, rebalance treasuries and run on-chain operations, which turns prompt injection and excessive agency from content risks into direct financial loss. This guide covers how to give an agent on-chain authority safely: which key and account models to use, how to scope permissions with session keys and smart account modules, how to enforce limits and simulate transactions at the point of signing, and how to monitor and recover. It is for engineers and security leads building agentic systems that touch crypto assets. General approval and limit design for agents is covered in the AI Agent Action Approvals and Spending Limits Guide; this page covers what changes when the money is on a blockchain.
Key takeaways
- Never give an agent the owner key. The agent should hold a narrowly scoped, expiring credential such as a session key or delegated permission on a smart account, while the owner key stays with humans on hardware or threshold signing.
- Enforce limits on-chain, not in the prompt. SEAL's AI Security framework says controls belong at the point of action, allowing, warning or blocking a tool call or transaction before execution, because monitoring after the fact is too late for irreversible actions.
- Standards exist for scoped permissions. ERC-4337 (Final) gives smart accounts programmable validation, EIP-7702 (Final) lets an EOA set delegated code, and ERC-7715 (Draft) defines a wallet method for granting permissions with allowance and expiry rules.
- Delegation is a sharp tool. EIP-7702's security considerations warn that a poorly implemented delegate contract can allow a malicious actor to take near complete control of the account, so agent delegations must sign over nonce, value, gas, target and calldata.
- Simulate and decode before signing. The agent and its policy layer should check what a transaction will actually do, not what the prompt or a web page says it does, because blind signing defeats every other control.
Why agents with wallets are a different risk
SEAL's AI Security framework describes the core problem: language models follow instructions, instructions and data share the same format, and in Web3 a compromised prompt can initiate token transfers, governance votes or treasury losses that cannot be reversed. OWASP's Top 10 for LLM Applications 2025 names the two risks that combine here: LLM01 Prompt Injection, and LLM06 Excessive Agency, whose root causes OWASP lists as excessive functionality, excessive permissions and excessive autonomy.
| Threat | How it reaches the wallet | Primary control | Reference |
|---|---|---|---|
| Direct or indirect prompt injection | Instructions hidden in a web page, token metadata, a governance proposal or a chat message tell the agent to send funds | Allowlisted recipients and contracts, on-chain limits, human approval above threshold | OWASP LLM01; MITRE ATLAS AML.T0051 LLM Prompt Injection |
| Tool misuse | Agent invokes a transfer or approval tool with attacker-chosen parameters | Typed tools with fixed parameters, policy check before signing | ATLAS AML.T0053 AI Agent Tool Invocation; OWASP LLM06 |
| Malicious approvals | Agent grants an unlimited token allowance or signs a permit to a drainer | Block unlimited approvals; decode typed-data (EIP-712) signatures | See the Crypto Scam and Drainer Guide |
| Memory and context poisoning | Stored notes or retrieved documents altered to change future decisions | Treat memory as untrusted input; re-validate recipients each time | SEAL AI Security; OWASP LLM04 |
| Key theft | Private key in environment variables, logs or the agent's context window | Keys in a signer service, HSM or MPC; agent never sees key material | See the Secrets Management Guide |
| Runaway spend | Loops, gas spikes or repeated small payments | Rate and cumulative limits, gas caps, kill switch | See the Denial-of-Wallet and AI Agent Cost Runaway Guide |
SEAL also cautions that blocklists and simple filtering are easy to bypass, because adversarial prompts can be encoded, disguised with Unicode, translated or introduced gradually across turns. That is why this guide puts the weight on limits that hold regardless of what the model decides, rather than on detecting malicious prompts. Detection still helps, but it is the second line, not the first.
Account and key models for agents
| Model | How it works | Strength | Weakness | Fit |
|---|---|---|---|---|
| Plain EOA key held by the agent | Agent process signs with a raw private key | Simple | Any compromise or injection can spend everything; no on-chain limits | Avoid, except tiny test balances |
| Custodial or managed signer API | Agent calls a signing service with its own credential and server-side policy | Key never in the agent; central policy and audit | Trust in the provider; API credential becomes the key | Teams wanting fast setup with policy |
| MPC or threshold signing | Agent holds one share; a policy co-signer holds another | No single key; co-signer can refuse | Policy logic is off-chain and must be trusted | Institutional and treasury use. See the MPC Wallet and Threshold Signing Security Guide |
| Smart account with session key (ERC-4337) | Owner keeps admin; agent gets a session key validated by account logic with limits and expiry | Limits enforced on-chain; revocable | Module and validation code must be audited | Most agent use cases |
| EOA with EIP-7702 delegation | Owner EOA sets delegated code that enforces agent permissions | Keeps existing address | Delegate bugs can give near total control | Only with audited delegate contracts |
| Multisig with agent as one signer | Agent proposes; humans co-sign above a threshold | Human in the loop for large moves | Slower; humans may rubber-stamp | Treasury and governance actions |
ERC-4337, marked Final, introduces the UserOperation, a pseudo-transaction sent to a separate mempool, bundled by bundlers and executed through a singleton EntryPoint contract after the smart account's own validation logic runs. That validation step is where session key checks, spending limits and allowlists can be enforced on-chain. Modular account standards that structure such plug-ins, ERC-7579 and ERC-6900, are still Draft as of 27 October 2026, so check the version a wallet implements.
Scoping agent permissions
ERC-7715 (Draft, checked 27 October 2026) defines the JSON-RPC method wallet_requestExecutionPermissions, which lets an application ask a wallet to grant permissions to a session account so it can execute transactions on the user's behalf, plus wallet_revokeExecutionPermission to revoke them. Its examples include native-token-allowance and erc20-token-allowance permission types with an expiry rule, and its security considerations say applications should request only the permissions they need with a reasonable expiry, that wallets must enforce permissions correctly, and that wallets must clearly display permissions and warn against dangerous ones. Because it is a Draft, method and type names may change.
- Asset and amount: per-token allowance, per-transaction maximum and cumulative cap per day or session.
- Counterparties: allowlist of recipient addresses and contract addresses; deny by default.
- Functions: allowlist of function selectors per contract (for example, swap on one router only, never
approveto arbitrary spenders). - Time: short expiry, measured in hours or days, and automatic renewal only through a human or policy step.
- Rate: maximum transactions per period and gas price cap.
- Chain: restrict chain IDs so a permission granted for one network cannot be replayed on another.
EIP-7702 (Final) adds a transaction type that sets code for an EOA. Its security considerations list what a delegate contract should require the account's authority to sign over: replay protection such as a nonce, value, gas, and target and calldata, without which a malicious actor may call arbitrary functions in arbitrary contracts. It also warns about front-running initialisation, because code is set without running initcode. Any agent permission system built on 7702 should be audited against those points. See the Smart Contract Audit Readiness and Choosing an Auditor Guide.
Enforcing policy at the point of signing
SEAL's execution-path enforcement page defines the principle: intercept and evaluate the model's intended tool calls immediately before execution and return allow, warn or block. For agents that construct transactions or manage keys it calls this critical to prevent irreversible on-chain actions. A practical signing pipeline has these stages.
- Intent capture: the agent emits a structured intent (asset, amount, recipient, purpose) through a typed tool, never raw calldata from model text.
- Deterministic policy check: a non-LLM policy engine checks the intent against allowlists, limits and time windows.
- Build and decode: the transaction is built by trusted code and decoded back into human-readable effects, including any typed-data (EIP-712, Final) message.
- Simulate: run the transaction against current chain state and compare balance changes and approvals with the intent; block on mismatch.
- Approval: above a threshold, or for a new counterparty, route to a human approver who sees the decoded effects, not the agent's summary.
- Sign and submit: the signer service signs with the scoped key; on-chain account logic enforces limits again.
- Record: log the prompt context reference, intent, policy decision, simulation result and transaction hash.
Two independent layers, the off-chain policy engine and on-chain account validation, mean an injected instruction has to defeat both. The off-chain layer catches intent mismatches; the on-chain layer holds even if the agent host is fully compromised.
Where identity fits
An agent's wallet credential is a non-human identity with direct spending power. Give each agent its own account or session key, never a shared team key, so actions are attributable and revocable individually. Bind the session key's lifetime to the agent's task, store keys in a signer service rather than environment variables, and rotate the credentials the agent uses to reach that service. Owner keys, module installers and upgrade rights are privileged identities and belong with humans under multisig or threshold control. See the Crypto Wallet Security Guide for custody models and the Crypto Exchange Identity and Key Security Guide.
Choosing a design
- Small balances, single developer: a smart account with one session key, a low daily cap and a recipient allowlist; keep the owner key on a hardware wallet.
- Product giving users an agent: request scoped, expiring permissions from the user's wallet (for example via ERC-7715 where supported) instead of custody of user keys, and display exactly what is granted.
- Organisation treasury: agents propose, humans approve through a multisig or MPC co-signer; agents never hold signing authority over treasury balances alone.
- High-frequency trading agent: isolate a dedicated hot account funded with a bounded float, refilled by a human-controlled process, with on-chain per-trade and per-day caps.
Detection, response and recovery
- Monitor on-chain: alert on any transfer to a non-allowlisted address, any approval, any module or delegation change, and cumulative spend nearing caps. See the Blockchain Analytics and On-Chain Monitoring Guide.
- Monitor the agent: log tool calls with the source of the content that triggered them, and alert on policy blocks, which often indicate injection attempts.
- Kill switch: one action revokes the session key or delegation and pauses the agent; test it monthly.
- Revoke approvals: keep a runbook to revoke outstanding token allowances the agent created.
- Incident plan: SEAL notes that even audited protocols need incident plans; include agent wallets in yours.
Metrics: share of agent transactions passing simulation match; policy blocks per 1,000 intents (and how many were injection); median session key lifetime; time to revoke in drills; percentage of agent value held under on-chain limits; number of agents sharing a key (target zero).
How to implement
- Inventory: list every agent that can move value, the account it uses, who holds the owner key and what balance it can reach. Agents with raw keys are the first to fix.
- Move keys out of agents: put signing behind a signer service, MPC co-signer or smart account so the agent process holds no reusable key material.
- Define policy as code: write the allowlists, per-transaction and daily caps, function selectors and chain IDs as version-controlled policy, reviewed like any other code change.
- Testnet first: run the agent on a test network or a mainnet fork with the full pipeline, including red-team prompts that try to redirect funds, and confirm every attempt is blocked by policy or on-chain limits.
- Shadow mode on mainnet: let the agent propose transactions that a human executes, and compare proposals with policy decisions for two to four weeks.
- Limited autonomy: enable autonomous signing for a small funded float and a short session key expiry, then raise limits only on evidence.
- Rollback: the rollback is revocation: revoke the session key or delegation, pause the agent and move remaining float to an owner-controlled account. Rehearse it before go-live.
Framework mapping
| Control | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | AI and Web3 reference |
|---|---|---|---|
| Scoped session keys and allowlists | AC-6 Least Privilege, AC-3 Access Enforcement | PR.AA-05 | OWASP LLM06; ERC-7715 |
| Per-agent identities and key storage | IA-9, SC-12 | PR.AA-01 | ERC-4337 session keys |
| Intent validation and simulation | SI-10 Information Input Validation | PR.PS-06 | OWASP LLM01; ATLAS AML.T0051 |
| Point-of-action enforcement | AC-3 | PR.AA-05 | SEAL Execution-Path Enforcement |
| Logging and monitoring | AU-12, SI-4 | DE.CM-09 | ATLAS AML.T0053 |
| Kill switch and revocation | AC-2(3) Disable Accounts, IR-4 | RS.MA-01 | ERC-7715 revoke method |
Common failure patterns
- Private key in the agent's environment: any code execution or prompt that dumps environment variables exposes the full balance.
- Limits written only in the system prompt: an injected instruction overrides them; limits must live in code and on-chain.
- Trusting the agent's summary at approval time: the human approves what the agent says, not what the transaction does. The Bybit Hack 2025 showed genuine signatures being given to a transaction whose real effect differed from what signers saw.
- Unlimited token approvals: agents approve maximum allowances for convenience, leaving a standing drain path.
- Unaudited delegate or module code: the permission system itself becomes the vulnerability, exactly the EIP-7702 warning.
- Shared keys across agents: no attribution and no way to revoke one agent without stopping all.
Practitioner checklist
- Keep owner and admin keys with humans under hardware, multisig or threshold control.
- Give each agent its own scoped, expiring session key or delegated permission.
- Enforce per-transaction, cumulative, recipient, function and chain limits on-chain.
- Run a deterministic policy check and a simulation before every signature.
- Show human approvers decoded transaction effects, not the agent's description.
- Block unlimited approvals and decode every EIP-712 signature request.
- Keep key material in a signer service; never in prompts, logs or environment variables.
- Audit any account module or 7702 delegate against the EIP-7702 security considerations.
- Monitor on-chain and agent-side events and test the kill switch monthly.
Standards and references
- Ethereum: ERC-4337 Account Abstraction Using Alt Mempool
- Ethereum: EIP-7702 Set Code for EOAs
- Ethereum: ERC-7715 Request Permissions from Wallets
- Ethereum: EIP-712 Typed structured data hashing and signing
- Security Alliance (SEAL): AI Security
- Security Alliance (SEAL): Execution-Path Enforcement
- OWASP: Top 10 for LLM Applications 2025
- MITRE ATLAS: AI Agent Tool Invocation
Related NHI Mgmt Group resources: AI Agent Action Approvals and Spending Limits Guide · Crypto Wallet Security Guide · MPC Wallet and Threshold Signing Security Guide · Crypto Scam and Drainer Guide