Back to skill

Security audit

Skill Manager

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent skill manager, but it can persistently change multiple agent skill directories and its migration script can delete conflicting local skill folders without a real backup.

Review this carefully before installing. Use dry-run modes first, back up ~/.skills and agent skill folders yourself, inspect agents.yaml and each meta.yaml scope, and avoid running the migration script on directories containing local or uncommitted skill work until conflict handling is improved.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/migrate_to_hub.sh:142
Finding

Destructive Duplicate Migration Can Irreversibly Delete Skill Contents

Content
View full analysis
"$BACKUP_DIR/skills_hub_before.txt" 2>/dev/null || true for dir in "${AGENT_SKILL_DIRS[@]}"; do if [[ -d "$dir" ]]; then agent_name=$(basename "$(dirname "$dir")") ls -la "$dir" > "$BACKUP_DIR/${agent_name}_skills_before.txt" 2>/dev/null || true fi done log_info "备份已保存到: $BACKUP_DIR" else log_dry "将创建备份目录: $BACKUP_DIR" fi ``` ```bash # 如果 hub 中已存在真实目录,跳过(保留先到的版本) if [[ -d "$hub_path" ]] && [[ ! -L "$hub_path" ]]; then log_warn " Hub 已存在 $skill_name (真实目录),跳过移动" # 仍然需要把 Agent 目录的替换为链接 if [[ ! -L "$agent_dir/$skill_name" ]]; then log_action " 删除 $agent_dir/$skill_name 并创建链接" if ! $DRY_RUN; then rm -rf "$agent_dir/$skill_name" ln -s "$hub_path" "$agent_dir/$skill_name" fi fi continue fi ``` ### Technical Analysis The migration script describes its initial phase as creating a backup, but it only records `ls -la` directory listings. These text files contain names and metadata, not the contents of the skills being migrated. When a real directory with the same skill name already exists in `~/.skills`, the script treats the Hub version as authoritative. It then executes `rm -rf` against the corresponding real directory in an Agent skill location and replaces it with a symlink. It does not: - Compare the contents of the two directories. - Preserve the discarded Agent version. - Merge divergent files. - Require explicit confirmation. - Verify that the Hub copy is trusted or complete. - Provide rollback data sufficient to restore deleted files. Quoting prevents str ...[truncated 1650 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/sync_skills.sh:110
Finding

Invalid or Missing Scope Metadata Fails Open to Universal Skill Distribution

