名称: clawdbot-self-security-audit
描述: 对 Clawdbot 自身配置执行全面的只读安全审计。这是一个基于知识的技能,旨在教会 Clawdbot 识别整个系统中的加固机会。当用户要求“运行安全检查”、“审计 Clawdbot”、“检查安全加固”或“我的 Clawdbot 有什么漏洞”时使用。该技能利用 Clawdbot 的内部能力和文件系统访问权限来检查配置、检测错误配置并建议修复方案。它被设计为可扩展的——可以通过更新此技能的知识来添加新的检查项。
主页: https://github.com/TheSethRose/Clawdbot-Security-Check
元数据: {"clawdbot":{"emoji":"🔒","os":["darwin","linux"],"requires":{"files":["read"],"tools":["exec","bash"]},"install":[{"id":"read-skill","kind":"skill","name":"clawdbot-self-security-audit","label":"安装安全审计技能","bins":["SKILL.md"]}]}}
此技能使 Clawdbot 能够运用第一性原理推理来审计自身的安全态势。它不依赖于静态脚本,而是让 Clawdbot 学习框架并动态应用,以检测漏洞、理解其影响并推荐具体的修复措施。
“通过透明度和自我认知实现安全。” — 灵感源自 ᴅᴀɴɪᴇʟ ᴍɪᴇssʟᴇʀ
Clawdbot 应当了解自身的攻击面。此技能直接嵌入了该知识。
运行一个具有 Shell 访问权限的 AI 代理需要谨慎。重点关注以下三个方面:
从最小可能的访问权限开始,随着信心的增强再逐步扩大。
根据角色应用适当的信任级别:
| 级别 | 实体 | 信任模型 |
|---|---|---|
| 1 | 所有者 | 完全信任 — 拥有所有访问权限 |
| 2 | AI | 信任但要验证 — 沙盒化、有日志记录 |
| 3 | 白名单 | 有限信任 — 仅限指定用户 |
| 4 | 陌生人 | 不信任 — 默认阻止 |
使用以下命令运行安全审计:
clawdbot security audit — 标准审计,检查常见问题clawdbot security audit --deep — 全面审计,包含所有检查项clawdbot security audit --fix — 应用防护栏修复措施审计 Clawdbot 时,系统性地评估以下领域:
检查内容:
- 网关绑定在哪里?(gateway.bind)
- 是否配置了身份验证?(gateway.auth_token 或 CLAWDBOT_GATEWAY_TOKEN 环境变量)
- 暴露了哪个端口?(默认:18789)
- WebSocket 身份验证是否启用?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -A10 '"gateway"'
env | grep CLAWDBOT_GATEWAY_TOKEN
漏洞: 在没有身份验证的情况下绑定到 0.0.0.0 或 lan 允许网络访问。
修复措施:
# 生成网关令牌
clawdbot doctor --generate-gateway-token
export CLAWDBOT_GATEWAY_TOKEN="$(openssl rand -hex 32)"
检查内容:
- dm_policy 设置为什么?
- 如果是 allowlist,通过 allowFrom 明确允许了谁?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -E '"dm_policy|"allowFrom"'
漏洞: 设置为 allow 或 open 意味着任何用户都可以向 Clawdbot 发送私信。
修复措施:
{
"channels": {
"telegram": {
"dmPolicy": "allowlist",
"allowFrom": ["@trusteduser1", "@trusteduser2"]
}
}
}
检查内容:
- groupPolicy 设置为什么?
- 群组是否明确在白名单中?
- 是否配置了提及门控?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -E '"groupPolicy"|"groups"'
cat ~/.clawdbot/clawdbot.json | grep -i "mention"
漏洞: 开放的群组策略允许房间内的任何人触发命令。
修复措施:
{
"channels": {
"telegram": {
"groupPolicy": "allowlist",
"groups": {
"-100123456789": true
}
}
}
}
检查内容:
- 凭据文件位置和权限
- 环境变量使用情况
- 身份验证配置文件存储
凭据存储映射:
| 平台 | 路径 |
| :--- | :--- |
| WhatsApp | ~/.clawdbot/credentials/whatsapp/{accountId}/creds.json |
| Telegram | ~/.clawdbot/clawdbot.json 或环境变量 |
| Discord | ~/.clawdbot/clawdbot.json 或环境变量 |
| Slack | ~/.clawdbot/clawdbot.json 或环境变量 |
| 配对白名单 | ~/.clawdbot/credentials/channel-allowFrom.json |
| 身份验证配置文件 | ~/.clawdbot/agents/{agentId}/auth-profiles.json |
| 旧版 OAuth | ~/.clawdbot/credentials/oauth.json |
检测方法:
ls -la ~/.clawdbot/credentials/
ls -la ~/.clawdbot/agents/*/auth-profiles.json 2>/dev/null
stat -c "%a" ~/.clawdbot/credentials/oauth.json 2>/dev/null
漏洞: 明文凭据配合宽松的权限可能被任何进程读取。
修复措施:
chmod 700 ~/.clawdbot
chmod 600 ~/.clawdbot/credentials/oauth.json
chmod 600 ~/.clawdbot/clawdbot.json
检查内容:
- 浏览器控制是否启用?
- 是否为远程控制设置了身份验证令牌?
- 控制界面是否要求 HTTPS?
- 是否配置了专用的浏览器配置文件?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -A5 '"browser"'
cat ~/.clawdbot/clawdbot.json | grep -i "controlUi|insecureAuth"
ls -la ~/.clawdbot/browser/
漏洞: 未经身份验证的浏览器控制暴露允许远程接管界面。浏览器访问允许模型使用已登录的会话。
修复措施:
{
"browser": {
"remoteControlUrl": "https://...",
"remoteControlToken": "...",
"dedicatedProfile": true,
"disableHostControl": true
},
"gateway": {
"controlUi": {
"allowInsecureAuth": false
}
}
}
安全说明: 将浏览器控制 URL 视为管理 API。
检查内容:
- gateway.bind 设置为什么?
- 是否配置了可信代理?
- Tailscale 是否启用?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -A10 '"gateway"'
cat ~/.clawdbot/clawdbot.json | grep '"tailscale"'
漏洞: 没有身份验证的公共绑定允许互联网访问网关。
修复措施:
{
"gateway": {
"bind": "127.0.0.1",
"mode": "local",
"trustedProxies": ["127.0.0.1", "10.0.0.0/8"],
"tailscale": {
"mode": "off"
}
}
}
检查内容:
- 高权限工具是否在白名单中?
- 是否配置了 restrict_tools 或 mcp_tools?
- workspaceAccess 设置为什么?
- 敏感工具是否在沙盒中运行?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -i "restrict|mcp|elevated"
cat ~/.clawdbot/clawdbot.json | grep -i "workspaceAccess|sandbox"
cat ~/.clawdbot/clawdbot.json | grep -i "openRoom"
工作区访问级别:
| 模式 | 描述 |
| :--- | :--- |
| none | 工作区禁止访问 |
| ro | 工作区以只读方式挂载 |
| rw | 工作区以读写方式挂载 |
漏洞: 广泛的工具访问意味着如果被攻破,爆炸半径更大。较小的模型更容易被工具滥用。
修复措施:
{
"restrict_tools": true,
"mcp_tools": {
"allowed": ["read", "write", "bash"],
"blocked": ["exec", "gateway"]
},
"workspaceAccess": "ro",
"sandbox": "all"
}
模型指导: 对于具有文件系统或网络访问权限的代理,请使用最新一代模型。如果使用小型模型,请禁用网络搜索和浏览器工具。
检查内容:
- 目录权限(应为 700)
- 配置文件权限(应为 600)
- 符号链接安全性
检测方法:
stat -c "%a" ~/.clawdbot
ls -la ~/.clawdbot/*.json
漏洞: 宽松的权限允许其他用户读取敏感配置。
修复措施:
chmod 700 ~/.clawdbot
chmod 600 ~/.clawdbot/clawdbot.json
chmod 600 ~/.clawdbot/credentials/*
检查内容:
- 插件是否明确在白名单中?
- 是否在使用具有工具访问权限的旧版模型?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -i "plugin|allowlist"
cat ~/.clawdbot/clawdbot.json | grep -i "model|anthropic"
漏洞: 不受信任的插件可以执行代码。旧版模型可能缺乏现代安全性。
修复措施:
{
"plugins": {
"allowlist": ["trusted-plugin-1", "trusted-plugin-2"]
},
"agents": {
"defaults": {
"model": {
"primary": "minimax/MiniMax-M2.1"
}
}
}
}
logging.redactSensitive 设置为什么?
- 应设置为 tools 以脱敏敏感工具输出
- 如果为 off,凭据可能泄露在日志中
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -i "logging|redact"
ls -la ~/.clawdbot/logs/
修复措施:
{
"logging": {
"redactSensitive": "tools",
"path": "~/.clawdbot/logs/"
}
}
检查内容:
- wrap_untrusted_content 或 untrusted_content_wrapper 是否启用?
- 如何处理外部/网络内容?
- 链接和附件是否被视为敌对?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -i "untrusted|wrap"
提示注入缓解策略:
- 将私信锁定为 pairing 或 allowlists
- 在群组中使用提及门控
- 将所有链接和附件视为敌对
- 在沙盒中运行敏感工具
- 使用经过指令强化的模型,如 Anthropic Opus 4.5
漏洞: 不受信任的内容(网络抓取、沙盒输出)可能注入恶意提示。
修复措施:
{
"wrap_untrusted_content": true,
"untrusted_content_wrapper": "<untrusted>",
"treatLinksAsHostile": true,
"mentionGate": true
}
检查内容:
- blocked_commands 中包含哪些命令?
- 是否包含以下模式:rm -rf、curl |、git push --force、mkfs、fork 炸弹?
检测方法:
cat ~/.clawdbot/clawdbot.json | grep -A10 '"blocked_commands"'
漏洞: 如果不阻止,恶意提示可能破坏数据或泄露凭据。
修复措施:
{
"blocked_commands": [
"rm -rf",
"curl |",
"git push --force",
"mkfs",
":(){:|:&}"
]
}
检查内容:
- 是否配置了 detect-secrets?
- 是否存在 .secrets.baseline 文件?
- 是否运行过基线扫描?
检测方法:
ls -la .secrets.baseline 2>/dev/null
which detect-secrets 2>/dev/null
秘密扫描(CI):
# 查找候选
detect-secrets scan --baseline .secrets.baseline
# 审查发现项
detect-secrets audit
# 在轮换密钥或标记误报后更新基线
detect-secrets scan --baseline .secrets.baseline --update
漏洞: 代码库中泄露的凭据可能导致被攻破。
--fix 标志应用以下防护栏:
groupPolicy 从 open 更改为 allowlistlogging.redactSensitive 从 off 重置为 tools.clawdbot 目录设为 700,配置文件设为 600按此优先级顺序处理发现项:
| 模式 | 描述 |
|---|---|
pairing |
默认 - 未知发件人必须通过代码批准 |
allowlist |
未知发件人无需握手即被阻止 |
open |
公共访问 - 需要在白名单中明确使用星号 |
disabled |
忽略所有入站私信 |
斜杠命令仅对基于频道白名单的授权发件人可用。/exec 命令是为操作员提供的会话便利,不会修改全局配置。
| 风险 | 缓解措施 |
|---|---|
| 执行 Shell 命令 | blocked_commands、restrict_tools |
| 文件和网络访问 | sandbox、workspaceAccess: none/ro |
| 社会工程和提示注入 | wrap_untrusted_content、mentionGate |
| 浏览器会话劫持 | 专用配置文件、令牌身份验证、HTTPS |
| 凭据泄露 | logging.redactSensitive: tools、环境变量 |
如果怀疑发生入侵,请遵循以下步骤:
clawdbot daemon stop"bind": "127.0.0.1"disabledclawdbot doctor --generate-gateway-token~/.clawdbot/logs/clawdbot security audit --deep将