Back to skill

Security audit

skill-expert-skills

Security checks for vulnerabilities and agentic risk

Overview

The skill largely does what it claims, but its packaging script can accidentally include files outside the chosen skill folder, so it needs review before use.

Review this before installing if you plan to package skills from untrusted or shared directories. Avoid running the packager on skill folders containing symlinks, inspect the file list before distributing archives, and prefer a virtual environment with pinned dependencies. The write and bash permissions are expected for a skill-building tool, but they should be used only on directories you intentionally provide.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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

Warning
Location
scripts/package_skill.py:114
Finding
Skill Packager Can Disclose Files Outside the Selected Directory Through Symbolic Links## Vulnerability Details **File Location**: `scripts/package_skill.py:114-118` **Vulnerability Type**: Symbolic-link dereferencing and insufficient archive boundary validation **Risk Level**: Medium ### Vulnerable Code ```python files = [p for p in skill_path.rglob('*') if p.is_file() and not _should_exclude(p)] for file_path in sorted(files): # Calculate the relative path within the zip arcname = file_path.relative_to(skill_path.parent) zipf.write(file_path, arcname) print(f" Added: {arcname}") ``` ### Technical Analysis The packager recursively selects entries for which `Path.is_file()` returns true. A symbolic link targeting a regular file can satisfy this test. The code does not call `is_symlink()` and does not verify that the resolved target remains under the resolved Skill directory. `file_path.relative_to(skill_path.parent)` validates only the lexical path used as the archive member name. It does not validate the location of the resolved file target. When `zipf.write()` opens the path, it can read the external target and store its contents under the symbolic link's apparent in-tree name. The existing validation functions do not reject symbolic links or scan the package for sensitive files. Consequently, successful structural validation does not mitigate this issue. ### Attack Path 1. An attacker supplies or modifies a Skill directory that otherwise passes structural validation. 2. The attacker creates an in-tree symbolic link, such as `references/report.md`, targeting a readable file outside the Skill directory. 3. A user runs `scripts/package_skill.py` against the affected Skill. 4. The symbolic link passes the `p.is_file()` filter. 5. `zipf.write()` reads the external target and adds its contents to the `.skill` archive as an apparently legitimate in-tree file. 6. The user distributes or uploads the archive, unintentionally disclosing the external file. ### Impact Assessment Ex ...[truncated 389 chars]
Remediation
## Remediation Suggestions 1. Reject symbolic links explicitly before packaging: ```python if file_path.is_symlink(): raise ValueError(f"Symbolic links are not permitted: {file_path}") ``` 2. Resolve every candidate and verify that it remains under the approved root: ```python root = skill_path.resolve() for file_path in sorted(skill_path.rglob("*")): if file_path.is_symlink(): raise ValueError(f"Symbolic links are not permitted: {file_path}") if not file_path.is_file() or _should_exclude(file_path): continue resolved = file_path.resolve(strict=True) try: resolved.relative_to(root) except ValueError: raise ValueError(f"File escapes skill directory: {file_path}") arcname = Path(skill_path.name) / file_path.relative_to(root) zipf.write(resolved, arcname) ``` 3. Reject symlinked directories as well as file symlinks, rather than relying on traversal behavior that may vary by runtime or implementation. 4. Add package-time checks for common sensitive artifacts such as `.env`, private keys, credential files, and hidden configuration files. 5. Present the complete package manifest and require confirmation before producing a distributable archive. 6. Add regression tests covering: - A symlink to an external regular file. - A symlink to an external directory. - Broken symbolic links. - Nested links. - Legitimate files whose names resemble excluded paths.

T08 · Insecure Dependencies