Content
View full analysis
Remediation
View remediation
&2 return 1 fi ``` 2. Use a real YAML parser instead of regular expressions. 3. Validate that: - `scope` is present. - It is either exactly `universal` or a non-empty list. - Every listed identifier exists in the registered Agent configuration. 4. Treat malformed, empty, or unknown scope values as fatal synchronization errors for that skill. 5. Require an explicit `scope: universal`; never infer universal visibility. 6. Report invalid skills in the final error count and avoid creating or removing their links until corrected. 7. Add tests for missing files, absent fields, empty lists, inline YAML lists, malformed YAML, unknown Agent names, and explicit universal scope. ]]>
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (13)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

The script deletes entries in ~/.skills based on symlink-target pattern matching using readlink string checks, without canonicalizing paths or constraining deletion with stronger validation. If an attacker can place crafted symlinks in the hub, the script may remove unintended entries or operate on attacker-influenced filesystem objects during migration.

Content

Scanner excerpt · scripts/migrate_to_hub.sh (reported line 102)May include surrounding context.

sh
if [[ "$target" == *"/.claude/"* ]] || [[ "$target" == *"/.cursor/"* ]] || [[ "$target" == *"/.codex/"* ]]; then
            log_action "删除旧反向链接: ~/.skills/$name -> $target"
            if ! $DRY_RUN; then
                rm "${SKILLS_HUB}/${name}"
            fi
        fi
    fi

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

The script performs rm -rf on agent skill directories whenever a same-named real directory already exists in the hub, with no confirmation, backup of contents, or merge safety. In the context of user-writable skill directories, this can destroy data or remove a legitimate local skill if the hub already contains a conflicting name, whether by mistake or by attacker prepositioning.

Content

Scanner excerpt · scripts/migrate_to_hub.sh (reported line 149)May include surrounding context.

sh
if [[ ! -L "$agent_dir/$skill_name" ]]; then
                log_action "  删除 $agent_dir/$skill_name 并创建链接"
                if ! $DRY_RUN; then
                    rm -rf "$agent_dir/$skill_name"
                    ln -s "$hub_path" "$agent_dir/$skill_name"
                fi
            fi

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
85% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · README.md (reported line 8)May include surrounding context.

md
## ❓ Why Skill Manager?

As you build or install more AI skills, you'll encounter several **pain points**:
- **Fragmentation**: Skills are scattered across hidden directories (`~/.cursor/rules`, `~/.claude/skills`, etc.), making them hard to find and manage.
- **Redundancy & Inconsistency**: Manually copying a skill to multiple agent folders leads to version drift. You update it for Cursor, but the Claude version remains stale.
- **Manual Overhead**: Setting up a new agent or project from scratch requires manually linking or copying dozens of skills.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
85% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · SKILL.md (reported line 62)May include surrounding context.

md
If the user says: "Make `skill-xyz` visible to Cursor", you edit `~/.skills/skill-xyz/meta.yaml` to add `cursor` to its scope, then run `sync_skills.sh`.

### 4. Auditing Skill Distribution
If the user asks "Which skills are available to Claude?", you can check the scope fields in the various `meta.yaml` files in `~/.skills/`, or simply list the contents of the `~/.claude/skills/` directory to see the symlinks.

## Handoff & Lifecycle Integration

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill directs the agent to execute a shell script that modifies the local environment by creating symlinks under agent directories, but it provides no requirement for user confirmation, no validation of the target paths, and no warning about side effects. In an agent setting, unattended execution of filesystem-changing commands increases the risk of unintended persistence, environment tampering, or abuse if the referenced script or skill directory contents are malicious or compromised.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
97% confidence
Finding

This instruction establishes session-persistent changes by creating symlinks in agent directories, causing the installed skill to remain available in future runs without additional approval. That persistence becomes dangerous because the skill is distributed across agents through a script, potentially broadening reach and enabling a compromised or unsafe skill to be automatically invoked later.

Content

Scanner excerpt · agents/provision_agent.md (reported line 24)May include surrounding context.

  • When in doubt, ask the user or default to universal.

3. Register & Distribute

Run the synchronization script to create the necessary symlinks in the agent directories:

bash
bash ~/.skills/skill-manager/scripts/sync_skills.sh

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/clawhub_distribution.md (reported line 41)May include surrounding context.

md
**Recommended Resolution Strategies:**
1. **Namespace Prefixing**: Use a personal or organization prefix (e.g., `ziwei-docker` or `usm-installer`).
2. **Local Overwrite Protection**: `skill-installer` will check for existing directories in `~/.skills/` before installing. If a local skill has the same name as a registry slug, it will prompt for a rename.

## 🛠 Integration into USM Ecosystem

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown schema documentation is written in Chinese and does not indicate that language selection is optional or that the file is intentionally limited to a Chinese-speaking audience. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/naming_conflict.md (reported line 6)May include surrounding context.

md
To prevent users from unintentionally creating skills with names that collide with existing or future official skills (e.g., `docker`, `git`, `search`), we propose the following multi-layered approach.

## 🎯 The Problem
In the USM 2-layer architecture (`~/.skills/`), all skills reside in the same flat directory. If a user creates a skill named `git` to manage their local commits, and then uses `skill-installer` to download an "official" `git` skill from SkillHub, one will overwrite the other, or the symlinks will collide.

## 💡 Proposed Solutions

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s natural-language comments and usage text are written in Chinese, and later runtime log messages are also Chinese-only, which imposes a specific language on users without any opt-in or alternative. Under the policy, language constraints should be optional or explicitly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Operational warnings, progress messages, and completion notices emitted by the script are all Chinese-only. This creates a language policy issue because the script does not offer a language choice or explain why a Chinese-only interface is required.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/migrate_to_hub.sh (reported line 73)May include surrounding context.

sh
log_info "=== 阶段 0:创建备份 ==="

if ! $DRY_RUN; then
    mkdir -p "$BACKUP_DIR"
    # 备份当前 ~/.skills/ 的链接状态
    ls -la "$SKILLS_HUB" > "$BACKUP_DIR/skills_hub_before.txt" 2>/dev/null || true
    for dir in "${AGENT_SKILL_DIRS[@]}"; do

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This shell script uses Chinese for its title, usage text, option descriptions, warnings, and status output, and nowhere indicates that the skill is intentionally region-specific or that users can opt into another language. Under the policy for natural-language constraints, forcing a specific language without opt-in is a locale/language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.