agentkit
- Type
- MCP server
- Scanned
- Nov 17, 2026
- Version
- f2f3e8c11a91
- Files read
- 1158
AgentKit is a Coinbase toolkit and project generator that gives AI agents cryptocurrency wallets and tools to trade tokens, pay for online services, post on social media, and run commands on remote servers. The biggest risk is irreversible loss of funds, because the agent can move cryptocurrency without human approval or reliable spending limits if tricked by untrusted text or reached through the starter web app's unprotected local server.
What it can reach
- Secrets
- Reads wallet private keys, Coinbase and Privy credentials, SSH keys and passwords, and third-party API keys (including OpenAI, AWS, Twitter/X, and DeFi services) from environment variables and local files.
- Network
- Connects to EVM and Solana blockchains, Coinbase APIs and analytics, DeFi, NFT, cloud GPU, and social media services, paid HTTP endpoints, and remote SSH/SFTP servers, and opens a local web server on port 3000 in the starter web app.
- Files
- Creates starter project folders, reads and saves local wallet files, reads SSH keys and modifies local files through SSH host settings, saves AI-generated media to a local ./tmp folder, and uploads or downloads local files via SFTP and Twitter/X.
- Shell commands
- Runs local package manager commands during project setup and code generation, and executes shell commands on remote servers when the optional SSH tool is enabled.
- Other
- Controls crypto wallets to sign and broadcast real blockchain transactions (including token transfers, swaps, unlimited token approvals, lending, and USDC payments), publishes posts on Twitter/X and Farcaster, and rents or stops cloud GPU servers.
Findings
-
HighScaffolded Next.js /api/agent endpoint has no authentication or Origin check
typescript/create-onchain-agent/templates/next/app/api/agent/framework/langchain/route.ts:26
The Next.js project created by npm create onchain-agent@latest (both LangChain and Vercel AI SDK variants) exposes POST /api/agent with no password, session check, Origin check, or Content-Type check, while Next.js listens on 0.0.0.0:3000 by default and shares one global conversation history across all callers. Because req.json() parses JSON bodies even when sent with Content-Type: text/plain, any malicious website the user visits in their browser (via a no-preflight cross-origin POST to http://localhost:3000/api/agent) or anyone on the same local network can send prompts instructing the agent to transfer funds out of its wallet.
Fix: Bind the development server to 127.0.0.1, require authentication on /api/agent, verify the Origin header and strict application/json Content-Type to block cross-site requests, and isolate conversation state per authenticated session.
-
MediumSSH ssh_add_host_key action allows writing arbitrary lines to any local file
python/coinbase-agentkit/coinbase_agentkit/action_providers/ssh/ssh_action_provider.py:541
When the optional SSH action provider is enabled, the ssh_add_host_key tool accepts an unrestricted known_hosts_file path and writes host, key_type, and key into that file without checking for newlines, spaces, or valid SSH key syntax. Unlike SFTP download, this requires no active SSH server or network connection: if an agent is tricked via prompt injection, an attacker can append an SSH public key to ~/.ssh/authorized_keys or shell commands to ~/.bashrc to gain code execution on the user's computer.
Fix: Remove or lock known_hosts_file to ~/.ssh/known_hosts, reject any whitespace or control characters in host and key_type, and validate key by decoding and parsing it with Paramiko before writing.
-
Mediumx402 payment limits and USDC-only checks are not enforced during payment signing
typescript/agentkit/src/action-providers/x402/x402ActionProvider.ts:864
Both the TypeScript and Python x402 providers claim to restrict payments to USDC and cap each request at maxPaymentUsdc (default 1.0 USDC). However, retryWithX402 only checks the selectedPaymentOption object supplied by the AI model and never passes that cap or asset filter to x402Client (and makeHttpRequestWithX402 skips the cap check entirely). When fetchWithPayment (or x402_requests in Python) re-sends the HTTP request, a malicious or compromised 402 server can return a much higher price than the one shown during the initial probe, and the client will automatically sign and authorize the larger payment from the wallet.
Fix: Enforce maxPaymentUsdc, USDC asset address verification, and exact match against the user-approved selectedPaymentOption inside an x402Client payment policy/hook before any payment payload is signed, in both retryWithX402 and makeHttpRequestWithX402 (TypeScript and Python).
-
Mediumx402 registered service allowlist can be bypassed via prefix matching
typescript/agentkit/src/action-providers/x402/utils.ts:635
In both TypeScript (x402/utils.ts) and Python (x402/utils.py), isServiceRegistered checks whether the target URL string starts with any entry in registeredServices. When an origin like https://api.example.com is registered (as shown in the README), any attacker domain starting with the same text—such as https://api.example.com.attacker.com or https://api.example.com@attacker.com—passes the check, and path-prefixed entries can be bypassed with /../ segments or HTTP 3xx redirects. A prompt-injected agent can use this to reach arbitrary external or internal URLs and send x402 payments to unapproved servers.
Fix: Parse both the target URL and registered service URL with URL/urlparse, reject userinfo credentials, require exact scheme, hostname, and port equality, verify normalized path boundaries, and disable automatic HTTP redirects or re-validate redirect targets.
-
MediumNillion provider fetches node URLs and JWT audiences from a .replit.app subdomain
python/coinbase-agentkit/coinbase_agentkit/action_providers/nillion/nillion_action_provider.py:47
On initialization, NillionActionProvider fetches its SecretVault node URLs and DIDs from a hardcoded Replit user-deployment domain (https://secret-vault-registration.replit.app/api/config), then signs ES256K Bearer JWTs with NILLION_SECRET_KEY for those DIDs and sends those tokens and secret data to the returned URLs. Because .replit.app subdomains belong to individual Replit accounts and can be re-registered by anyone if deleted or expired, a takeover or compromise of that host would expose signed organization tokens and uploaded confidential records.
Fix: Replace the hardcoded .replit.app endpoint with an official Coinbase or Nillion domain (or require explicit node configuration from the user) and validate returned node URLs and DIDs against an expected allowlist.
-
LowServer-side request forgery and response upload in Flaunch token image fetcher
typescript/agentkit/src/action-providers/flaunch/metadata_utils.ts:152
When launching a token via FlaunchActionProvider, convertImageUrlToBase64 fetches any http:// or https:// URL supplied in the image parameter directly from the host machine without blocking localhost, private network IPs, or cloud metadata addresses (such as http://169.254.169.254/). Even if the response is not an image, it defaults the MIME type to image/jpeg, base64-encodes the raw response body, and sends it to Flaunch's third-party IPFS upload API.
Fix: Require https:// URLs, resolve and block loopback, link-local, and private IP ranges (including on redirects), and reject responses whose Content-Type and magic bytes are not valid image formats.
-
LowGraphQL query injection in SushiDataActionProvider.findToken
typescript/agentkit/src/action-providers/sushi/sushiDataActionProvider.ts:59
In findToken, args.search is interpolated directly into a raw GraphQL query string inside a raw JSON body without escaping quotes or backslashes, and the returned token name and symbol are included in tool output without sanitizeOnchainMetadata. Crafted search strings can alter the GraphQL query structure, and malicious token metadata can inject control or bidirectional-override characters into agent context.
Fix: Use parameterized GraphQL variables serialized with JSON.stringify({ query, variables: { chainId, search: args.search } }), and pass token.name and token.symbol through sanitizeOnchainMetadata.
-
LowUnsanitized onchain token names in Python CDP swap utilities
python/coinbase-agentkit/coinbase_agentkit/action_providers/cdp/swap_utils.py:59
While AgentKit added sanitize_onchain_metadata to ERC-20, Aave, Compound, and TypeScript CDP swap utilities to strip hidden Unicode control/bidirectional characters and cap length at 50 characters, Python's cdp/swap_utils.py (and TypeScript's TrueMarkets provider) still returns raw contract strings directly to the agent, leaving a path for indirect prompt injection via attacker-deployed contracts.
Fix: Pass from_token_name and to_token_name through sanitize_onchain_metadata in python/coinbase-agentkit/coinbase_agentkit/action_providers/cdp/swap_utils.py (and apply sanitizeOnchainMetadata to TrueMarkets contract strings).
-
LowScaffolded templates save generated wallet private keys without restrictive file permissions
In both TypeScript and Python create-onchain-agent templates for local keypairs (Viem, EthAccount, SolanaKeypair) and Privy authorization keys, generated secrets are written in plaintext JSON to wallet_data*.txt using default file permissions (typically 0644, readable by any local user on the machine) instead of owner-only 0600.
Fix: Write wallet persistence files with mode 0o600 (e.g., fs.writeFileSync(WALLET_DATA_FILE, data, { mode: 0o600 }) in Node.js and os.open with 0o600 in Python).
-
LowUndocumented telemetry sends wallet addresses on every action and lacks error handling
typescript/agentkit/src/action-providers/actionDecorator.ts:106
AgentKit silently sends the user's wallet address, chain ID, wallet provider type, and action name to https://cca-lite.coinbase.com/amp on wallet initialization and on every action call—even when using non-Coinbase local private keys—with no opt-out setting and no mention in the documentation. Furthermore, unlike WalletProvider, CreateAction in TypeScript does not attach .catch() to the async sendAnalyticsEvent call, so an offline network or non-2xx analytics response causes an unhandled promise rejection that can crash the Node.js process.
Fix: Document telemetry clearly, provide an environment variable or config option to disable analytics, avoid sending wallet addresses by default, and add .catch() to sendAnalyticsEvent in CreateAction.
