Back to skill

Security audit

数字员工管理

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for managing persistent sub-agents, but it needs review because it writes durable agent memory, injects it into future sub-agents, and uses user-provided role names in file and shell operations without clear safeguards.

Install only if you are comfortable with a skill that creates and edits persistent role-memory files, reads shared project/team knowledge, and spawns sub-agents. Before use, restrict role names to safe identifiers, keep memory files reviewable, avoid storing secrets or instruction-like content in memory, and confirm or audit automatic memory updates.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • 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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:45
Finding

Unvalidated Role Names May Enable Path Traversal or Shell Command Injection

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:45-50, SKILL.md:56-62, and SKILL.md:120-124; related input format in TEMPLATE.md:6-9
Vulnerability Type: Improper validation of user-controlled filesystem and command input
Risk Level: High

Vulnerable Code Snippets

SKILL.md:45-50:

text
创建角色 {角色名}: {核心职责描述}
text
会在 `workspace/agents/{角色名}/` 下自动创建:
- `profile.md` - 角色设定
- `memory.md` - 长期记忆
- `current.md` - 当前状态

SKILL.md:56-62:

text
启动 {角色名}
启动 {角色名} 执行 {任务描述}
text
1. 解析角色名(支持别名匹配)
2. 检查 `agents/{角色}/` 是否存在

SKILL.md:120-124:

text
本 skill 内部使用:

- `exec ls` - 检查角色目录是否存在
- `exec mkdir` - 创建角色目录
- `read/write` - 读写记忆文件

TEMPLATE.md:6-9:

text
## 命令格式

创建角色 {角色名}: {核心能力}; {工作风格}; {偏好}; {注意事项}

text

Technical Analysis

The skill accepts a role name from a user command and incorporates that value into a path below workspace/agents/. It also explicitly instructs the agent to use shell-backed exec ls and exec mkdir operations when checking and creating role directories.

The documented process does not require any of the following safeguards:

  • A strict allowlist for role-name characters.
  • Rejection of absolute paths or .. traversal components.
  • Canonical-path validation against the intended workspace/agents root.
  • Shell-safe argument handling.
  • Use of structured filesystem operations instead of command-string construction.

If an implementation directly concatenates the supplied role name into a shell command, shell metacharacters could introduce additional commands. Even where shell metacharacters are safely quoted, directory separators and traversal components could cause reads or writes outside the intended role directory.

The exact exploitability depends on how the runtime translates these natural-language instructions into tool calls. The unsafe data flow is nevertheless ...[truncated 1742 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict role names to a short identifier allowlist, such as ^[A-Za-z0-9_-]{1,64}$.
  2. Reject empty names, . and .., path separators, absolute paths, control characters, whitespace, command substitutions, redirection operators, and shell metacharacters.
  3. Resolve the candidate directory to a canonical path and verify that it remains a descendant of the canonical workspace/agents directory.
  4. Use structured filesystem APIs for existence checks and directory creation rather than exec ls and exec mkdir.
  5. If command execution is unavoidable, pass arguments as an array without invoking a shell. Do not interpolate the role name into a command string.
  6. Apply the same validation to aliases loaded from ROLES.md; aliases must not bypass role-name restrictions.
  7. Refuse reads or writes involving symbolic links that resolve outside the approved workspace.
  8. Add negative tests covering ../, absolute paths, separators, command substitutions, redirection, quotes, newlines, and symbolic-link escapes.

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:64
Finding

Persistent Untrusted Memory Is Injected into Future Sub-Agents

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:64-73 and SKILL.md:81-84
Vulnerability Type: Persistent prompt injection through agent memory
Risk Level: High

Vulnerable Code Snippets

SKILL.md:64-73:

text
4. **存在** → 读取记忆文件:
   - `agents/{角色}/profile.md`
   - `agents/{角色}/memory.md`
   - `agents/{角色}/current.md`
   - `knowledge/project.md`
   - `knowledge/team.md`
5. 创建子 agent 并注入记忆
6. 任务完成后自动更新记忆

SKILL.md:81-84:

text
### 5. 更新角色记忆

{角色名} 记住 {内容}

text

Technical Analysis

The skill provides a command that stores user-supplied content in a role's persistent memory. When that role is launched later, the skill reads the stored memory and injects it into a newly spawned sub-agent. It also automatically updates memory after task completion.

No control is specified to distinguish trusted role configuration from untrusted historical data. The skill does not require provenance tracking, content validation, instruction/data separation, user review, or confirmation before injecting persistent content into a sub-agent.

Consequently, an attacker can store instruction-like content in memory.md. A future sub-agent may interpret that content as authoritative instructions rather than passive data. Because the content is persistent, the attack can affect later tasks and sessions after the original interaction has ended.

Automatic memory updates create an additional propagation path: compromised output or task context can be summarized back into persistent memory without review, allowing malicious instructions to survive and repeatedly influence future sub-agents.

Attack Path

  1. An attacker invokes the memory-update command for an existing role.
  2. The attacker supplies content written as instructions, such as directions to ignore future task constraints, disclose accessible context, or invoke tools for an unrelated purpose.
  3. The skill stores the content in ...[truncated 1452 chars]
Remediation
View remediation

Remediation Suggestions

  1. Treat all memory content as untrusted data, never as executable instructions.
  2. Store memory in a structured schema containing facts, timestamps, provenance, author identity, confidence, and expiration rather than unrestricted Markdown.
  3. Separate immutable role policy from user-editable memory. Persistent memory must not be able to override system, developer, safety, or current-task instructions.
  4. Delimit and label injected memory explicitly, instructing the sub-agent that quoted memory is reference data and may contain malicious instructions.
  5. Validate new memory entries and reject content that attempts to direct tool usage, override constraints, request secrets, or define future behavioral rules.
  6. Require explicit user review and confirmation before persisting free-form content or automatic task summaries.
  7. Show the relevant memory to the user before launching a role when an entry is new, untrusted, or instruction-like.
  8. Apply provenance-aware trust levels and allow only trusted administrators to change role policy or long-term behavioral rules.
  9. Provide memory inspection, rollback, deletion, and audit-log capabilities.
  10. Prevent automatic updates from copying raw sub-agent output into memory; extract narrowly defined facts and sanitize them before storage.
  11. Limit sub-agent tools and data access according to least privilege so memory poisoning cannot reach unrelated project resources.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (2)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger phrases are broad enough that ordinary conversation about managing or starting roles could unintentionally activate the skill. In this skill, activation can lead to file reads/writes and spawning sub-agents, so accidental invocation may cause unintended data access or state changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill automatically reads and writes memory files and updates role mappings without a clear, centralized warning that user/project data will be accessed and modified. Because it manages persistent state across agents, insufficient disclosure increases the risk of users unknowingly exposing sensitive context or authorizing unintended changes.

Content

No source excerpt is available for this finding.