T09 · Insecure Skill Coding Practices
- Location
check_holdings_v4.py:10- Finding
Arbitrary Code Execution Through an Executed External Holdings File
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
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.
check_holdings_v4.py:10Arbitrary Code Execution Through an Executed External Holdings File
check_holdings_v4.py:10External Module Search-Path Precedence Enables Local Module Hijacking
holdings_result.json:2Generated Holdings Report Discloses Sensitive Financial Position Data
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.
# ─── 持仓数据(唯一数据源: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', [])
# ─── 外部模块 ─────────────────────────────────────────────────────
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.
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.
# ─── 持仓数据(唯一数据源: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', [])
# ─── 外部模块 ─────────────────────────────────────────────────────
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.