Back to skill

Security audit

AI Employee Team

Security checks for vulnerabilities and agentic risk

Overview

This skill is not clearly malicious, but it needs Review because its local file handling can escape its intended folders and copy local files.

Install only if you are comfortable with a rough local prototype that writes persistent employee and memory files. Treat employee role and template inputs as trusted-only until path validation is fixed, and avoid running it in a workspace where the Node process can read sensitive files or write outside the skill directory.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/employee-manager.js:53
Finding
Path Traversal Through Attacker-Controlled Employee Role<![CDATA[ ## Vulnerability Details **File Location**: `scripts/employee-manager.js`, lines 53-78 **Vulnerability Type**: Path traversal leading to unauthorized filesystem writes **Risk Level**: High ### Vulnerable Code ```javascript hire(config) { const { name, role, skills = [], model = 'gpt-4', template } = config; if (!name || !role) { throw new Error('员工名称和角色不能为空'); } const id = `${role.toLowerCase().replace(/\s+/g, '-')}-${Date.now()}`; const employee = { id, name, role, skills, model, status: 'idle', createdAt: new Date().toISOString(), currentTask: null, completedTasks: 0, memoryPath: `./memory/${id}` }; // 创建记忆目录 const memDir = path.join(MEMORY_DIR, id); if (!fs.existsSync(memDir)) { fs.mkdirSync(memDir, { recursive: true }); // 创建初始记忆文件 fs.writeFileSync( path.join(memDir, 'memory.md'), `# ${name} - 记忆存储\n\n创建时间: ${new Date().toISOString()}\n\n## 工作记录\n\n`, 'utf8' ); } ``` ### Technical Analysis The `role` field is incorporated directly into the employee identifier. The only transformation replaces whitespace with hyphens; path separators and traversal components such as `..` are not removed or rejected. The resulting identifier is passed to `path.join(MEMORY_DIR, id)` and then used by `fs.mkdirSync()` and `fs.writeFileSync()`. Because `path.join()` normalizes traversal components, a role containing sequences such as `../../` can cause the resolved directory to escape the intended `memory` directory. The timestamp suffix does not prevent traversal because it is appended after the attacker-controlled traversal components. This allows directory creation and creation of a fixed-name `memory.md` file at an unintended filesystem location. ### Attack Path 1. An attacker or untrusted caller invokes the `hire()` method or the corresponding CLI command. 2. The attacker supplies a role containing directory traversal components, such as `../../outside`. ...[truncated 894 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Generate employee identifiers independently of user-controlled fields, preferably with `crypto.randomUUID()`. - If the role must appear in an identifier, apply a strict allowlist such as ASCII letters, digits, underscores, and hyphens. - Reject values containing path separators, `.` or `..` path components, null bytes, and platform-specific separator characters. - Resolve and verify the final path before every filesystem operation: ```javascript const resolvedMemoryRoot = path.resolve(MEMORY_DIR); const resolvedEmployeeDir = path.resolve(MEMORY_DIR, safeId); if ( resolvedEmployeeDir === resolvedMemoryRoot || !resolvedEmployeeDir.startsWith(resolvedMemoryRoot + path.sep) ) { throw new Error('Invalid employee memory path'); } ``` - Run the process with minimum filesystem permissions so that a path-validation failure cannot modify sensitive operating-system locations. - Add automated tests covering traversal payloads with forward slashes, backslashes, repeated traversal components, absolute paths, and encoded or unusual separator characters. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/employee-manager.js:81
Finding
Arbitrary Local File Read Through Template Path Traversal<![CDATA[ ## Vulnerability Details **File Location**: `scripts/employee-manager.js`, lines 81-90 **Vulnerability Type**: Path traversal leading to unauthorized local file disclosure **Risk Level**: High ### Vulnerable Code ```javascript // 如果提供了模板,复制模板内容 if (template) { const templatePath = path.join(TEMPLATES_DIR, template); if (fs.existsSync(templatePath)) { const templateContent = fs.readFileSync(templatePath, 'utf8'); fs.writeFileSync( path.join(memDir, 'workflow.md'), templateContent, 'utf8' ); } } ``` ### Technical Analysis The public `hire(config)` method accepts a caller-controlled `template` value and joins it directly to `TEMPLATES_DIR`. The code does not constrain the value to a template filename, reject traversal components, or verify that the resolved path remains inside the template directory. A value containing `../` components can therefore escape `TEMPLATES_DIR`. If the resulting path exists and is readable by the Node.js process, `fs.readFileSync()` reads it as UTF-8 and copies its contents to `workflow.md`. This creates an unauthorized local file-read primitive. It may also be combined with the employee-role traversal vulnerability to influence where the copied contents are stored. No network transmission or automatic external exfiltration was identified in the audited project. ### Attack Path 1. An attacker obtains the ability to call the exported `EmployeeManager.hire()` method with a custom configuration object. 2. The attacker sets `template` to a traversal path targeting a readable local file, for example `../../sensitive-file`. 3. `path.join(TEMPLATES_DIR, template)` resolves outside the intended template directory. 4. `fs.existsSync()` confirms the external target exists. 5. `fs.readFileSync()` reads the target using the privileges of the Node.js process. 6. The application copies the file contents into the employee's `workflow.md`. 7. The attacker or another component with access to the emp ...[truncated 802 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Accept only template identifiers from an explicit allowlist rather than arbitrary filesystem paths. - Reduce the supplied value to a basename only if subdirectories are not required, and reject it when `path.basename(template) !== template`. - Resolve both the template root and candidate path, then enforce the directory boundary: ```javascript const templateRoot = path.resolve(TEMPLATES_DIR); const candidate = path.resolve(TEMPLATES_DIR, template); if (!candidate.startsWith(templateRoot + path.sep)) { throw new Error('Invalid template path'); } ``` - Prefer mapping logical template names to server-controlled paths: ```javascript const allowedTemplates = new Map([ ['boss', path.join(TEMPLATES_DIR, 'boss-ai.md')], ['product', path.join(TEMPLATES_DIR, 'product-ai.md')] ]); ``` - Use `fs.lstatSync()` and an appropriate symlink policy to prevent a symlink inside the template directory from pointing to a file outside it. - Validate that the candidate is a regular file and enforce a reasonable maximum file size before reading. - Restrict filesystem permissions for the runtime account so it cannot read unrelated secrets. - Add security tests for `../`, backslash traversal, absolute paths, symlink escapes, and oversized or non-regular files. ]]>
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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 (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The skill documentation appears to overstate implemented capabilities while omitting materially relevant behavior such as local filesystem read/write and archiving. That creates a trust and transparency problem: users may grant the skill broader access or rely on automation, monitoring, and reporting guarantees that do not actually exist, increasing the risk of unintended data handling or operational misuse.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The entire skill documentation, command guidance, and examples are presented only in Chinese, with no indication that other languages are supported or that the user can opt into this locale. Under the stated policy, a skill that effectively requires a specific language without user choice is a natural-language policy violation.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The document advertises persistent memory plus real-time monitoring/reporting without explaining what data is retained, for how long, where it is stored, or who can access it. In a collaboration/employee-tracking context, that can lead users to expose sensitive operational, personal, or proprietary information without informed consent or retention controls.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
User-facing comments, errors, logs, and CLI usage text are written in Chinese throughout the file, which effectively enforces a specific language for interaction. The file does not offer user opt-in, localization options, or documentation that this skill is intentionally limited to a Chinese-speaking context.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
This code path allows a user to invoke a potentially irreversible management action directly from the command line. Although the function logs after completion, there is no confirmation prompt or pre-execution warning before changing employee records and moving that employee's memory directory.

Natural-Language Policy Violations

Low
Confidence
94% confidence
Finding
Natural-language policy review applies to all file types. The user-facing content consistently forces a single language/locale experience, and there is no indication that the skill supports user language selection or that the Chinese-only constraint is intentional and justified for a region-specific use case.

Static analysis

No suspicious patterns detected.