Note
Location
scripts/requirements.txt:1
Finding
Dependency Installation Is Not Reproducible or Hash-Verified## Vulnerability Details **File Location**: `scripts/requirements.txt:1` **Related Installation Instructions**: `QUICK_NAVIGATION.md:233-243` **Vulnerability Type**: Unbounded dependency version and missing integrity verification **Risk Level**: Low ### Vulnerable Code ```text PyYAML>=6.0 ``` The documented installation process executes: ```bash pip install -r scripts/requirements.txt ``` ### Technical Analysis The lower-bound-only requirement permits pip to install any current or future PyYAML version satisfying `>=6.0`. As a result, the installed dependency may differ from the version reviewed or tested with this project. No lock file, exact version constraint, package hash, or `--require-hashes` control is provided. This makes installations non-reproducible and allows newly published dependency artifacts to enter the execution environment without repository changes or additional review. PyYAML is a legitimate dependency, and the project correctly uses `yaml.safe_load()` in its validator. There is no evidence of typosquatting, dependency confusion, or a currently malicious package. The finding concerns future supply-chain drift and absent artifact-integrity controls. ### Attack Path 1. A user follows the documented `pip install -r scripts/requirements.txt` instruction. 2. pip queries the configured package index and selects a version satisfying `PyYAML>=6.0`. 3. The selected artifact may be newer than the version tested or audited by the project. 4. If the package index, account, release artifact, or future dependency version is compromised, malicious installation or runtime behavior executes with the privileges of the user running pip. 5. The compromised dependency can subsequently affect every project script that imports `yaml`. ### Impact Assessment A compromised dependency would execute with the permissions of the Python environment and the invoking user. Depending on the environment, this could ...[truncated 221 chars]
Remediation
## Remediation Suggestions 1. Pin PyYAML to a specific reviewed version: ```text PyYAML==6.x.y ``` 2. Generate and commit a lock file containing cryptographic hashes for approved artifacts. 3. Install dependencies with hash enforcement, for example: ```bash python -m pip install --require-hashes -r scripts/requirements-lock.txt ``` 4. Review and update the pinned version through a controlled dependency-update process. 5. Run dependency vulnerability scanning in continuous integration. 6. Retain the documented virtual-environment recommendation so installation does not modify the global Python environment. 7. Where practical, configure trusted package indexes explicitly and avoid unreviewed extra indexes.
Vulnerability Patterns
  • 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
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (87)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The code chunk’s actual function is limited to trigger-description analysis for an existing SKILL.md file. It parses frontmatter, reads the description field, computes keyword/category coverage, assigns a score, and prints suggestions for better triggering. That is only a small subset of 'optimizing' a skill description, and it does not substantiate the much broader declared purpose of creating, validating, and packaging AI Agent Skills with a mandatory 6-phase process. The primary purpose is therefore materially narrower and different from the declaration.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The declared description describes a full-featured skill lifecycle tool with mandatory multi-phase reasoning, creation, optimization, validation, and packaging capabilities. The supplied code only analyzes a single SKILL.md file for frontmatter/spec compatibility and formatting constraints, then emits a report. It is a validation sub-tool at most, not a complete skill-creator/optimizer/packager. There is no implementation of the stated phases, no generation or modification of skills, no packaging/distribution behavior, and no broader workflow orchestration. Therefore the description materially overstates and misrepresents the code's actual purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The description promises a broad skill for creating, optimizing, validating, and packaging AI Agent Skills using a mandatory six-phase process with quality gates. The actual code chunk only performs initial scaffolding for a new skill directory and template files. Its primary purpose is narrow bootstrapping: validate a hyphen-case skill name, create directories, generate placeholder content, and print next steps. There is no evidence of requirement mining, knowledge acquisition, validation of skill structure/content, packaging/distribution, user confirmation, or self-reflection logic. While creating a new skill is one subset of the declared purpose, the code materially underdelivers relative to the description and lacks most of the claimed capabilities.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The supplied code only packages an existing skill directory into a .skill archive after checking that the directory exists, contains SKILL.md, and passes two validation functions. It excludes common transient files and writes a zip archive. This does align with one subset of the description—packaging and some validation—but it does not implement the broader declared purpose of creating, optimizing, and comprehensively managing skills via the stated 6-phase workflow. Because the description presents a much broader primary purpose and mandatory workflow than the code actually performs, this is a material description-behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared description promises an end-to-end skill creation/optimization/validation/packaging process with a specific six-phase methodology. The actual code only performs quick validation and scoring of an existing skill package, mainly focused on SKILL.md/frontmatter checks and lightweight quality diagnostics. Validation is one subset of the declared scope, but major claimed functions—creation, deep optimization workflow, packaging/distribution, and the mandatory multi-phase process—are absent from the code. This is a material description-to-behavior mismatch rather than a minor implementation detail.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared description describes a process-oriented skill for creating, optimizing, validating, and packaging skills via a six-phase workflow. The actual code does none of that authoring or validation workflow. Instead, it performs skill discovery: recursively scans a directory, reads SKILL.md files, parses frontmatter, searches content by keyword/regex, scores matches, and prints a ranked list. This is a materially different primary purpose, not merely a supporting implementation detail of skill creation. No code implements the stated phases, quality gates, packaging, or user-confirmation workflow. Therefore the description does not accurately represent the behavior of the supplied code.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The description claims a broad, multi-phase system for creating, optimizing, validating, and packaging AI Agent Skills. The actual code chunk only implements one small validation script focused on detecting project-specific path references and UTF-8 portability issues in text files. While validation is one subset of the declared scope, the primary behavior shown is far narrower and does not evidence the mandatory 6-phase workflow or the other major capabilities like creation, optimization, packaging, or user confirmation. Therefore the description materially overstates and misrepresents what this code chunk actually does.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The declared description presents a broad skill-authoring system that creates, optimizes, validates, and packages skills using a strict 6-phase methodology. The supplied code is much narrower: it is a single Python CLI utility focused on auditing an existing SKILL.md for missing best-practice elements and reporting suggestions. It can validate some structural/documentation aspects and supports optimization guidance, so there is partial overlap with 'optimizing' and 'validating' an existing skill. However, the primary purpose is materially different because the code neither creates new skills nor packages/distributes them, and it does not implement the mandatory multi-phase workflow described. Therefore the description overstates and misrepresents the actual behavior.

