Back to skill

Security audit

A 股投资决策助手

Security checks for vulnerabilities and agentic risk

Overview

This A-share reporting skill mostly matches its stated purpose, but it needs review because it imports executable code from a user-writable workspace and can make financial recommendations from silent fallback prices.

Review before installing. This skill reads local portfolio holdings, sends stock symbols to an external quote service, and saves financial reports under ~/.openclaw/decisions. Only use it if you trust the files in ~/.openclaw/workspace, protect the saved reports, and independently verify prices before acting on any trading recommendation.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T07 · Tool Hijacking and Spoofing

Error
Location
skill.py:14
Finding

Arbitrary Code Execution Through a User-Writable Python Import Path

Content
View full analysis

Vulnerability Details

File Location: skill.py, lines 14-17
Vulnerability Type: Untrusted module loading and local tool spoofing
Risk Level: High

Vulnerable Code

python
# 添加工作目录到路径
sys.path.insert(0, str(Path.home() / ".openclaw" / "workspace"))

# 导入共享记忆加载器
from shared_memory_loader import get_latest_holdings

Technical Analysis

The Skill prepends ~/.openclaw/workspace to Python's module search path and then imports shared_memory_loader from that location. The loader is not bundled with the reviewed project, and the code performs no validation of the resolved module's canonical path, ownership, permissions, or integrity.

Python executes module-level statements while importing a module. Consequently, a malicious or compromised shared_memory_loader.py in the workspace can execute arbitrary Python code before the Skill performs its intended portfolio analysis.

This is a local module-preloading vulnerability. It does not independently provide privilege escalation: the injected code runs with the same operating-system privileges, credentials, filesystem access, and network access as the user or Agent process invoking the Skill.

Attack Path

  1. An attacker obtains the ability to create or replace files in ~/.openclaw/workspace.
  2. The attacker places a malicious file named shared_memory_loader.py in that directory.
  3. A user or Agent invokes the stock-decision Skill.
  4. The Skill inserts the workspace at index zero of sys.path.
  5. Python resolves shared_memory_loader from the attacker-controlled workspace.
  6. Python executes the malicious module's top-level code during import.
  7. The attacker-controlled code operates with the invoking process's privileges.

Impact Assessment

Successful exploitation enables arbitrary code execution in the context of the Skill process. Depending on that process's existing permissions, attacker code could read or modify accessib ...[truncated 380 chars]

Remediation
View remediation

Remediation Suggestions

  • Bundle shared_memory_loader inside the reviewed package and import it through a package-relative import.
  • Do not add a user-writable workspace directory to the beginning of sys.path.
  • If external loading is unavoidable, resolve a fixed canonical file path and verify that the path remains within the expected directory.
  • Validate file ownership and permissions before loading external code.
  • Verify the loader against a trusted cryptographic digest or signed manifest.
  • Prefer parsing SHARED_MEMORY.md as data rather than importing executable Python code from the workspace.
  • Run the Skill with least privilege and restrict write access to directories containing executable modules.

T09 · Insecure Skill Coding Practices

Error
Location
skill.py:62
Finding

Silent Use of Fabricated Prices Can Produce Unsafe Trading Recommendations

Content
View full analysis

Vulnerability Details

File Location: skill.py, lines 62-79
Vulnerability Type: Fail-open market-data handling
Risk Level: High

Vulnerable Code

python
        except Exception as e:
            pass

        # 备用数据
        base_prices = {
            "300570": 112.51,
            "300054": 49.75,
            "603398": 11.64,
            "688262": 31.26,
            "300342": 56.47,
            "688472": 12.59,
            "000711": 4.13
        }

        return {
            "code": code,
            "price": base_prices.get(code, 100),
            "change": 0,
            "prev_close": base_prices.get(code, 100)
        }

Technical Analysis

All exceptions raised during market-data retrieval and parsing are silently discarded. The method then substitutes hard-coded values for known symbols and an arbitrary price of 100 for every unknown symbol.

The returned structure does not identify the value as fallback, stale, or synthetic data. Downstream code treats it as a current market price, calculates profit or loss against the holding cost, and can generate stop-loss, profit-taking, or position-reduction recommendations.

As a result, network failures, malformed responses, response-format changes, decoding errors, and numeric conversion failures are converted into apparently successful market-data results. This violates fail-safe error handling and undermines the integrity of a financial decision system.

Attack Path

  1. A portfolio contains a stock for which the Skill attempts to retrieve a current quote.
  2. Quote retrieval or parsing fails because of an outage, timeout, malformed response, incompatible response format, or network interference.
  3. The broad exception handler suppresses the error without recording or reporting it.
  4. The Skill selects a hard-coded price or the arbitrary default value of 100.
  5. analyze_stock treats the fallback as the cu ...[truncated 896 chars]
Remediation
View remediation

Remediation Suggestions

  • Fail closed when current market data cannot be retrieved or validated.
  • Do not generate actionable recommendations from synthetic fallback prices.
  • Return an explicit status such as unavailable, stale, or unverified with every quote.
  • Include the quote timestamp and source in the internal result and generated report.
  • Catch specific exceptions rather than suppressing every Exception.
  • Record retrieval and parsing failures through an appropriate logging mechanism without exposing sensitive information.
  • Strictly validate the response structure, symbol, numeric fields, and expected field count before accepting a quote.
  • If cached data is permitted, store its retrieval time and enforce a documented maximum age.
  • Clearly distinguish cached data from live data and require user confirmation before producing recommendations from stale information.

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unpinned Third-Party Dependency Creates a Non-Reproducible Supply Chain

