网淘吧来吧,欢迎您!

ClawScan技能使用说明

2026-03-29 新闻来源:网淘吧 围观:17
电脑广告
手机广告

🛡️ 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('/')数据销毁
权限提升sudosetuidchmod 777根权限访问
反向 Shell套接字 + 子进程模式远程访问
加密货币挖矿矿池 URL、stratum://资源窃取

🟡 警告 — 安装前请审阅

这些模式可能是合法的,但需要检查:

类别模式关注点
网络请求requests.post()fetch()POST数据去向何处?
环境变量访问os.environprocess.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— 保护群体,一次一个技能🐦‍⬛


链接:

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏
文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第326245名访客 今日有220篇新文章/评论