Back to skill

Security audit

持仓诊断分析

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed stock-holdings analysis tool, but it runs code from hardcoded external workspace files and can load replacement modules outside the reviewed package.

Review before installing. Only run this skill if you trust every file in the referenced `.qclaw` workspace, especially `scripts/_holdings_std.py` and imported analysis modules. Prefer a version that reads holdings from JSON or CSV, uses packaged imports, lets you choose output paths, and excludes generated portfolio reports from published artifacts.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
check_holdings_v4.py:10
Finding

Arbitrary Code Execution Through an Executed External Holdings File

Content
View full analysis
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Error
Location
check_holdings_v4.py:10
Finding

External Module Search-Path Precedence Enables Local Module Hijacking

Content
View full analysis
Remediation
View remediation

other

Warning
Location
holdings_result.json:2
Finding

Generated Holdings Report Discloses Sensitive Financial Position Data

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (22)

exec() call detected

High
Category
Dangerous Code Execution
Confidence
99% confidence
Finding

The code reads a Python file from an external workspace path and executes it with exec(), which allows arbitrary code execution if that file is modified or replaced. In this skill context, the file is presented as a data source for holdings, so treating it as executable code is unnecessary and significantly increases risk.

Content

Scanner excerpt · check_holdings_v4.py (reported line 19)May include surrounding context.

python
# ─── 持仓数据(唯一数据源:scripts/_holdings_std.py)───────────────
_std = os.path.join(_WORKSPACE, 'scripts', '_holdings_std.py')
_h = {}
exec(open(_std, encoding='utf-8').read(), _h)
HOLDINGS = _h.get('HOLDINGS', [])

# ─── 外部模块 ─────────────────────────────────────────────────────

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill executes code from an external workspace file at runtime even though the stated purpose is to load holdings data. Because the workspace is a mutable location, this creates a code injection surface that is broader and more dangerous than necessary for the feature.

Content

No source excerpt is available for this finding.

Direct flow: open (file read) → exec (code execution)

High
Category
Data Flow
Confidence
99% confidence
Finding

This is a direct open() -> exec() flow, meaning file contents are executed immediately without validation, sandboxing, or integrity checks. Any attacker or compromised process that can alter the workspace file can run arbitrary Python with the privileges of the agent.

Content

Scanner excerpt · check_holdings_v4.py (reported line 19)May include surrounding context.

python
# ─── 持仓数据(唯一数据源:scripts/_holdings_std.py)───────────────
_std = os.path.join(_WORKSPACE, 'scripts', '_holdings_std.py')
_h = {}
exec(open(_std, encoding='utf-8').read(), _h)
HOLDINGS = _h.get('HOLDINGS', [])

# ─── 外部模块 ─────────────────────────────────────────────────────

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file's user-facing instructions and descriptions are entirely in Chinese, and there is no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking audience. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file's docstrings, status messages, and report content are entirely in Chinese, and the output sanitization comment also assumes Chinese output. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified or alternatives are offered.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script performs a file write to a hard-coded path, overwriting _holdings_detail.json if it already exists. There is no confirmation prompt, prior user-facing disclosure, or explanatory comment/docstring warning that local data will be written.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The comments describe the external file as the single data source for holdings, but the implementation executes that file as Python code. This mismatch can mislead reviewers and users into believing the input is passive data, reducing scrutiny and increasing the chance of hidden code execution going unnoticed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill executes an external Python file without warning or disclosure, which removes an important trust boundary for users and operators. While the core technical issue is the execution itself, the lack of transparency makes detection and informed consent less likely.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This JSON file includes multiple natural-language fields in Chinese, such as stock names and the signal string, but provides no indication that the skill is intentionally region-specific or that users can choose their preferred language/locale. Under the policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module produces explicit sell recommendations such as '建议卖出', '警惕风险', and '继续持有' without any disclaimer that the output is heuristic, informational, and not financial advice. In a trading context, users may treat these outputs as actionable investment guidance, increasing the risk of harmful financial decisions based on incomplete or unvalidated signals.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest description is written entirely in Chinese, which indicates the skill is presented in a single language without offering any language or locale choice. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file contains user-facing natural-language descriptions entirely in Chinese, including the module docstring and later report/alert strings, with no indication that other languages are supported. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code file contains user-facing natural language such as the module docstring and later console/push-message strings exclusively in Chinese. Under the policy, forcing a specific language without offering a language or locale choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python file hard-codes all user-facing strings, labels, and report text in Chinese, including the module description, generated reports, and runtime messages. Because it does not provide any user opt-in or language selection mechanism, it creates a natural-language locale policy concern under the rule for forced language or locale behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This Python code file performs a network/data-fetch operation via fetch_kline_tencent(code) for each holding, which may transmit portfolio-related identifiers such as stock codes. The script prints only a generic analysis status and does not explicitly disclose that external market data requests will be made using the user's holdings information.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file’s natural-language descriptions and printed labels are entirely in Chinese, with no indication that language is configurable or chosen by the user. Under the policy, forcing a specific language without user opt-in can be a locale/language policy violation unless clearly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This Python file presents its descriptions and user-facing messaging entirely in Chinese, including the module description and later warning/recommendation text, without offering any language or locale opt-in. Under the policy, forcing a specific language without user choice can be a natural-language policy violation unless the locale restriction is justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This code file contains user-facing natural-language strings, comments, docstrings, industry labels, and default return values entirely in Chinese. The file does not indicate that the skill is intentionally limited to a Chinese-speaking or China-market context, nor does it offer a language/locale choice, which can violate language/locale policy requirements.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstrings, status messages, and formatted report text are all hard-coded in Chinese, including user-visible outputs like recommendations and usage instructions. Because the file does not provide any user opt-in, language selection, or documented region-specific justification, this is a language/locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The module docstring and user-facing text are entirely in Chinese, including the description and output label. For a general-purpose skill file, this imposes a specific language/locale without offering user choice or documenting that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The comment at L343 states '将本次TOP 10加入追踪' (add this run's TOP 10 to tracking), but the implementation immediately below uses df_result.head(5), limiting tracking to five stocks. This is a direct contradiction between code comments and actual behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The comment describes a diversification policy of at most 2 per industry while ensuring TOP5 come from at least 3 industries. However, the actual constants and loop logic below select up to 10 items initially and enforce MIN_INDUSTRIES = 5, so the documented intent does not match the implemented behavior.

Content

No source excerpt is available for this finding.