Back to skill

Security audit

Cn Stock Volume

Security checks for vulnerabilities and agentic risk

Overview

This A-share report skill is mostly purpose-aligned, but one script lets a crafted date argument read, modify, or delete JSON files outside its intended data folder.

Review this skill before installing. Use only canonical YYYY-MM-DD dates, do not pass untrusted date strings to scripts/补数据.py, and avoid --clear until the path validation issue is fixed. Expect it to write reports under the workspace and Desktop folder and to use iwencai as an external data source; also note that automatic fetching appears incomplete in this version.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/fetch_data.py:48
Finding

Path Traversal Enables Arbitrary JSON File Read, Modification, or Deletion

Content
View full analysis
Path: """获取手动补充数据文件路径""" MANUAL_DIR.mkdir(parents=True, exist_ok=True) return MANUAL_DIR / f"{date}.json" ``` ```python # scripts/补数据.py:44-58 # 确定日期 if args.date: date = args.date else: date = datetime.now().strftime('%Y-%m-%d') manual_path = get_manual_path(date) # 清除手动数据 if args.clear: if manual_path.exists(): manual_path.unlink() print(f"✅ 已清除手动数据:{manual_path}") else: print(f"ℹ️ 没有手动数据可清除") return ``` ```python # scripts/补数据.py:86-107 # 加载现有数据 existing_data = load_manual_data(date) # 更新数据 if 'volume' not in existing_data: existing_data['volume'] = {} if args.today is not None: existing_data['volume']['today'] = args.today print(f"✅ 今日成交量:{args.today}万亿") if args.previous is not None: existing_data['volume']['previous'] = args.previous print(f"✅ 昨日成交量:{args.previous}万亿") # 保存数据 save_manual_data(date, existing_data) ``` ### Technical Analysis The positional `date` argument is treated as a trusted filename component without validating that it is a canonical `YYYY-MM-DD` date. It can therefore contain: - An absolute path, such as `/tmp/target` - Parent-directory components, such as `../../target` - Other path separators that escape the intended `manual/` directory With `pathlib`, joining a base path to an absolute path discards the base path. For example: ```python MANUAL_DIR / "/tmp/target.json" ``` resolves to `/tmp/target.json`, not a file beneath `MANUAL_DIR`. Relative traversal components are also retained, allowing the resulting path to escape the intended directory after filesystem resolution. The constructed path is subsequently passed ...[truncated 2444 chars]
Remediation
View remediation
str: try: parsed = datetime.strptime(value, "%Y-%m-%d") except ValueError as exc: raise ValueError("Date must use YYYY-MM-DD format") from exc canonical = parsed.strftime("%Y-%m-%d") if value != canonical: raise ValueError("Date must be a canonical YYYY-MM-DD value") return canonical ``` 2. Resolve the base directory and candidate path, then enforce containment: ```python def get_manual_path(date: str) -> Path: safe_date = validate_date(date) base = MANUAL_DIR.resolve() base.mkdir(parents=True, exist_ok=True) candidate = (base / f"{safe_date}.json").resolve() if candidate.parent != base: raise ValueError("Manual-data path escapes the allowed directory") return candidate ``` 3. Apply the same validation to every date-derived cache or report filename, even where current date parsing happens indirectly. 4. Reject all absolute paths, directory separators, parent-directory components, and noncanonical dates before filesystem access. 5. Consider protection against symbolic-link attacks when the workspace may be writable by untrusted users. Use controlled file creation, atomic replacement, restrictive permissions, and platform-appropriate no-follow semantics. 6. Add automated tests covering: - Absolute path input - `../` traversal - Nested path separators - Invalid and noncanonical dates - Leap-year and impossible calendar dates - Symlinks inside the manual-data directory - Attempts to read, overwrite, or delete files outside `MANUAL_DIR` ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (14)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · EXAMPLES.md (reported line 195)May include surrounding context.

bash
# 清理所有缓存
rm -rf cache/*

# 清理特定日期的缓存
rm cache/2026-03-22.json

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · EXAMPLES.md (reported line 198)May include surrounding context.

rm -rf cache/*

清理特定日期的缓存

rm cache/2026-03-22.json

text

---

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents all operational instructions, examples, and usage guidance exclusively in Chinese. The stated policy flags language or locale constraints when a skill effectively forces a specific language without user opt-in or a documented justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This is a markdown file, so SQP-2 applies to missing user warnings in documentation. The section shows irreversible cache deletion commands, including rm -rf cache/*, but provides no caution that files will be permanently removed or that users should verify the target path first.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level documentation states that index levels, percentage changes, and up/down counts are 'automatically fetched'. However, the actual retrieval functions are stubbed out: fetch_with_browser returns an empty string and both fetch_index_data and fetch_sentiment_data return placeholder error values indicating browser calls are not implemented. This is an active contradiction between documentation and behavior, not merely missing detail.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module docstring is entirely in Chinese and provides the skill's user-facing description and behavior notes only in that language. This imposes a locale choice without offering an alternative language or documenting a region-specific constraint, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script directly embeds the raw user-supplied query into a URL for an external service and then emits that URL for downstream fetching, with no notice that the input will be transmitted off-host. In this skill context, users may provide sensitive market queries, account-related terms, or proprietary research keywords, so silent exfiltration to a third-party website creates a real privacy and data-handling risk even though this is not code execution.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains user-facing natural-language content such as the module docstring, CLI description, examples, and parameter explanations entirely in Chinese. Per 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

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations. This file consistently presents all user-facing instructions in Chinese without offering an opt-in, alternative language, or explicit justification that the skill is intended only for Chinese-speaking users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file includes a command to clear previously supplemented data, which is a destructive action affecting user-maintained data. The surrounding documentation does not warn that the action deletes stored data or that it may be irreversible.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The display name, description, keywords, and categories are entirely in Chinese, indicating the skill is presented in a fixed language/locale. The file does not mention any user opt-in, language selection, or explicit region-specific justification that would exempt this from the language/locale policy check.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The description, keywords, and categories are entirely in Chinese, which imposes a specific language on users without any stated opt-in or documented locale constraint. Under the policy, natural-language content should not force a language unless the regional/language limitation is explicit and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script’s description, usage examples, and runtime messages are presented only in Chinese. This can constitute a language-policy issue when a skill forces a specific language without documenting that constraint or offering the user an alternative.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The module docstring is entirely in Chinese and provides no indication that other languages are supported or that the language restriction is intentional for a region-specific workflow. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.