Back to skill

Security audit

AI木工大师

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Chinese woodworking guide, but its bundled report script contains an undisclosed custom output option that can overwrite arbitrary writable local files.

Review before installing if you use shared or important workspaces. The skill appears focused on woodworking and does not show network, credential, or persistence behavior, but its report generator should be run only with trusted arguments and preferably after removing or constraining the --output option to prevent accidental file overwrite.

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

Warning
Location
scripts/generate_report.py:536
Finding
Unrestricted Arbitrary File Overwrite Through the Output Path## Vulnerability Details **File Location**: `scripts/generate_report.py`, lines 536–538; file writes occur at lines 544–546, 551–553, and 562–564 **Vulnerability Type**: Arbitrary file overwrite due to an unrestricted output path **Risk Level**: Medium **Vulnerable code:** ```python if "--output" in args: idx = args.index("--output") output_path = args[idx + 1] args = [a for i, a in enumerate(args) if i not in (idx, idx+1)] ``` The attacker-controlled path is subsequently used by all report-generation modes: ```python if mode == "--index": html = make_full_index() with open(output_path, 'w', encoding='utf-8') as f: f.write(html) ``` ```python elif mode == "--detail": if topic in KNOWLEDGE_DATA: html = make_detail_report(topic) with open(output_path, 'w', encoding='utf-8') as f: f.write(html) ``` ```python elif mode == "--general": if topic in GENERAL_TOPICS: html = make_general_report(topic) with open(output_path, 'w', encoding='utf-8') as f: f.write(html) ``` ### Technical Analysis The undocumented `--output` argument accepts an arbitrary absolute or relative filesystem path. The code performs no path normalization, directory confinement, filename-extension validation, symlink rejection, or overwrite confirmation. The selected path is passed directly to `open()` with mode `'w'`. If the target already exists, Python truncates it before writing the generated HTML. Consequently, a caller who can influence command-line arguments can replace any file writable by the process. This behavior exceeds the documented workflow in `SKILL.md`, which states that the report is written to `woodworking_report.html` in the current working directory. Although the generated content is static woodworking HTML and the code does not elevate privileges, the unrestricted destination creates a destructive local-file pr ...[truncated 1620 chars]
Remediation
## Remediation Suggestions 1. Remove `--output` if custom destinations are not required and always write to a fixed report filename in an approved directory. 2. If custom filenames are required, accept only a basename rather than a complete path. 3. Resolve the destination using `pathlib.Path.resolve()` and verify that it remains inside a dedicated report directory. 4. Reject absolute paths, `..` traversal components, non-HTML extensions, and directory targets. 5. Reject symlink destinations or open files using platform-appropriate no-follow protections. 6. Avoid silent truncation. Use exclusive creation mode (`'x'`) by default or require explicit overwrite confirmation. 7. Handle a missing value after `--output` and report a controlled argument-validation error. 8. Prefer `argparse` for robust command-line parsing and validation. 9. Add tests covering absolute paths, traversal attempts, symlinks, existing files, missing option values, and destinations outside the approved directory. Example confinement approach: ```python from pathlib import Path REPORT_DIR = (Path.cwd() / "reports").resolve() REPORT_DIR.mkdir(parents=True, exist_ok=True) requested_name = Path(user_value) if requested_name.is_absolute() or requested_name.name != user_value: raise ValueError("Output must be a filename without directory components") if requested_name.suffix.lower() != ".html": raise ValueError("Output filename must use the .html extension") output_path = (REPORT_DIR / requested_name.name).resolve() if output_path.parent != REPORT_DIR: raise ValueError("Output path escapes the report directory") with output_path.open("x", encoding="utf-8") as report_file: report_file.write(html) ```
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill instructs the agent to run a script and write an HTML file, but it does not declare any tool scope such as allowed tools or permissions. This creates a mismatch between documented capabilities and actual behavior, increasing the chance of unintended file creation or broader tool use without clear policy constraints.

Vague Triggers

Medium
Confidence
91% confidence
Finding
The trigger conditions include broad phrases like general woodworking learning and recommendation requests, which can cause the skill to activate for loosely related conversations. Overbroad activation can lead to unnecessary tool use, unwanted file generation, or responses that override a more appropriate skill or baseline assistant behavior.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The instruction '推荐适合中国市场的工具品牌和购买渠道' hard-codes a locale-specific recommendation policy. This can violate language/locale policy because the skill does not ask for the user's region or offer alternatives for users outside China.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file-level description and all generated content are explicitly Chinese-language, and the HTML template fixes the page locale to Chinese. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the tool is clearly justified as region-specific, which is not documented here.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
The HTML template enforces a Chinese locale for all reports. Because the skill does not expose any language selection or explain a required region-specific constraint, this is a natural-language locale policy issue rather than a purely technical setting.

Missing User Warnings

Low
Confidence
95% confidence
Finding
The skill explicitly says it will write an HTML report to the current working directory, but it does not require informing the user or obtaining consent before creating a file. Silent file creation can surprise users, clutter shared workspaces, or overwrite expected artifacts depending on runtime behavior.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
This markdown file is natural-language content, so SQP-3 applies. The title and the overwhelming majority of the document force Chinese as the operating language for the skill content, while only adding English glosses, and there is no user opt-in or statement that the skill is intentionally region- or language-specific.

Static analysis

No suspicious patterns detected.