Self-Modification

High
Category
Rogue Agent
Content
Phase 0: Classify task → Generate hypotheses → [Fast Track?] → User confirms
  Phase 1: 5 Whys → Skill Type → Validate requirements → User confirms
  Phase 2: Research domain → 4-Layer knowledge gate
  Phase 3: Select template → Write SKILL.md → Conciseness check
  Phase 4: Structural validation → Portability check → User confirms
  Phase 5: Self-reflect → Precipitate knowledge
Confidence
85% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Self-Modification

High
Category
Rogue Agent
Content
Phase 0: Classify → Hypothesize what to improve → [Fast Track?] → User confirms
  Phase 1: 5 Whys on current pain points → User confirms
  Phase 2: Research latest patterns → 4-Layer gate
  Phase 3: Modify SKILL.md → Conciseness check
  Phase 4: Validate → User confirms
  Phase 5: Self-reflect → Document changes
Confidence
85% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Ae1

High
Category
analysis-evasion
Content
**Required**: Updated `SKILL.md` + change summary (triggers, domains, validation results)
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Credential Access

High
Category
Privilege Escalation
Content
| **不处理错误边界** | 整个应用崩溃 | 使用 Error Boundary |
| **内存泄漏** | 性能下降 | 清理订阅、定时器、事件监听器 |
| **XSS 风险** | 注入攻击 | 避免直接插入 HTML,使用 React/DOM API |
| **硬编码环境变量** | 部署困难 | 使用 .env 文件 |

---
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Self-Modification

