Clawdbot Self-Security Audit Framework
This skill empowers Clawdbot to audit its own security posture using first-principles reasoning. Rather than relying on a static script, Clawdbot learns the framework and applies it dynamically to detect vulnerabilities, understand their impact, and recommend specific remediations.
Core Philosophy
"Security through transparency and self-awareness." — Inspired by ᴅᴀɴɪᴇʟ ᴍɪᴇssʟᴇʀ
Clawdbot should know its own attack surface. This skill embeds that knowledge directly.
Security Principles
Running an AI agent with shell access requires caution. Focus on three areas:
- 1. Who can talk to the bot — DM policies, group allowlists, channel restrictions
- Where the bot is allowed to act — Network exposure, gateway binding, proxy configs
- What the bot can touch — Tool access, file permissions, credential storage
Start with the smallest access possible and widen it as you gain confidence.
Trust Hierarchy
Apply appropriate trust levels based on role:
| Level | Entity | Trust Model |
|---|
| 1 | Owner | Full trust — has all access |
| 2 |
AI | Trust but verify — sandboxed, logged |
| 3 |
Allowlists | Limited trust — only specified users |
| 4 |
Strangers | No trust — blocked by default |
Audit Commands
Use these commands to run security audits:
- -
clawdbot security audit — Standard audit of common issues - INLINECODE1 — Comprehensive audit with all checks
- INLINECODE2 — Apply guardrail remediations
The 12 Security Domains
When auditing Clawdbot, systematically evaluate these domains:
1. Gateway Exposure 🔴 Critical
What to check:
- - Where is the gateway binding? (
gateway.bind) - Is authentication configured? (
gateway.auth_token or CLAWDBOT_GATEWAY_TOKEN env var) - What port is exposed? (default: 18789)
- Is WebSocket auth enabled?
How to detect:
CODEBLOCK0
Vulnerability: Binding to 0.0.0.0 or lan without auth allows network access.
Remediation:
# Generate gateway token
clawdbot doctor --generate-gateway-token
export CLAWDBOT_GATEWAY_TOKEN="$(openssl rand -hex 32)"
2. DM Policy Configuration 🟠 High
What to check:
- - What is
dm_policy set to? - If
allowlist, who is explicitly allowed via allowFrom?
How to detect:
CODEBLOCK2
Vulnerability: Setting to allow or open means any user can DM Clawdbot.
Remediation:
{
"channels": {
"telegram": {
"dmPolicy": "allowlist",
"allowFrom": ["@trusteduser1", "@trusteduser2"]
}
}
}
3. Group Access Control 🟠 High
What to check:
- - What is
groupPolicy set to? - Are groups explicitly allowlisted?
- Are mention gates configured?
How to detect:
CODEBLOCK4
Vulnerability: Open group policy allows anyone in the room to trigger commands.
Remediation:
{
"channels": {
"telegram": {
"groupPolicy": "allowlist",
"groups": {
"-100123456789": true
}
}
}
}
4. Credentials Security 🔴 Critical
What to check:
- - Credential file locations and permissions
- Environment variable usage
- Auth profile storage
Credential Storage Map:
| Platform | Path |
|---|
| WhatsApp | INLINECODE14 |
| Telegram |
~/.clawdbot/clawdbot.json or env |
| Discord |
~/.clawdbot/clawdbot.json or env |
| Slack |
~/.clawdbot/clawdbot.json or env |
| Pairing allowlists |
~/.clawdbot/credentials/channel-allowFrom.json |
| Auth profiles |
~/.clawdbot/agents/{agentId}/auth-profiles.json |
| Legacy OAuth |
~/.clawdbot/credentials/oauth.json |
How to detect:
CODEBLOCK6
Vulnerability: Plaintext credentials with loose permissions can be read by any process.
Remediation:
chmod 700 ~/.clawdbot
chmod 600 ~/.clawdbot/credentials/oauth.json
chmod 600 ~/.clawdbot/clawdbot.json
5. Browser Control Exposure 🟠 High
What to check:
- - Is browser control enabled?
- Are authentication tokens set for remote control?
- Is HTTPS required for Control UI?
- Is a dedicated browser profile configured?
How to detect:
CODEBLOCK8
Vulnerability: Exposed browser control without auth allows remote UI takeover. Browser access allows the model to use logged-in sessions.
Remediation:
CODEBLOCK9
Security Note: Treat browser control URLs as admin APIs.
6. Gateway Bind & Network Exposure 🟠 High
What to check:
- - What is
gateway.bind set to? - Are trusted proxies configured?
- Is Tailscale enabled?
How to detect:
CODEBLOCK10
Vulnerability: Public binding without auth allows internet access to gateway.
Remediation:
{
"gateway": {
"bind": "127.0.0.1",
"mode": "local",
"trustedProxies": ["127.0.0.1", "10.0.0.0/8"],
"tailscale": {
"mode": "off"
}
}
}
7. Tool Access & Sandboxing 🟡 Medium
What to check:
- - Are elevated tools allowlisted?
- Is
restrict_tools or mcp_tools configured? - What is
workspaceAccess set to? - Are sensitive tools running in sandbox?
How to detect:
CODEBLOCK12
Workspace Access Levels:
| Mode | Description |
|---|
| INLINECODE25 | Workspace is off limits |
| INLINECODE26 |
Workspace mounted read-only |
|
rw | Workspace mounted read-write |
Vulnerability: Broad tool access means more blast radius if compromised. Smaller models are more susceptible to tool misuse.
Remediation:
CODEBLOCK13
Model Guidance: Use latest generation models for agents with filesystem or network access. If using small models, disable web search and browser tools.
8. File Permissions & Local Disk Hygiene 🟡 Medium
What to check:
- - Directory permissions (should be 700)
- Config file permissions (should be 600)
- Symlink safety
How to detect:
CODEBLOCK14
Vulnerability: Loose permissions allow other users to read sensitive configs.
Remediation:
chmod 700 ~/.clawdbot
chmod 600 ~/.clawdbot/clawdbot.json
chmod 600 ~/.clawdbot/credentials/*
9. Plugin Trust & Model Hygiene 🟡 Medium
What to check:
- - Are plugins explicitly allowlisted?
- Are legacy models in use with tool access?
How to detect:
CODEBLOCK16
Vulnerability: Untrusted plugins can execute code. Legacy models may lack modern safety.
Remediation:
{
"plugins": {
"allowlist": ["trusted-plugin-1", "trusted-plugin-2"]
},
"agents": {
"defaults": {
"model": {
"primary": "minimax/MiniMax-M2.1"
}
}
}
}
10. Logging & Redaction 🟡 Medium
What is logging.redactSensitive set to?
- - Should be
tools to redact sensitive tool output - If
off, credentials may leak in logs
How to detect:
CODEBLOCK18
Remediation:
{
"logging": {
"redactSensitive": "tools",
"path": "~/.clawdbot/logs/"
}
}
11. Prompt Injection Protection 🟡 Medium
What to check:
- - Is
wrap_untrusted_content or untrusted_content_wrapper enabled? - How is external/web content handled?
- Are links and attachments treated as hostile?
How to detect:
CODEBLOCK20
Prompt Injection Mitigation Strategies:
- - Keep DMs locked to
pairing or INLINECODE33 - Use mention gating in groups
- Treat all links and attachments as hostile
- Run sensitive tools in a sandbox
- Use instruction-hardened models like Anthropic Opus 4.5
Vulnerability: Untrusted content (web fetches, sandbox output) can inject malicious prompts.
Remediation:
{
"wrap_untrusted_content": true,
"untrusted_content_wrapper": "<untrusted>",
"treatLinksAsHostile": true,
"mentionGate": true
}
12. Dangerous Command Blocking 🟡 Medium
What to check:
- - What commands are in
blocked_commands? - Are these patterns included:
rm -rf, curl |, git push --force, mkfs, fork bombs?
How to detect:
CODEBLOCK22
Vulnerability: Without blocking, a malicious prompt could destroy data or exfiltrate credentials.
Remediation:
{
"blocked_commands": [
"rm -rf",
"curl |",
"git push --force",
"mkfs",
":(){:|:&}"
]
}
13. Secret Scanning Readiness 🟡 Medium
What to check:
- - Is detect-secrets configured?
- Is there a
.secrets.baseline file? - Has a baseline scan been run?
How to detect:
CODEBLOCK24
Secret Scanning (CI):
CODEBLOCK25
Vulnerability: Leaked credentials in the codebase can lead to compromise.
Audit Functions
The --fix flag applies these guardrails:
- - Changes
groupPolicy from open to allowlist for common channels - Resets
logging.redactSensitive from off to INLINECODE46 - Tightens local permissions:
.clawdbot directory to 700, config files to INLINECODE49 - Secures state files including credentials and auth profiles
High-Level Audit Checklist
Treat findings in this priority order:
- 1. 🔴 Lock down DMs and groups if tools are enabled on open settings
- 🔴 Fix public network exposure immediately
- 🟠 Secure browser control with tokens and HTTPS
- 🟠 Correct file permissions for credentials and config
- 🟡 Only load trusted plugins
- 🟡 Use modern models for bots with tool access
Access Control Models
DM Access Model
| Mode | Description |
|---|
| INLINECODE50 | Default - unknown senders must be approved via code |
| INLINECODE51 |
Unknown senders blocked without handshake |
|
open | Public access - requires explicit asterisk in allowlist |
|
disabled | All inbound DMs ignored |
Slash Commands
Slash commands are only available to authorized senders based on channel allowlists. The /exec command is a session convenience for operators and does not modify global config.
Threat Model & Mitigation
Potential Risks
| Risk | Mitigation |
|---|
| Execution of shell commands | INLINECODE55 , INLINECODE56 |
| File and network access |
sandbox,
workspaceAccess: none/ro |
| Social engineering and prompt injection |
wrap_untrusted_content,
mentionGate |
| Browser session hijacking | Dedicated profile, token auth, HTTPS |
| Credential leakage |
logging.redactSensitive: tools, env vars |
Incident Response
If a compromise is suspected, follow these steps:
Containment
- 1. Stop the gateway process — INLINECODE62
- Set gateway.bind to loopback — INLINECODE63
- Disable risky DMs and groups — Set to INLINECODE64
Rotation
- 1. Change the gateway auth token — INLINECODE65
- Rotate browser control and hook tokens
- Revoke and rotate API keys for model providers
Review
- 1. Check gateway logs and session transcripts — INLINECODE66
- Review recent config changes — Git history or backups
- Re-run the security audit with the deep flag — INLINECODE67
Reporting Vulnerabilities
Report security issues to: security@clawd.bot
Do not post vulnerabilities publicly until they have been fixed.
Audit Execution Steps
When running a security audit, follow this sequence:
Step 1: Locate Configuration
CODEBLOCK26
Step 2: Run Domain Checks
For each of the 13 domains above:
- 1. Parse relevant config keys
- Compare against secure baseline
- Flag deviations with severity
Step 3: Generate Report
Format findings by severity:
CODEBLOCK27
Step 4: Provide Remediation
For each finding, output:
- - Specific config change needed
- Example configuration
- Command to apply (if safe)
Report Template
CODEBLOCK28
Extending the Skill
To add new security checks:
- 1. Identify the vulnerability - What misconfiguration creates risk?
- Determine detection method - What config key or system state reveals it?
- Define the baseline - What is the secure configuration?
- Write detection logic - Shell commands or file parsing
- Document remediation - Specific steps to fix
- Assign severity - Critical, High, Medium, Low
Example: Adding SSH Hardening Check
CODEBLOCK29 bash
env | grep SSHAUTHSOCK
CODEBLOCK30
Security Assessment Questions
When auditing, ask:
- 1. Exposure: What network interfaces can reach Clawdbot?
- Authentication: What verification does each access point require?
- Isolation: What boundaries exist between Clawdbot and the host?
- Trust: What content sources are considered "trusted"?
- Auditability: What evidence exists of Clawdbot's actions?
- Least Privilege: Does Clawdbot have only necessary permissions?
Principles Applied
- - Zero modification - This skill only reads; never changes configuration
- Defense in depth - Multiple checks catch different attack vectors
- Actionable output - Every finding includes a concrete remediation
- Extensible design - New checks integrate naturally
References
- - Official docs: https://docs.clawd.bot/gateway/security
- Original framework: ᴅᴀɴɪᴇʟ ᴍɪᴇssʟᴇʀ on X
- Repository: https://github.com/TheSethRose/Clawdbot-Security-Check
- Report vulnerabilities: security@clawd.bot
Remember: This skill exists to make Clawdbot self-aware of its security posture. Use it regularly, extend it as needed, and never skip the audit.
Clawdbot 自我安全审计框架
该技能使 Clawdbot 能够使用第一性原理推理来审计自身的安全态势。Clawdbot 不是依赖静态脚本,而是学习该框架并动态应用它来检测漏洞、理解其影响并推荐具体的修复措施。
核心理念
通过透明和自我意识实现安全。 — 灵感来自 ᴅᴀɴɪᴇʟ ᴍɪᴇssʟᴇʀ
Clawdbot 应该了解自身的攻击面。该技能直接嵌入了这种知识。
安全原则
运行具有 shell 访问权限的 AI 代理需要谨慎。重点关注三个领域:
- 1. 谁可以与机器人对话 — 私信策略、群组白名单、频道限制
- 允许机器人在哪里操作 — 网络暴露、网关绑定、代理配置
- 机器人可以接触什么 — 工具访问、文件权限、凭据存储
从最小的访问权限开始,随着信心的增强再逐步扩大。
信任层级
根据角色应用适当的信任级别:
| 级别 | 实体 | 信任模型 |
|---|
| 1 | 所有者 | 完全信任 — 拥有所有访问权限 |
| 2 |
AI | 信任但验证 — 沙盒化、记录日志 |
| 3 |
白名单 | 有限信任 — 仅限指定用户 |
| 4 |
陌生人 | 不信任 — 默认阻止 |
审计命令
使用这些命令来运行安全审计:
- - clawdbot security audit — 常见问题的标准审计
- clawdbot security audit --deep — 包含所有检查的全面审计
- clawdbot security audit --fix — 应用护栏修复措施
12 个安全域
审计 Clawdbot 时,系统性地评估这些域:
1. 网关暴露 🔴 严重
检查内容:
- - 网关绑定在哪里?(gateway.bind)
- 是否配置了身份验证?(gateway.authtoken 或 CLAWDBOTGATEWAY_TOKEN 环境变量)
- 暴露了哪个端口?(默认:18789)
- 是否启用了 WebSocket 身份验证?
检测方法:
bash
cat ~/.clawdbot/clawdbot.json | grep -A10 gateway
env | grep CLAWDBOTGATEWAYTOKEN
漏洞: 绑定到 0.0.0.0 或 lan 且未启用身份验证,允许网络访问。
修复措施:
bash
生成网关令牌
clawdbot doctor --generate-gateway-token
export CLAWDBOT
GATEWAYTOKEN=$(openssl rand -hex 32)
2. 私信策略配置 🟠 高
检查内容:
- - dm_policy 设置为什么?
- 如果是 allowlist,通过 allowFrom 明确允许了谁?
检测方法:
bash
cat ~/.clawdbot/clawdbot.json | grep -E dm_policy|allowFrom
漏洞: 设置为 allow 或 open 意味着任何用户都可以向 Clawdbot 发送私信。
修复措施:
json
{
channels: {
telegram: {
dmPolicy: allowlist,
allowFrom: [@trusteduser1, @trusteduser2]
}
}
}
3. 群组访问控制 🟠 高
检查内容:
- - groupPolicy 设置为什么?
- 群组是否明确列入白名单?
- 是否配置了提及门控?
检测方法:
bash
cat ~/.clawdbot/clawdbot.json | grep -E groupPolicy|groups
cat ~/.clawdbot/clawdbot.json | grep -i mention
漏洞: 开放的群组策略允许房间内的任何人触发命令。
修复措施:
json
{
channels: {
telegram: {
groupPolicy: allowlist,
groups: {
-100123456789: true
}
}
}
}
4. 凭据安全 🔴 严重
检查内容:
- - 凭据文件位置和权限
- 环境变量使用情况
- 身份验证配置文件存储
凭据存储映射:
| 平台 | 路径 |
|---|
| 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 |
检测方法:
bash
ls -la ~/.clawdbot/credentials/
ls -la ~/.clawdbot/agents/*/auth-profiles.json 2>/dev/null
stat -c %a ~/.clawdbot/credentials/oauth.json 2>/dev/null
漏洞: 权限宽松的明文凭据可被任何进程读取。
修复措施:
bash
chmod 700 ~/.clawdbot
chmod 600 ~/.clawdbot/credentials/oauth.json
chmod 600 ~/.clawdbot/clawdbot.json
5. 浏览器控制暴露 🟠 高
检查内容:
- - 是否启用了浏览器控制?
- 是否为远程控制设置了身份验证令牌?
- 控制 UI 是否需要 HTTPS?
- 是否配置了专用浏览器配置文件?
检测方法:
bash
cat ~/.clawdbot/clawdbot.json | grep -A5 browser
cat ~/.clawdbot/clawdbot.json | grep -i controlUi|insecureAuth
ls -la ~/.clawdbot/browser/
漏洞: 未启用身份验证的浏览器控制暴露允许远程 UI 接管。浏览器访问允许模型使用已登录的会话。
修复措施:
json
{
browser: {
remoteControlUrl: https://...,
remoteControlToken: ...,
dedicatedProfile: true,
disableHostControl: true
},
gateway: {
controlUi: {
allowInsecureAuth: false
}
}
}
安全说明: 将浏览器控制 URL 视为管理员 API。
6. 网关绑定与网络暴露 🟠 高
检查内容:
- - gateway.bind 设置为什么?
- 是否配置了受信任的代理?
- 是否启用了 Tailscale?
检测方法:
bash
cat ~/.clawdbot/clawdbot.json | grep -A10 gateway
cat ~/.clawdbot/clawdbot.json | grep tailscale
漏洞: 未启用身份验证的公共绑定允许互联网访问网关。
修复措施:
json
{
gateway: {
bind: 127.0.0.1,
mode: local,
trustedProxies: [127.0.0.1, 10.0.0.0/8],
tailscale: {
mode: off
}
}
}
7. 工具访问与沙盒化 🟡 中
检查内容:
- - 是否将提权工具列入白名单?
- 是否配置了 restricttools 或 mcptools?
- workspaceAccess 设置为什么?
- 敏感工具是否在沙盒中运行?
检测方法:
bash
cat ~/.clawdbot/clawdbot.json | grep -i restrict|mcp|elevated
cat ~/.clawdbot/clawdbot.json | grep -i workspaceAccess|sandbox
cat ~/.clawdbot/clawdbot.json | grep -i openRoom
工作区访问级别:
工作区以只读方式挂载 |
| rw | 工作区以读写方式挂载 |
漏洞: 广泛的工具访问意味着如果被攻破,爆炸半径更大。较小的模型更容易受到工具滥用的影响。
修复措施