Skip to content

clab60917/clawdbot-security-hardening

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Clawdbot Security Hardening Kit

Security License Clawdbot

⚠️ 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.

🎯 Purpose

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.

πŸ“Š Threat Landscape

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

πŸš€ Quick Start

# 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 --apply

πŸ“ Repository Structure

clawdbot-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

πŸ”₯ Critical Vulnerabilities Addressed

1. Gateway Authentication Bypass (Critical)

Issue: Default config allows unauthenticated access via reverse proxies

# Check if vulnerable
./scripts/check-exposure.sh

# Fix
./scripts/harden.sh --fix-gateway-auth

2. Plaintext Credential Storage (Critical)

Issue: 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-permissions

3. Prompt Injection via External Hooks (High)

Issue: Email/webhook content interpolated without sanitization

# Review affected configurations
./scripts/security-audit.sh --check-hooks

4. Public Gateway Exposure (Critical)

Issue: 900+ instances found exposed via Shodan

# Check your exposure
./scripts/check-exposure.sh --shodan

# Apply network restrictions
./scripts/harden.sh --network

πŸ“‹ Security Checklist

Run 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/ is 700, configs are 600
  • 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

πŸ› οΈ Configuration Profiles

Secure Baseline (Recommended)

For personal use with reasonable security:

cp configs/secure-baseline.json ~/.clawdbot/clawdbot.json

Paranoid Mode

Maximum security, some features disabled:

cp configs/paranoid-mode.json ~/.clawdbot/clawdbot.json

Enterprise

Multi-user deployment with audit logging:

cp configs/enterprise.json ~/.clawdbot/clawdbot.json

🚨 Incident Response

If you suspect compromise:

# Emergency containment (stops gateway, blocks network)
./scripts/incident-response.sh --contain

# Full response procedure
./scripts/incident-response.sh --full

See INCIDENT_RESPONSE.md for detailed procedures.

πŸ“š Documentation

πŸ”— Related Resources

🀝 Contributing

Security improvements welcome! Please:

  1. Report vulnerabilities privately first
  2. Include reproduction steps
  3. Suggest mitigations where possible

βš–οΈ Disclaimer

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.

πŸ“„ License

MIT License - See LICENSE for details.


Stay safe, stay patched, stay paranoid. πŸ¦žπŸ”’

About

Clawdbot Security Hardening Kit. use Clawdbot more securely !

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors