ClawScan技能使用说明
2026-03-29
新闻来源:网淘吧
围观:20
电脑广告
手机广告
🛡️ SkillGuard — ClawHub 安全扫描器
"信任,但需验证。"
ClawHub 没有审核流程。任何代理都可以发布任何技能。SkillGuard 提供了缺失的安全层——在技能触及您的系统之前,扫描其中的危险模式、易受攻击的依赖项和可疑行为。
🚨 为何这很重要
第三方技能可能导致:
| 风险 | 影响 |
|---|---|
| 执行任意代码 | 系统完全被攻陷 |
| 访问您的文件系统 | 数据窃取、勒索软件 |
| 读取环境变量 | API 密钥被盗 ($$$) |
| 通过 HTTP 外传数据 | 隐私泄露 |
| 安装恶意依赖项 | 供应链攻击 |
| 植入后门程序 | 长期被攻陷 |
| 提升权限 | 获取根/管理员权限 |
一个恶意技能 = 游戏结束。
SkillGuard帮助您在安装前捕获威胁。
📦 安装
clawhub install clawscan
或手动安装:
git clone https://github.com/G0HEAD/skillguard
cd skillguard
chmod +x scripts/skillguard.py
要求
- Python 3.8+
clawhubCLI(用于远程扫描)
🚀 快速开始
# Scan a skill BEFORE installing
python3 scripts/skillguard.py scan some-random-skill
# Scan a local folder (your own skills or downloaded)
python3 scripts/skillguard.py scan-local ./path/to/skill
# Audit ALL your installed skills
python3 scripts/skillguard.py audit-installed
# Generate detailed security report
python3 scripts/skillguard.py report some-skill --format markdown
# Check dependencies for known vulnerabilities
python3 scripts/skillguard.py deps ./path/to/skill
🔍 SkillGuard检测内容
🔴 严重 — 阻止安装
这些模式表明存在严重的安全风险:
| 类别 | 模式 | 风险 |
|---|---|---|
| 代码执行 | eval(),exec(),compile() | 任意代码执行 |
| Shell注入 | subprocess(shell=True),os.system(),os.popen() | 命令注入 |
| 子进程 | child_process.exec(),child_process.spawn() | Shell访问(Node.js) |
| 凭证窃取 | 访问~/.ssh/,~/.aws/,~/.config/ | 私钥/凭证窃取 |
| 系统文件 | /etc/passwd,/etc/shadow | 系统危害 |
| 递归删除 | rm -rf,shutil.rmtree('/') | 数据销毁 |
| 权限提升 | sudo、setuid、chmod 777 | 根权限访问 |
| 反向 Shell | 套接字 + 子进程模式 | 远程访问 |
| 加密货币挖矿 | 矿池 URL、stratum:// | 资源窃取 |
🟡 警告 — 安装前请审阅
这些模式可能是合法的,但需要检查:
| 类别 | 模式 | 关注点 |
|---|---|---|
| 网络请求 | requests.post()、fetch()POST | 数据去向何处? |
| 环境变量访问 | os.environ、process.env | 哪些变量? |
| 文件写入 | open(..., 'w')、writeFile() | 保存了什么内容? |
| Base64编码 | base64.encode()、btoa() | 混淆的有效载荷? |
| 外部IP地址 | 硬编码的IP地址 | 数据渗漏端点? |
| 批量文件操作 | shutil.copytree()、glob | 大规模数据访问? |
| 持久化 | crontab,systemctl,.bashrc | 开机自动启动? |
| 软件包安装 | pip install,npm install | 供应链风险 |
🟢 信息 — 已注意但属正常
| 类别 | 模式 | 备注 |
|---|---|---|
| 文件读取 | open(..., 'r'),readFile() | 技能预期 |
| JSON 解析 | json.load(),JSON.parse() | 数据处理 |
| 日志记录 | print(),console.log() | 调试 |
| 标准导入 | import os,import sys | 常用库 |
📊 扫描输出示例
╔══════════════════════════════════════════════════════════════╗
║ 🛡️ SKILLGUARD SECURITY REPORT ║
╠══════════════════════════════════════════════════════════════╣
║ Skill: suspicious-helper v1.2.0 ║
║ Author: unknown-user ║
║ Files: 8 analyzed ║
║ Scan Time: 2024-02-03 05:30:00 UTC ║
╚══════════════════════════════════════════════════════════════╝
📁 FILES SCANNED
────────────────────────────────────────────────────────────────
✓ SKILL.md (541 bytes)
✓ scripts/main.py (2.3 KB)
✓ scripts/utils.py (1.1 KB)
✓ scripts/network.py (890 bytes)
✓ config.json (234 bytes)
✓ requirements.txt (89 bytes)
✓ package.json (312 bytes)
✓ install.sh (156 bytes)
🔴 CRITICAL ISSUES (3)
────────────────────────────────────────────────────────────────
[CRIT-001] scripts/main.py:45
│ Pattern: eval() with external input
│ Risk: Arbitrary code execution
│ Code: result = eval(user_input)
│
[CRIT-002] scripts/utils.py:23
│ Pattern: subprocess with shell=True
│ Risk: Command injection vulnerability
│ Code: subprocess.run(cmd, shell=True)
│
[CRIT-003] install.sh:12
│ Pattern: Recursive delete with variable
│ Risk: Potential data destruction
│ Code: rm -rf $TARGET_DIR/*
🟡 WARNINGS (5)
────────────────────────────────────────────────────────────────
[WARN-001] scripts/network.py:15 — HTTP POST to external URL
[WARN-002] scripts/main.py:78 — Reads OPENAI_API_KEY
[WARN-003] requirements.txt:3 — Unpinned dependency: requests
[WARN-004] scripts/utils.py:45 — Base64 encoding detected
[WARN-005] config.json — Hardcoded IP: 192.168.1.100
🟢 INFO (2)
────────────────────────────────────────────────────────────────
[INFO-001] scripts/main.py:10 — Standard file read operations
[INFO-002] requirements.txt — 3 dependencies declared
📦 DEPENDENCY ANALYSIS
────────────────────────────────────────────────────────────────
requirements.txt:
⚠️ requests (unpinned - specify version!)
✓ json (stdlib)
✓ pathlib (stdlib)
package.json:
⚠️ axios@0.21.0 (CVE-2021-3749 - upgrade to 0.21.2+)
════════════════════════════════════════════════════════════════
VERDICT: 🚫 DANGEROUS
════════════════════════════════════════════════════════════════
⛔ DO NOT INSTALL THIS SKILL
3 critical security issues found:
• Arbitrary code execution via eval()
• Command injection via shell=True
• Dangerous file deletion pattern
Manual code review required before any use.
════════════════════════════════════════════════════════════════
🎯 命令参考
scan <技能名称>
在安装前从 ClawHub 获取并扫描一个技能。
skillguard scan cool-automation-skill
skillguard scan cool-automation-skill --verbose
skillguard scan cool-automation-skill --json > report.json
scan-local <路径>
扫描本地技能目录。
skillguard scan-local ./my-skill
skillguard scan-local ~/downloads/untrusted-skill --strict
audit-installed
扫描工作空间中的所有技能。
skillguard audit-installed
skillguard audit-installed --fix # Attempt to fix issues
deps <路径>
分析依赖以查找已知漏洞。
skillguard deps ./skill-folder
skillguard deps ./skill-folder --update-db # Refresh vuln database
report <技能> [--format]
生成详细的安全报告。
skillguard report suspicious-skill --format markdown > report.md
skillguard report suspicious-skill --format json > report.json
skillguard report suspicious-skill --format html > report.html
allowlist <技能>
将技能标记为已手动审查且受信任。
skillguard allowlist my-trusted-skill
skillguard allowlist --list # Show all trusted skills
skillguard allowlist --remove old-skill
watch
监控新技能版本并自动扫描更新。
skillguard watch --interval 3600 # Check every hour
⚙️ 配置
创建~/.skillguard/config.json:
{
"severity_threshold": "warning",
"auto_scan_on_install": true,
"block_critical": true,
"trusted_authors": [
"official",
"PaxSwarm",
"verified-publisher"
],
"allowed_domains": [
"api.openai.com",
"api.anthropic.com",
"api.github.com",
"clawhub.ai"
],
"ignored_patterns": [
"test_*.py",
"*_test.js",
"*.spec.ts"
],
"custom_patterns": [
{
"regex": "my-internal-api\\.com",
"severity": "info",
"description": "Internal API endpoint"
}
],
"vuln_db_path": "~/.skillguard/vulns.json",
"report_format": "markdown",
"color_output": true
}
🔐 安全等级
扫描后,技能会被分配一个安全等级:
| 等级 | 徽章 | 含义 | 建议 |
|---|---|---|---|
| 已验证 | ✅ | 可信作者,无问题 | 可安全安装 |
| 清洁 | 🟢 | 未发现问题 | 可能安全 |
| 需审查 | 🟡 | 仅有警告 | 安装前请阅读 |
| 可疑 | 🟠 | 多项警告 | 需要仔细审查 |
| 危险 | 🔴 | 关键问题 | 请勿安装 |
| 恶意软件 | ⛔ | 已知恶意软件模式 | 拦截并报告 |
🔄 集成工作流
预安装钩子
# Add to your workflow
skillguard scan $SKILL && clawhub install $SKILL
CI/CD 流水线
# GitHub Actions example
- name: Security Scan
run: |
pip install skillguard
skillguard scan-local ./my-skill --strict --exit-code
自动化监控
# Cron job for daily audits
0 9 * * * /path/to/skillguard audit-installed --notify
📈 漏洞数据库
SkillGuard 维护着一个本地已知漏洞数据库:
# Update vulnerability database
skillguard update-db
# Check database status
skillguard db-status
# Report a new vulnerability
skillguard report-vuln --skill bad-skill --details "Description..."
数据源:
- CVE 数据库(Python 包)
- npm 安全公告数据库
- GitHub 安全公告
- 社区报告
🚫 局限性
SkillGuard 是第一道防线,而非安全保障:
| 局限性 | 解释 |
|---|---|
| 混淆处理 | 有预谋的攻击者能够隐藏恶意代码 |
| 动态代码 | 运行时生成的代码更难以分析 |
| 误报 | 合法代码可能触发警告 |
| 零日漏洞 | 新的攻击模式将无法被检测 |
| 依赖项 | 深度传递依赖扫描存在限制 |
纵深防御:请结合以下措施使用SkillGuard:
- 沙箱执行环境
- 网络监控
- 定期审计
- 最小权限原则
🤝 贡献指南
发现了我们遗漏的危险模式?帮助改进SkillGuard:
添加模式
{
"id": "CRIT-XXX",
"regex": "dangerous_function\\(",
"severity": "critical",
"category": "code_execution",
"description": "Dangerous function call",
"cwe": "CWE-94",
"remediation": "Use safe_alternative() instead",
"file_types": [".py", ".js"]
}
报告误报
skillguard report-fp --pattern "WARN-005" --reason "Legitimate use case"
📜 更新日志
v2.0.0(当前版本)
- 综合模式数据库(50多种模式)
- 依赖项漏洞扫描
- 多种输出格式(JSON、Markdown、HTML)
- 配置文件支持
- 可信作者系统
- 用于监控更新的监视模式
- 改进的报告功能,包含CWE参考
v1.0.0
- 初始版本
- 基础模式检测
- 本地和远程扫描
- 审计已安装的技能
📄 许可证
MIT许可证 — 可自由使用,欢迎贡献。
🛡️ 保持安全
“在智能体生态系统中,信任通过透明度赢得。 您安装的每一个技能都是您选择运行的代码。 明智选择。始终验证。”
由以下团队构建PaxSwarm— 保护群体,一次一个技能🐦⬛
链接:
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~