β οΈ IMPORTANT: Clawdbot is a powerful AI assistant with shell access. This repo provides tools and configurations to reduce your attack surface. There is no "perfectly secure" setup - the goal is defense in depth.
This repository provides security hardening tools, configurations, and best practices for Clawdbot deployments. It addresses critical vulnerabilities identified in security audits, including the Argus Security Analysis (Issue #1796) which found 512 findings including 8 critical vulnerabilities.
| Risk | Impact | This Repo Helps |
|---|---|---|
| Exposed Gateway | RCE, credential theft | β Network hardening scripts |
| Plaintext secrets | API key theft | β Encryption wrapper |
| Prompt injection | Unauthorized actions | β Input sanitization |
| Supply chain attacks | Backdoor installation | β Dependency audit |
| Infostealer malware | Full compromise | β File permissions hardening |
# Clone this repo
git clone https://github.com/clab60917/clawdbot-security-hardening.git
cd clawdbot-security-hardening
# Run the security audit
chmod +x scripts/security-audit.sh
./scripts/security-audit.sh
# Apply automatic fixes (review output first!)
./scripts/harden.sh --applyclawdbot-security-hardening/
βββ README.md # This file
βββ SECURITY_ANALYSIS.md # Full vulnerability analysis
βββ INCIDENT_RESPONSE.md # What to do if compromised
βββ configs/
β βββ secure-baseline.json # Minimal secure configuration
β βββ paranoid-mode.json # Maximum security (limited functionality)
β βββ enterprise.json # Multi-user/team deployment
β βββ docker-compose.secure.yml
βββ scripts/
β βββ security-audit.sh # Comprehensive security check
β βββ harden.sh # Apply hardening automatically
β βββ rotate-secrets.sh # Credential rotation helper
β βββ check-exposure.sh # Shodan/network exposure check
β βββ dependency-audit.sh # Supply chain security
β βββ incident-response.sh # Emergency containment
βββ firewall/
β βββ ufw-rules.sh # UFW firewall rules
β βββ iptables-rules.sh # iptables alternative
β βββ pf.conf # macOS pf firewall
βββ monitoring/
β βββ falco-rules.yaml # Runtime security monitoring
β βββ auditd-rules.conf # Linux audit rules
β βββ log-analysis.py # Suspicious activity detector
βββ docker/
β βββ Dockerfile.hardened # Security-focused container
β βββ docker-compose.secure.yml
βββ systemd/
β βββ clawdbot-hardened.service
βββ docs/
βββ THREAT_MODEL.md
βββ DEPLOYMENT_CHECKLIST.md
βββ SECURITY_FAQ.md
Issue: Default config allows unauthenticated access via reverse proxies
# Check if vulnerable
./scripts/check-exposure.sh
# Fix
./scripts/harden.sh --fix-gateway-authIssue: API keys and tokens stored in readable JSON files
# Audit current exposure
./scripts/security-audit.sh --check-secrets
# Apply file permissions
./scripts/harden.sh --fix-permissionsIssue: Email/webhook content interpolated without sanitization
# Review affected configurations
./scripts/security-audit.sh --check-hooksIssue: 900+ instances found exposed via Shodan
# Check your exposure
./scripts/check-exposure.sh --shodan
# Apply network restrictions
./scripts/harden.sh --networkRun through this before deploying:
- Network: Gateway bound to loopback only (
bind: "loopback") - Auth: Gateway token set (
CLAWDBOT_GATEWAY_TOKEN) - DMs: Pairing mode enabled (not
dmPolicy: "open") - Groups: Require mention (
requireMention: true) - Permissions:
~/.clawdbot/is700, configs are600 - Sandbox: Non-main sessions sandboxed
- Firewall: Port 18789 blocked from external
- Dependencies: No known vulnerable packages
- Secrets: No hardcoded credentials in config
- Logs: Sensitive data redaction enabled
For personal use with reasonable security:
cp configs/secure-baseline.json ~/.clawdbot/clawdbot.jsonMaximum security, some features disabled:
cp configs/paranoid-mode.json ~/.clawdbot/clawdbot.jsonMulti-user deployment with audit logging:
cp configs/enterprise.json ~/.clawdbot/clawdbot.jsonIf you suspect compromise:
# Emergency containment (stops gateway, blocks network)
./scripts/incident-response.sh --contain
# Full response procedure
./scripts/incident-response.sh --fullSee INCIDENT_RESPONSE.md for detailed procedures.
- Full Security Analysis - Detailed vulnerability breakdown
- Threat Model - Attack vectors and mitigations
- Deployment Checklist - Step-by-step secure deployment
- Security FAQ - Common questions answered
- Clawdbot Official Security Docs
- Issue #1796 - Argus Security Audit
- Issue #1971 - Gateway Authentication
- Issue #2245 - Reverse Proxy Exposure
- Chord - Security-focused Alternative
Security improvements welcome! Please:
- Report vulnerabilities privately first
- Include reproduction steps
- Suggest mitigations where possible
This toolkit is provided as-is for educational and defensive purposes. Always review scripts before running them. The authors are not responsible for any damage caused by misuse or misconfiguration.
MIT License - See LICENSE for details.
Stay safe, stay patched, stay paranoid. π¦π