Back to skill

Security audit

astock-research

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a Chinese A-share research template, but it ships an executable quote script with an exposed API key and weak input handling.

Review this before installing. The main issue is not destructive local behavior; it is the bundled API key and the fact that the script sends stock codes to an external market-data service. The publisher should remove and rotate the exposed key, require users to supply their own credential securely, validate stock-code input, and make clear that outputs are research support rather than personalized financial advice.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/get_stock.sh:11
Finding
Hard-Coded QVeris API Credential in Distributed Script<![CDATA[ ## Vulnerability Details **File Location**: `scripts/get_stock.sh:11` **Vulnerability Type**: Hard-coded API credential **Risk Level**: High ### Vulnerable Code ```bash export QVERIS_API_KEY=sk-[REDACTED_EXPOSED_API_KEY] ``` The credential value has been redacted from this report to avoid further disclosure. ### Technical Analysis The script embeds a QVeris API key directly in source code and exports it to the environment of the subsequently executed process. Anyone who can access the Skill package, source repository, archive, build artifact, or relevant version history can retrieve the original credential. Environment variables may also become visible to child processes and, depending on operating-system permissions and runtime configuration, process-inspection or diagnostic tooling. The key resembles an operational secret, although its current validity and granted permissions were not tested during this static audit. ### Attack Path 1. An attacker obtains a copy of the publicly or internally distributed Skill package. 2. The attacker opens `scripts/get_stock.sh` and extracts the API key from line 11. 3. The attacker submits requests to the associated QVeris service using the stolen credential. 4. Requests are attributed to the credential owner until the key is revoked, expires, or is otherwise disabled. ### Impact Assessment The attacker may obtain all API capabilities granted to the exposed key. Depending on the service-side authorization and account configuration, this could result in: - Unauthorized QVeris API requests. - Consumption or exhaustion of API quotas. - Financial charges associated with unauthorized usage. - Access to data or operations permitted to the credential. - Loss of request attribution and audit-log integrity. - Service disruption for legitimate users if limits are exhausted. This finding does not establish operating-system access or privilege escalation. Its scope is limited to the permissions assigned to the exp ...[truncated 26 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Revoke the exposed credential immediately and issue a replacement. 2. Remove the credential from the current source tree and all distributable artifacts. 3. Purge the exposed value from version-control history where feasible. Rotation remains mandatory because history rewriting does not invalidate existing copies. 4. Obtain the credential from a protected environment variable or secret-management service: ```bash if [ -z "${QVERIS_API_KEY:-}" ]; then echo "Error: QVERIS_API_KEY must be supplied securely." >&2 exit 1 fi export QVERIS_API_KEY ``` 5. Never include the replacement key in source code, documentation, examples, logs, or package metadata. 6. Apply least privilege to the replacement key, including endpoint restrictions, rate limits, expiration, and network restrictions where supported. 7. Review API access logs for unauthorized activity involving the exposed credential. 8. Add secret scanning to local hooks and CI/CD pipelines to prevent recurrence. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/get_stock.sh:3
Finding
Unvalidated Stock Code Is Interpolated into JSON Request Parameters<![CDATA[ ## Vulnerability Details **File Location**: `scripts/get_stock.sh:3-16` **Vulnerability Type**: Improper input validation and unsafe JSON construction **Risk Level**: Medium ### Vulnerable Code ```bash CODE=$1 if [ -z "$CODE" ]; then echo "用法: ./get_stock.sh <股票代码>" echo "示例: ./get_stock.sh 000001.SZ" exit 1 fi echo "=== 查询 $CODE 实时行情 ===" export QVERIS_API_KEY=sk-[REDACTED_EXPOSED_API_KEY] ~/.local/bin/uv run /home/ubuntu/.openclaw/workspace/skills/qveris/scripts/qveris_tool.py execute ths_ifind.real_time_quotation.v1 \ --search-id "9869fb66-3bc7-4c4d-854f-4bedc22d3b10" \ --params "{\"codes\": \"$CODE\"}" 2>&1 ``` The credential value has been redacted from this report because it is independently reported as an exposed secret. ### Technical Analysis The first positional argument is accepted without validating that it conforms to the expected stock-code format. It is then inserted directly into a hand-built JSON string without JSON escaping or serialization. An input containing a double quote, backslash, or JSON syntax can terminate or alter the intended `codes` string. Depending on how `qveris_tool.py` parses and validates the resulting data, this can produce malformed JSON or introduce additional JSON fields into the request. This construction does not establish direct shell-command injection: the variable expansion remains inside a double-quoted shell argument, so shell metacharacters introduced through `CODE` are not reparsed as shell syntax. The confirmed weakness is request-parameter manipulation and denial of the intended request through unsafe JSON construction. ### Attack Path 1. An attacker gains the ability to invoke the script or influence its first argument. 2. The attacker supplies a value containing quotation marks and JSON tokens rather than a valid stock code. 3. The script concatenates the value into the `--params` JSON argument without escaping it. 4. The downstream QVeris wrapper receives malformed or st ...[truncated 918 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate the input against an explicit allowlist before constructing the request. For the documented stock-code format, use an anchored expression: ```bash CODE=${1:-} if [[ ! "$CODE" =~ ^[0-9]{6}\.(SZ|SH|BJ)$ ]]; then echo "Error: expected a stock code such as 000001.SZ." >&2 exit 1 fi ``` 2. Construct JSON with a serializer rather than string concatenation: ```bash PARAMS=$(jq -cn --arg codes "$CODE" '{codes: $codes}') || exit 1 ~/.local/bin/uv run \ /home/ubuntu/.openclaw/workspace/skills/qveris/scripts/qveris_tool.py \ execute ths_ifind.real_time_quotation.v1 \ --search-id "9869fb66-3bc7-4c4d-854f-4bedc22d3b10" \ --params "$PARAMS" ``` 3. If `jq` is unavailable, use a trusted JSON serializer in Python rather than implementing manual escaping. 4. Enforce the same stock-code schema in the downstream wrapper or API so that client-side validation is not the only control. 5. Avoid merging standard error into standard output unless required, because doing so can make downstream parsing and error detection unreliable. 6. Add tests covering quotation marks, backslashes, control characters, oversized arguments, invalid exchange suffixes, and multiple-code input. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The declared description promises a comprehensive A-share investment research framework with analysis across macro/micro fundamentals, capital flows, technicals, sentiment, and news, aimed at producing deep analysis and trading plans. The provided code does not implement such a framework. Instead, it is a narrow utility script for querying real-time market quotes for a single stock code via an external API. This is a materially different and much more limited behavior than the declared purpose. Additionally, the script hardcodes and exports an API key and invokes an external qveris/ths_ifind data service, which is an externally accessed capability not disclosed in the declared permissions. Therefore, the description does not accurately represent the supplied code chunk.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The script hardcodes and exports a live external API credential directly in source code. This exposes the secret to anyone who can read the file, shell history, logs, process environment, or downstream child processes, enabling unauthorized use of the external service and potential abuse billed to the owner.

Missing User Warnings

High
Confidence
98% confidence
Finding
Exporting a hardcoded API key without warning or disclosure is a real secret-handling flaw, not just a UX issue. The export makes the credential available to subprocesses and increases the chance of accidental leakage through debugging output, crash reports, environment inspection, or unrelated child commands.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill gives concrete trading outputs such as rating, position sizing, and entry/add-position price ranges without an explicit warning that the output is not financial advice and may lead to financial loss. In a financial-decision context, users may over-trust the model and act on recommendations without understanding uncertainty, suitability, or risk.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The natural-language title, usage text, and status output are all hardcoded in Chinese, with no option for the user to select another language and no documented justification for a Chinese-only locale. This creates a language policy issue because the skill imposes a specific language without opt-in.

Missing User Warnings

Medium
Confidence
78% confidence
Finding
The script executes an external tool that calls a remote API using the provided stock code and search identifier, but the user is only told that a quote query is being performed. There is no explicit warning or disclosure that input data is being transmitted to an external service.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The natural-language instructions and descriptions are fully Chinese-language, and the file does not indicate that the user can choose another language or that the skill is intentionally restricted to Chinese-language operation. This can violate language/locale policy when a skill forces a language without user opt-in.

Natural-Language Policy Violations

Low
Confidence
86% confidence
Finding
The manifest description is written entirely in Chinese and targets 'A股' analysis, which indicates a China-specific language/locale assumption. There is no accompanying note that the skill is region-specific by design or any indication that users can choose another language or locale.

Static analysis

No suspicious patterns detected.