onchainos-skills
- Type
- MCP server
- Scanned
- Nov 17, 2026
- Version
- 30cc6915d7da
- Files read
- 608
This project gives AI coding assistants a command-line tool, MCP server, and skills to manage OKX crypto wallets, trade tokens, pay for online services, and buy or sell tasks on an agent marketplace across more than 20 blockchains. The biggest risk is that untrusted marketplace peers or payment servers can exploit command injection flaws, unverified auto-trading rules, and unvalidated file or network requests to run arbitrary code on your computer, steal local files, probe internal networks, or spend wallet funds without your approval.
What it can reach
- Files
- Reads and writes wallet data, logs, caches, helper binaries, and marketplace task files under ~/.onchainos/, ~/.okx-agent-task/, agent skill folders, and temporary directories, plus ~/.codex/sessions and file paths used for uploads or downloads.
- Network
- Connects to OKX Web3 and marketplace APIs, blockchain RPC nodes, NewsLiquid, GitHub and npm registries, DNS-over-HTTPS CDNs, and caller- or provider-supplied payment and MCP URLs.
- Shell commands
- Spawns background onchainos and okx-a2a subprocesses, runs a downloaded okx-pilot helper binary and npx installers, and instructs the host AI agent to execute shell commands including onchainos, okx-a2a, npx, npm, curl, and python3.
- Secrets
- Reads and stores wallet login tokens and signing session keys in the system keychain or ~/.onchainos/keyring.enc, and reads OKX API credentials and optional EVM_PRIVATE_KEY values from environment variables or ~/.onchainos/.env.
- Browser
- Opens social-login URLs in your default web browser during wallet sign-in.
- System
- Reads your computer's hardware machine ID and device name to encrypt local keys and identify the device on requests to OKX services.
- Other
- Signs and broadcasts live cryptocurrency transfers, token approvals, swaps, cross-chain bridges, DeFi positions, web payments, and marketplace escrow transactions across more than 20 blockchains.
Findings
-
HighServer-side request forgery and unvalidated redirects in payment quoting and replay
cli/src/commands/payment/quote.rs:134
The payment_quote MCP tool (marked read-only) and onchainos payment quote command probe any URL supplied to them—with SKILL.md instructing the agent to run quote silently before any user confirmation—without requiring HTTPS, blocking loopback/RFC1918/cloud-metadata IPs (such as 127.0.0.1 or 169.254.169.254), or disabling HTTP redirects. Arbitrary HTTP methods (GET, POST, PUT, PATCH, DELETE) and bodies are allowed, and any 2xx response body is returned verbatim in merchantBody. Similar missing IP/redirect checks exist in McpClient, agent a2mcp invoke, and payment_flow::replay_merchant (which can also forward signed PAYMENT-SIGNATURE headers across 3xx redirects). A prompt-injected agent or a redirecting 402 server can read internal services or trigger state changes on unauthenticated local endpoints.
Fix: Enforce https:// on merchant and A2MCP URLs, disable automatic HTTP redirects (reqwest::redirect::Policy::none()), resolve target hostnames before connecting, and reject loopback, link-local, metadata, and private IP ranges.
-
HighWindows command injection via cmd.exe /C when recording remote subscription signals
cli/src/commands/agent_commerce/task/common/okx_a2a.rs:45
On Windows, npm_cli_command invokes external CLIs through cmd.exe /C, assuming arguments are fixed flag tokens without spaces or quotes. However, trade_records_insert passes a serialized JSON array (--input-json) that can contain untrusted signal text received from a remote marketplace service provider. Because Rust quotes arguments for MSVCRT (escaping inner quotes as backslash-quote) rather than cmd.exe, double quotes in the JSON toggle cmd.exe quote parsing and allow metacharacters such as & or %VAR% inside a remote signal to execute arbitrary commands on Windows.
Fix: Pass the JSON payload to okx-a2a over stdin instead of --input-json, or resolve okx-a2a.cmd via PATHEXT and invoke Command::new on the resolved path directly so Rust applies batch-safe escaping without cmd.exe /C.
-
HighShell injection via unescaped buyer task title in SubmitDeadlineWarn playbook
cli/src/commands/agent_commerce/task/asp/flow.rs:20
When a submit_deadline_warn event arrives for a service provider (ASP) agent, generate_next_action embeds the buyer-supplied jobTitle (title_display) into list_label_full and passes it to pending_v2::request_command_block, which places --list-label "{label}" unescaped inside a bash code block that the ASP agent is instructed to execute (while keeping <title> verbatim during localization). Unlike sub_user_reject and job_rejected, which use Base64 --template-vars-b64 placeholders to block shell injection, this path leaves double quotes, $(), and backticks unescaped in the generated shell command.
Fix: Migrate SubmitDeadlineWarn to pending-decisions-v2 request-prompt with --template-vars-b64 placeholders so untrusted task titles never appear in generated shell commands, and single-quote-escape all arguments in request_command_block.
-
HighIncomplete jobId validation permits shell metacharacters and path traversal in envelopes
cli/src/commands/agent_commerce/task/common/util.rs:461
validate_job_id is meant to restrict jobId values from incoming A2A and XMTP envelopes to 0x plus 64 lowercase hex characters or a safe system_ identifier before they are interpolated unquoted into bash playbooks and joined into local file paths. However, the function never checks that the 64 bytes after 0x are hexadecimal digits, and right above this line it accepts any string starting with system_ regardless of length or characters, allowing shell metacharacters or path separators in crafted peer envelopes.
Fix: Verify that job_id[2..].bytes().all(|b| b.is_ascii_hexdigit()) for 0x-prefixed IDs, restrict system_ IDs to ASCII alphanumeric and underscore characters within a fixed length limit, and shell-quote job_id in all generated commands.
-
HighCounterparty message routing and unvalidated attachment path allow arbitrary local file exfiltration
cli/src/commands/agent_commerce/task/user/flow_lifecycle/manage.rs:492
In skills/okx-ai/references/a2a/peer.md, which handles inbound a2a-agent-chat messages from remote task counterparties, rule 3 tells the task sub-session that whenever it receives '[ATTACHMENT_ADDED] <path>' it must pass that exact path to the CLI attachment event, without verifying that the message came from the local user rather than the remote provider. In manage.rs, attachment_added_cli reads filePath directly from the event JSON without checking that it resides inside the job's ~/.onchainos/attachments/<jobId>/ directory, uploads any local file via okx-a2a, and sends the file key and decryption secret directly to the remote provider.
Fix: Require attachment_added_cli to canonicalize filePath and reject any path outside the job's managed ~/.onchainos/attachments/<jobId>/ directory, and reject [ATTACHMENT_ADDED] markers inside remote peer a2a-agent-chat messages in peer.md.
-
HighProvider-authored serviceGuide is hidden from buyers yet executed as a trusted auto-trade policy without CLI caps
skills/okx-ai/references/a2a/user/execution-policy.md:68
A subscription's serviceGuide is free-form Markdown written by a third-party marketplace provider. During discovery (identity/output-templates.md) and subscription confirmation (subscription-create.md), the raw serviceGuide text is hidden from the buyer, who only sees extracted setup questions. However, when a signal arrives on a guide_direct subscription, execution-policy.md instructs the buyer's AI agent to treat that provider-authored Guide as the trusted local execution policy to select and invoke money-moving tools, while check_grant in autotrade/grants.rs no longer enforces stored max_buy or max_sell spending caps. A malicious provider can embed hidden transfer or swap instructions in serviceGuide that drain wallet funds when a signal is pushed.
Fix: Never treat provider-supplied serviceGuide prose as trusted tool-selection authority; show the exact execution rules to the buyer before consent, restrict auto-trades to structured, schema-validated parameters, and enforce deterministic per-trade and daily spending caps in the CLI.
-
HighAuto-trade recovery fetches mutable remote serviceGuide without checking the consented guideHash
cli/src/commands/agent_commerce/task/common/autotrade/executor.rs:647
When a user consents to a subscription Guide, write_prepared_consent records its SHA-256 digest in consent.guide_hash. However, load_guide_and_consent in autotrade/guide.rs never verifies that guide.source_hash matches consent.guide_hash, and restore_subscription_local_contract in autotrade/executor.rs automatically downloads the provider's current live serviceGuide from the marketplace API whenever the local guide file is missing (including during legacy JSON consent migration) and writes it to disk. A provider who updates their listing's serviceGuide can therefore have new, unreviewed trade instructions automatically activated under an existing user consent.
Fix: Enforce guide.source_hash == consent.guide_hash inside load_guide_and_consent before admitting any guide_direct claim, and refuse to activate or restore a downloaded serviceGuide whose hash has not been explicitly confirmed by the user.
-
Higha2a-pay buyer flow signs and submits server-defined payment challenges with no preview or confirmation
skills/okx-agent-payments-protocol/references/a2a_charge.md:54
Unlike HTTP 402 payments (which enforce both a user confirmation card and a CLI --yes gate), SKILL.md Path B routes any a2a_... paymentId directly to a2a_charge.md, which tells the agent to skip any preview or yes/no gate and immediately run 'onchainos payment a2a-pay pay --payment-id <paymentId>'. Because a paymentId is an opaque identifier whose amount, token, and recipient are fetched from the server at signing time (and are not even shown by a2a-pay status), a deceptive payment link or a prompt injection can cause the wallet to TEE-sign and transfer an arbitrary amount without the user ever seeing or approving the charge details.
Fix: Add a quote/preview step and a CLI confirming gate (--yes) to 'onchainos payment a2a-pay pay', and require a2a_charge.md to display the server-returned network, token, amount, and recipient and wait for explicit user approval before signing.
-
HighRaw counterparty deliverable text is injected into an unattended sub-session prompt while escrow completion is unlocked
cli/src/commands/agent_commerce/task/user/flow_lifecycle/core.rs:537
When a buyer receives a text deliverable from a provider on an escrow task, deliverable_received_cli interpolates the provider's raw text verbatim inside triple-backtick fences in prefetch_batch (with no untrusted-data warning or fence escaping) and dispatches it via okx_a2a::session_send into an unattended background agent session. If the provider already submitted the task on-chain, the same handler marks review_gate pending, which unlocks 'onchainos agent complete <jobId>'. A provider whose deliverable closes the backtick fence and injects follow-up CLI instructions can hijack the unattended session into running 'onchainos agent complete' to release escrowed funds without buyer approval.
Fix: Do not inline untrusted deliverable text or peer chat history into imperative CLI prompts; strip or escape backtick fences, label peer text strictly as untrusted data, and require an interactive user-session confirmation token before 'onchainos agent complete' can release escrow.
-
MediumUnescaped marketplace task title interpolated into bash playbook command
cli/src/commands/agent_commerce/mod.rs:2431
When onchainos agent next-action handles a non-zero transaction status code on an inbound A2A system event, it prints an instruction playbook containing a bash code block for the agent to run: onchainos agent user-notify --content '...'. The task's jobTitle—which is authored by an untrusted counterparty on the marketplace—is formatted raw without shell or markdown escaping directly inside single quotes in that command. A task title containing single quotes, command substitutions, or markdown code fences can inject shell commands or arbitrary instructions into the trusted playbook output.
Fix: Shell-escape or Base64-encode jobTitle before embedding it into generated CLI commands, strip control characters and code fences, or dispatch user-notify directly in Rust without emitting a shell snippet.
-
MediumSilent runtime download and execution of unpinned okx-pilot binary on network timeout
Whenever any request to web3.okx.com encounters a connection error or 10-second timeout, DohManager automatically downloads a platform binary (okx-pilot) to ~/.onchainos/bin/ from one of four CDN/OSS origins (static.okx.com, static.coinall.ltd, okg-pub-hk.oss-cn-hongkong.aliyuncs.com, static.jingyunyilian.com), marks it executable, and runs it without user consent. Integrity is checked only against a checksum.json fetched at the same time from the same unpinned CDN path rather than a compiled-in hash or cryptographic signature, and the binary's output redirects authenticated API traffic (including Bearer tokens) to a returned proxy host and IP.
Fix: Verify okx-pilot against a compiled-in public-key signature or pinned release hash, require explicit user opt-in before downloading or executing helper binaries, and document the DoH proxy failover behavior.
-
MediumSwap high-tax scam check is stubbed to NaN while SKILL.md forbids manual taxRate checks
cli/src/commands/risk_classify.rs:222
During swap quote and swap swap, classify_swap_side checks whether a token's taxRate exceeds 10% by calling normalize_tax_rate(raw_tax) > 10.0. However, normalize_tax_rate unconditionally returns f64::NAN, making the > 10.0 comparison always false so high-tax tokens (even 99% tax scam tokens that are not flagged as honeypots) receive action: ok. Meanwhile, skills/okx-agentic-wallet/SKILL.md explicitly instructs the agent not to recompute verdicts from raw taxRate and to proceed when action is ok, bypassing the intended pre-trade warning.
Fix: Implement normalize_tax_rate to convert the backend tax rate into percentage units (for example, handling 0..=1 fractional vs 0..=100 percentage representation) instead of returning f64::NAN, and add unit tests for >10% buy and sell taxes.
-
MediumPath traversal in dispute evidence download on Windows and unvalidated evidence paths
cli/src/commands/agent_commerce/task/evaluator/info.rs:119
When an evaluator runs evidence-info, download_file derives the local filename from each remote fileKey in the dispute evidence response by replacing only forward slashes after the first '/', and evidence_dir joins job_id and agent_id without calling validate_job_id_path_component. On Windows, backslashes and drive prefixes in fileKey are left intact by tmp_dir.join(filename), allowing crafted fileKey values to write downloaded bytes outside the evidence directory; unvalidated job_id or agent_id values can also traverse directories on any platform.
Fix: Validate job_id, agent_id, and the derived evidence filename with validate_job_id_path_component so any '/', '\', '..', or drive/root prefix is rejected before writing to disk.
-
MediumLoopback, private-network, and redirect SSRF bypass in mcp-tool-list
cli/src/commands/agent_commerce/identity/mcp_tool_list.rs:274
onchainos agent mcp-tool-list probes a caller-supplied --endpoint URL with JSON-RPC POST requests and echoes HTTP 401/403/408/429/5xx response bodies in errors. Its validate_endpoint check only blocks the literal hostnames localhost and .localhost, permitting 127.0.0.1, [::1], 0.0.0.0, cloud metadata IP 169.254.169.254, RFC 1918 private networks, DNS names resolving to internal IPs, and HTTP 307/308 redirects back to localhost because reqwest follows redirects by default.
Fix: Require https://, disable automatic HTTP redirects (or validate every redirect target), and resolve and block loopback, link-local, unspecified, and private IP ranges before connecting.
-
MediumProduction builds log user decision replies to a predictable /tmp file
cli/src/commands/agent_commerce/task/common/pending_v2.rs:369
trace_log is active in all release builds (not gated behind the debug-log feature) and appends job_id, agent_id, to_agent_id, and verbatim user_reply strings to /tmp/onchainos-cli-mode.log using default file permissions and without symlink protection. On shared machines, other local users can read sensitive user replies from /tmp or pre-create /tmp/onchainos-cli-mode.log (including as a symlink on macOS or systems without protected_symlinks) to capture output or append to victim-owned files; asp/deliver.rs similarly writes deliverable text to predictable /tmp/deliverable_*.md and .txt paths before upload.
Fix: Gate trace_log behind #[cfg(feature = "debug-log")] and write any diagnostic logs inside the 0700-protected onchainos_home() directory, and use tempfile::NamedTempFile for temporary deliverable files.
-
MediumSkills and templates automatically download and run unpinned packages and remote shell scripts at runtime
skills/okx-agentic-wallet/_shared/preflight.md:11
Almost every skill instructs the agent to run 'npx -y @okxweb3/onchainos-installer install ...' automatically at the start of each thread without asking the user, even for read-only queries. Although --skill-version is passed as an argument, the @okxweb3/onchainos-installer npm package itself is unpinned, so npx silently downloads and executes whatever version is currently tagged latest on npm. Similarly, skills/okx-ai/references/shared/chat-comm-init.md runs unpinned 'npm i -g @okxweb3/a2a-node' without confirmation, and openclaw_template/workspace/BOOTSTRAP.md pipes 'curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/openclaw_template/setup.sh | sh' on first message if files are missing.
Fix: Check for an already-installed binary locally instead of running npx at the start of every thread, require explicit user consent before installing or updating packages, and pin exact package versions, commit SHAs, and cryptographic checksums.
-
MediumA2MCP service invocation probes hidden provider endpoints before user confirmation or full SSRF filtering
skills/okx-ai/references/a2mcp/invoke.md:6
During marketplace search, identity/output-templates.md hides the Endpoint column from the user. Once an A2MCP service is selected, invoke.md only checks for a non-blank endpoint and immediately runs 'onchainos agent a2mcp invoke' before displaying the endpoint or asking for confirmation. As shown in cli/tests/cli_agent_a2mcp.rs, 'agent a2mcp invoke' only enforces HTTPS when handling a 402 payment challenge and permits plain HTTP requests to loopback addresses such as http://127.0.0.1:<port> when the target returns HTTP 200, summarizing the response in chat. A maliciously registered A2MCP listing can abuse this for SSRF against local services on the buyer's machine.
Fix: Display the A2MCP endpoint URL to the user before invocation, and enforce HTTPS plus DNS-resolved loopback, link-local, and RFC-1918 private IP blocking in both the skill and CLI before sending the initial HTTP or MCP probe.
-
MediumPayment replay instructions tell the agent to interpolate untrusted HTTP headers into a shell echo pipeline
skills/okx-agent-payments-protocol/references/charge.md:59
In charge.md (as well as session.md, accepts-schemes.md, and SKILL.md), the replay step instructs the agent to decode the remote 402 server's Payment-Receipt or PAYMENT-RESPONSE HTTP header by running "echo '<value>' | base64 -d | jq ." in a shell, instead of using the safe built-in 'onchainos payment decode-receipt --header' command. If a malicious 402 server returns a header containing a single quote and shell metacharacters, an agent following the command template literally can execute arbitrary shell commands.
Fix: Replace all "echo '<value>' | base64 -d | jq ." instructions across charge.md, session.md, accepts-schemes.md, and SKILL.md with 'onchainos payment decode-receipt' and validate that receipt headers contain only base64 characters.
-
LowUndisclosed OS computer name and hardware-derived device ID sent on all API requests
ApiClient::anonymous_headers attaches a persistent device-id (SHA-256 of the OS machine UUID) and a raw UTF-8 device-name (whoami::devicename(), which on macOS and Windows commonly contains the user's real name, such as 'Alice Smith's MacBook Pro') to every outbound OKX request, including anonymous read-only market and token lookups before any wallet login. This telemetry is not mentioned in README.md or MCP tool descriptions.
Fix: Send device-id and device-name only on authenticated wallet or multi-device subscription endpoints where device management is required, or document the headers and allow users to opt out.
-
LowUnpinned npx skills execution before user confirmation in DApp discovery skill
skills/okx-dapp-discovery/SKILL.md:173
Before asking the user whether to install a DApp plugin, the installed-status check in okx-dapp-discovery instructs the agent to run npx skills list 2>/dev/null (and later npx skills add okx/plugin-store ...). Invoking npx on the unscoped, unpinned skills npm package can fetch and execute mutable registry code prior to user consent if the CLI is not already installed locally.
Fix: Check the local skills directory directly on disk instead of invoking npx for status checks, and pin the exact package scope and version when installing plugins.
-
LowAutomatic migration copies untrusted ./onchainos/config.json from current directory
Whenever ~/.onchainos/config.json does not yet exist (the default after a fresh install), AppConfig::load automatically reads ./.onchainos/config.json from the current working directory—following symlinks and copying raw bytes before JSON validation—into ~/.onchainos/config.json. Running onchainos inside an untrusted repository containing .onchainos/config.json can persistently override default_chain across future sessions.
Fix: Remove automatic migration from the current working directory, or reject symlinks and require explicit user confirmation after parsing and validating the config fields.
-
LowLinux developer setup installs PATH wrapper that executes binaries from untrusted git repos
scripts/dev/onchainos-linux-dispatch.sh:7
For developers who run npm run setup on Linux, dev.mjs symlinks ~/.local/bin/onchainos and ~/.local/bin/okx-a2a to dispatchers that resolve the current git worktree via git rev-parse --show-toplevel and immediately exec $repo_root/.codex/bin/onchainos (or okx-a2a) if present. Running onchainos while inside any untrusted cloned repository that contains an executable .codex/bin/onchainos executes attacker code. End users who install via the standard installer are not affected.
Fix: Restrict the Linux dev dispatcher to an explicit allowlist of trusted repo paths recorded during npm run setup rather than trusting any current git worktree.
-
LowOpenClaw template scheduled task pipes unpinned remote setup.sh from main branch into sh
openclaw_template/manifest.json:46
The OpenClaw agent template defines an optional daily-update cron task (disabled by default) whose prompt instructs the agent to run curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/openclaw_template/setup.sh | sh, executing an unpinned script from a mutable branch without integrity verification if a user enables the task.
Fix: Pin updates to signed release tags or commit hashes and verify checksums before executing shell scripts.
