Back to skill

Security audit

多 Agent 项目协作工厂

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent project-scaffolding skill, but its generator can recursively delete an arbitrary existing directory if given an unsafe path and overwrite is confirmed.

Install only if you are comfortable reviewing or hardening the generator first. Run it from an isolated workspace, pass only a simple new directory name, and do not confirm overwrite for any path you have not resolved and verified. The skill does not show exfiltration or persistence, but the deletion behavior needs attention.

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/generate-project.py:124
Finding
Unrestricted Project Path Allows Arbitrary Recursive Directory Deletion## Vulnerability Details **File Location**: `scripts/generate-project.py`, lines 124–139 **Vulnerability Type**: Unvalidated path used in recursive deletion **Risk Level**: High ### Vulnerable Code ```python # 获取项目目录 if len(sys.argv) > 1: project_name = sys.argv[1] else: project_name = input("请输入项目名称: ").strip() if not project_name: print("❌ 项目名称不能为空") sys.exit(1) project_dir = Path.cwd() / project_name # 检查目录是否已存在 if project_dir.exists(): response = input(f"⚠️ 目录 {project_name} 已存在,是否覆盖?(y/N): ") if response.lower() != 'y': print("操作已取消") sys.exit(0) shutil.rmtree(project_dir) ``` ### Technical Analysis The script accepts `project_name` from a command-line argument or interactive input and uses it directly to construct `project_dir`. It does not require the value to be a simple project name or reject absolute paths, parent-directory traversal components such as `..`, or path separators. With `pathlib`, joining `Path.cwd()` to an absolute user-supplied path selects the absolute path. A relative value containing `..` can likewise resolve outside the current working directory. If that destination exists and the overwrite prompt is confirmed, `shutil.rmtree(project_dir)` recursively removes the selected directory. The confirmation prompt reduces the likelihood of accidental exploitation but does not establish a security boundary. It presents the unvalidated input rather than enforcing and clearly displaying a canonical path confined to an approved project root. The deletion behavior is therefore not limited to directories created or managed by this script. ### Attack Path 1. An attacker, unsafe wrapper, or copied command supplies a traversal or absolute path as the project name, for example: ```bash python scripts/generate-project.py ../valuable-directory ``` 2. The script constructs a destination outside the intended current-directory scope. 3. The external destination already exists, c ...[truncated 924 chars]
Remediation
## Remediation Suggestions 1. Treat the input as a project name rather than an arbitrary path. Reject absolute paths, `.` and `..` components, path separators, empty names, and platform-specific drive or UNC path syntax. 2. Define an explicit, trusted output root and resolve both the root and candidate destination before performing filesystem operations. 3. Verify that the resolved destination is a direct child of the trusted root. Do not rely on string-prefix comparisons; use path-aware containment checks. 4. Refuse to delete filesystem roots, the current working directory, the trusted output root itself, home directories, or any destination outside the approved root. 5. Avoid recursive deletion by default. Prefer failing when a destination exists or require the user to select a new project name. 6. If overwrite support is necessary, display the fully resolved canonical path and require an explicit confirmation that cannot be bypassed by a generic affirmative response. 7. Consider only deleting a directory if it contains a trusted marker proving that it was previously generated by this tool. 8. Add automated tests covering absolute paths, parent traversal, nested paths, symbolic links, filesystem roots, and existing unrelated directories. A hardened validation pattern could resemble: ```python output_root = Path.cwd().resolve() project_name = project_name.strip() candidate_name = Path(project_name) if ( not project_name or candidate_name.is_absolute() or len(candidate_name.parts) != 1 or project_name in {".", ".."} ): raise ValueError("Project name must be a single safe directory name") project_dir = (output_root / project_name).resolve() if project_dir.parent != output_root: raise ValueError("Project directory must be a direct child of the output root") if project_dir.exists(): raise FileExistsError( f"Destination already exists; choose another project name: {project_dir}" ) ```
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (8)

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill describes capabilities that generate project files and references a script that creates a project template, but it does not declare any explicit tool scope such as allowed file-write permissions. In an agent environment, missing tool scoping weakens least-privilege controls and can cause the skill to write files unexpectedly or more broadly than users realize.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The description and instructions throughout the skill are presented in Chinese, which effectively imposes a specific language on users without an explicit opt-in or alternative. Under SQP-3, forcing a specific language without user choice is a natural-language policy violation unless the constraint is clearly documented and justified.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The skill advertises one-click project generation, complete code output, and automatic creation of directories and artifacts, but it does not warn users that files will be written to disk. This can lead to surprising filesystem changes, accidental overwrites, or users invoking the skill without understanding that persistent artifacts will be created.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
This Python file contains user-facing natural-language strings entirely in Chinese, including the script description and all prompts/messages. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified, which is not present here.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The file’s comments and placeholder text are entirely in Chinese, including user-facing guidance such as project descriptions and goals. This imposes a specific language on users without any opt-in, alternative locale, or documented reason that the skill is region-specific.

Natural-Language Policy Violations

Low
Confidence
98% confidence
Finding
All user-facing instructions in this file are presented in Chinese, and the guide does not indicate that users may choose another language or that the locale restriction is intentional. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Missing User Warnings

Low
Confidence
93% confidence
Finding
This markdown file states that Hermes will automatically create tasks, assign agents, begin parallel execution, and save all outputs in `outputs/`. Because the skill description documents file-producing behavior but does not explicitly warn users that running it will generate project files and artifacts on disk, it lacks a user-facing disclosure about a potentially user-impacting operation.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
This markdown file is entirely written in Chinese and instructs the user to invoke the skill using a Chinese prompt, with no indication that other languages are supported or that Chinese is optional. Under the policy rule for natural-language violations, this is a locale/language constraint presented without user opt-in or justification.

Static analysis

No suspicious patterns detected.