Content
View full analysis

Vulnerability Details

File Location: requirements.txt, line 1
Vulnerability Type: Unconstrained third-party dependency
Risk Level: Medium

Vulnerable Code

text
requests

The installation instructions in SKILL.md also use an unconstrained installation command:

bash
pip3 install requests

Technical Analysis

The project declares requests without a version constraint, lockfile, or package hash. Each installation can therefore resolve to a different release based on the package index state at installation time.

This prevents reproducible builds and means a future compromised, malicious, or incompatible release could be installed without any project change or renewed audit. The dependency name itself is legitimate; the confirmed weakness is the absence of version and integrity controls, not evidence that the current requests package is malicious.

Attack Path

  1. An administrator or automated environment installs the Skill's dependencies.
  2. The package installer resolves requests to whichever release currently satisfies the unconstrained requirement.
  3. A compromised or otherwise unsafe future release is downloaded from the configured package index.
  4. The affected package is installed and imported by skill.py.
  5. Malicious or vulnerable dependency behavior executes with the privileges of the Skill process.

This path depends on compromise or unsafe publication within the configured dependency supply chain; no such compromise was demonstrated in the reviewed files.

Impact Assessment

A compromised dependency could execute code with the same privileges as the process installing or running the Skill. Potential scope includes user-accessible files, OpenClaw data, portfolio information, generated reports, and network access available to that process.

An incompatible but non-malicious update could also break quote retrieval and indirectly activate the unsafe fall ...[truncated 60 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin requests to a specifically reviewed version.
  • Generate and commit a lockfile appropriate for the deployment environment.
  • Require cryptographic hashes for downloaded distributions, such as through pip's hash-checking mode.
  • Use a trusted package index and prevent unreviewed fallback to additional indexes.
  • Apply automated dependency vulnerability scanning and controlled update review.
  • Update SKILL.md to install dependencies from the locked requirements artifact rather than using an unconstrained pip3 install requests command.
  • Rebuild and retest the Skill whenever dependency versions or hashes change.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The documented purpose says the skill reads shared memory and generates an investment report, but the detected behavior also includes external network requests and persistent local file writes that are not disclosed. This mismatch is dangerous because users may authorize a seemingly local analysis skill without realizing it can exfiltrate portfolio data to third parties or leave sensitive financial reports on disk.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises capabilities that imply network access and file output, but it does not declare any explicit tool scope or permissions boundaries. In an agent environment, undeclared network and file-write capability weakens least-privilege controls and can let the skill access external services or persist data in ways users and orchestrators did not approve.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill description and all user-facing documentation are written exclusively in Chinese and explicitly position the skill as an "A 股投资决策助手" without indicating any language choice or opt-in. This can violate a language/locale policy when users are not given an option to interact in another language or a justification for the locale restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The package description is written solely in Chinese and describes the skill behavior without offering any language or locale choice. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module description and all user-facing behavior are written specifically for 'A股' users in Chinese, with no indication that the user can opt into another language or locale. The policy requires flagging language or locale constraints when they are forced without user choice or clear documented justification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code prepends a user-writable workspace path to sys.path, then imports shared_memory_loader from that location. This enables module hijacking: any attacker or untrusted process able to place a file in that workspace can execute arbitrary Python code when the skill runs, which is much more dangerous than the skill's stated reporting purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill metadata says it reads shared memory and generates an investment decision report, but it also performs outbound network access to fetch live market data. This expands the skill's capabilities beyond the declared scope, creating privacy, policy, and supply-chain risk because execution now depends on an external service and can transmit user-driven stock symbols off-box.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description presents the function as reading shared memory and generating a report, but the code also persists that report to disk under the user's home directory. Writing potentially sensitive portfolio analysis to local storage increases confidentiality risk and leaves durable artifacts not disclosed by the stated behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The entire skill documentation is presented only in Chinese, including the title and operational instructions, with no indication that users may choose another language or that the locale restriction is intentional and justified. The policy for SQP-3 flags language or locale constraints when they are imposed without user opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

This markdown file explains that the skill reads holdings data from ~/.openclaw/workspace/SHARED_MEMORY.md and saves decision reports under ~/.openclaw/decisions/, but it does not warn users that potentially sensitive financial data will be accessed and persisted locally. For markdown files, SQP-2 applies when descriptions omit warnings about behaviors affecting user data or privacy.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency manifest specifies requests without a version constraint, which makes builds non-reproducible and allows installation of different releases over time, including vulnerable ones. In a skill that may fetch market or portfolio-related data, this increases supply-chain risk and makes it impossible to verify whether known fixes are present.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
requests

Unverifiable Dependency: requests has 16 known advisory(ies) (CVE-2014-1830 (Exposure of Sensitive Information to an Unauthorized Actor in Requests); CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
91% confidence
Finding

requests has multiple published advisories, and because no version is pinned, the manifest cannot demonstrate that an unaffected release will be installed. This is a real supply-chain exposure: depending on environment resolution, the skill could end up using a version vulnerable to credential leakage, TLS/verification issues, or other known flaws.

Content

No source excerpt is available for this finding.