T09 · Insecure Skill Coding Practices
- Location
scripts/clawallex.py:216- Finding
Unrestricted API endpoint override can disclose authenticated financial requests
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent USDC virtual-card payment skill, but it handles high-value payment credentials in ways users should review carefully before installing.
Review before installing. Use only with a dedicated, low-limit Clawallex API key, avoid entering secrets directly into chat or command-line history, do not use custom or HTTP base URLs with production credentials, rotate keys if they were logged, and keep the ~/.clawallex credential files protected or remove them when no longer needed.
scripts/clawallex.py:216Unrestricted API endpoint override can disclose authenticated financial requests
scripts/clawallex.py:949API secrets are accepted through process-visible command-line arguments
The declared purpose describes a user-facing financial capability: paying with USDC using virtual cards at online checkouts. However, the provided code chunk is only a test file. Its primary behavior is validating helper functions and setup routines in another module, including credentials handling, client ID persistence, request signing, and command-line setup responses. There is no implementation here for creating virtual cards, funding with USDC, processing payments, or interacting with checkout flows. While some tested endpoints/reference names suggest a payment/card API may exist elsewhere, this specific code chunk does not match the declared end-user purpose.
The skill documents persistent local storage of payment-service credentials at ~/.clawallex/credentials.json, which is a sensitive target for theft or misuse. Because these credentials can authorize wallet/card operations and card-data access flows, compromise of that file could enable unauthorized payments, account takeover, or access to encrypted sensitive card material.
- **Wallet**: Your USDC balance. Funds all Mode A operations.
- **Mode A** (mode_code=100): Wallet balance deduction (default).
- **Mode B** (mode_code=200): x402 on-chain USDC payment for callers with self-custody wallets (agent or user). Two-stage (quote → sign → settle). Agent signs EIP-3009 independently; only the signature and wallet address are passed to Stage 2.
- **client_id**: The agent's stable identity, separate from the API Key. An agent can have multiple API Keys (for rotation/revocation), but `client_id` never changes. Cards and transactions are isolated per `client_id`. When switching to a new API Key, keep using the same `client_id` — the new key auto-binds on first request. Once bound, it cannot be changed (TOFU). Stored locally at `~/.clawallex/credentials.json`.
The script stores API secrets persistently on disk in plaintext JSON. Although the file is created with 0600 permissions, the directory permissions are not explicitly hardened and plaintext secret storage remains risky on shared systems, backup systems, or compromised endpoints; in a payment-related skill this is more sensitive because the credentials authorize financial operations.
def save_credentials(creds):
"""Save credentials to ~/.clawallex/credentials.json with 0600 permissions."""
os.makedirs(CREDENTIALS_DIR, exist_ok=True)
fd = os.open(CREDENTIALS_FILE, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
with os.fdopen(fd, "w") as f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import clawallex as cw
cw.CREDENTIALS_DIR = _tmpdir
cw.CREDENTIALS_FILE = os.path.join(_tmpdir, "credentials.json")
cw.CLIENT_IDS_FILE = os.path.join(_tmpdir, "client_ids.json")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import clawallex as cw
cw.CREDENTIALS_DIR = _tmpdir
cw.CREDENTIALS_FILE = os.path.join(_tmpdir, "credentials.json")
cw.CLIENT_IDS_FILE = os.path.join(_tmpdir, "client_ids.json")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import clawallex as cw
cw.CREDENTIALS_DIR = _tmpdir
cw.CREDENTIALS_FILE = os.path.join(_tmpdir, "credentials.json")
cw.CLIENT_IDS_FILE = os.path.join(_tmpdir, "client_ids.json")
The README documents commands that save credentials and expose sensitive financial data such as API keys, wallet/account details, and card details including encrypted PAN/CVV, but it provides no security guidance on storage, access control, logging, or safe handling. In an agent-integrated payments skill, omission of these warnings increases the risk that developers or operators will mishandle secrets and card data, leading to credential compromise or unauthorized financial activity.
The skill explicitly directs use of a local Python script that performs network operations, reads account/card data, and stores credentials locally, yet it declares no tool restrictions. In an agent environment, missing permissions/allowed-tools broadens what the skill may invoke and weakens least-privilege controls, increasing the blast radius if the skill is misused or compromised.
The skill instructs the agent to solicit API key and secret material from the user and later states those credentials are saved locally, but it does not require an explicit warning, consent step, or handling constraints before collection. In an LLM-agent setting, asking for long-lived secrets without clear storage and privacy disclosure materially increases the risk of inadvertent exposure, unsafe retention, or collection through untrusted chat channels.
The signup flow retrieves API credentials from a remote service and immediately persists them locally without an explicit confirmation or warning. In an agent-skill context, this increases the chance that long-lived secrets are stored on disk unexpectedly, which can expand exposure if the host is multi-user, compromised, or the user did not intend persistent credential storage.
This code writes ~/.clawallex/client_ids.json but provides no confirmation prompt, logging, or visible disclosure at the write site. For code files, local file writes should have some user disclosure unless clearly covered elsewhere; unlike credential saving, this helper's docstring does not indicate that it persists data locally.