High
Category
Rogue Agent
Content
Step 4: Cross-validate key findings (2+ sources)
Step 5: Resolve conflicts (prefer official + newer sources)
Step 6: Pass expert self-check
Step 7: Proceed to write SKILL.md
```

**Note**: For simple skills where the domain is well-understood, Steps 3-5 can
Confidence
85% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

External Script Fetching

High
Category
Supply Chain
Content
- 读取敏感信息:SSH 密钥目录(私钥/公钥/known_hosts)、环境变量、浏览器 cookie、各类密钥目录等
- 外部网络请求到未知域名,且无解释/无开关
- 动态执行:`eval()`、动态下载执行脚本、`curl | sh` 类行为
- 修改系统级文件(hosts、shell profile、系统服务)或要求管理员权限
- `allowed-tools` 过宽,缺少最小权限意识(尤其写文件/执行命令/网络)
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
- 读取敏感信息:SSH 密钥目录(私钥/公钥/known_hosts)、环境变量、浏览器 cookie、各类密钥目录等
- 外部网络请求到未知域名,且无解释/无开关
- 动态执行:`eval()`、动态下载执行脚本、`curl | sh` 类行为
- 修改系统级文件(hosts、shell profile、系统服务)或要求管理员权限
- `allowed-tools` 过宽,缺少最小权限意识(尤其写文件/执行命令/网络)
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Self-Modification

High
Category
Rogue Agent
Content
```bash
python scripts/init_skill.py my-skill --path .claude/skills
# Edit SKILL.md
python scripts/quick_validate.py .claude/skills/my-skill
python scripts/universal_validate.py .claude/skills/my-skill
python scripts/analyze_trigger.py .claude/skills/my-skill
Confidence
85% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Self-Modification

High
Category
Rogue Agent
Content
```bash
python scripts/init_skill.py my-skill --path .claude/skills
# Edit SKILL.md
python scripts/quick_validate.py .claude/skills/my-skill
python scripts/universal_validate.py .claude/skills/my-skill
python scripts/analyze_trigger.py .claude/skills/my-skill
Confidence
85% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Self-Modification

High
Category
Rogue Agent
Content
```bash
python scripts/init_skill.py my-skill --path .claude/skills
# Edit SKILL.md
python scripts/quick_validate.py .claude/skills/my-skill
python scripts/universal_validate.py .claude/skills/my-skill
python scripts/analyze_trigger.py .claude/skills/my-skill
Confidence
85% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Agent Config Directory Access

High
Category
Agent Snooping
Content
mkdir -p .claude/skills/my-skill

# 创建最小 SKILL.md
cat > .claude/skills/my-skill/SKILL.md << 'EOF'
---
name: my-skill
description: Brief description of what this skill does and when to use it.
Confidence
85% confidence
Finding
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Agent Config Directory Access

High
Category
Agent Snooping
Content
mkdir -p .claude/skills/my-skill

# 创建最小 SKILL.md
cat > .claude/skills/my-skill/SKILL.md << 'EOF'
---
name: my-skill
description: Brief description of what this skill does and when to use it.
Confidence
85% confidence
Finding
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Agent Config Directory Access

High
Category
Agent Snooping
Content
1. **检查 description 覆盖度**
   ```bash
   # 查看 description 内容
   head -20 .claude/skills/my-skill/SKILL.md
   ```

2. **对比用户说法与 description**
Confidence
85% confidence
Finding
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Agent Config Directory Access

High
Category
Agent Snooping
Content
1. **检查 description 覆盖度**
   ```bash
   # 查看 description 内容
   head -20 .claude/skills/my-skill/SKILL.md
   ```

2. **对比用户说法与 description**
Confidence
85% confidence
Finding
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Agent Config Directory Access

High
Category
Agent Snooping
Content
python scripts/universal_validate.py .claude/skills/my-skill/

# 检查裸链接
grep -rn "http[s]*://" .claude/skills/my-skill/ | grep -v "\[.*\](http"

# 检查无语言标记的代码块
grep -n "^\`\`\`$" .claude/skills/my-skill/SKILL.md
Confidence
85% confidence
Finding
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Agent Config Directory Access

High
Category
Agent Snooping
Content
grep -rn "http[s]*://" .claude/skills/my-skill/ | grep -v "\[.*\](http"

# 检查无语言标记的代码块
grep -n "^\`\`\`$" .claude/skills/my-skill/SKILL.md
```
Confidence
85% confidence
Finding
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Lp1

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding
The skill uses 'network' capability that is not listed in its permissions. This may indicate deceptive intent or missing permission declarations.

Static analysis

No suspicious patterns detected.