$ ssh clawdbot.space --loading...
$ ssh clawdbot.space --loading...
Essential security hardening for your OpenClaw deployment β from network isolation to skill auditing.
OpenClaw is a powerful AI agent with deep system access β file read/write, shell commands, browser control, API integrations, and scheduled background execution. This level of access is what makes OpenClaw genuinely useful; it's also what makes it a high-value target for attackers. A misconfigured instance can expose your entire local network. A compromised skill can exfiltrate credentials silently. The security landscape for self-hosted AI agents changed dramatically in 2026. Multiple CVEs were publicly disclosed, including a critical 9.9-severity safeBins bypass and a one-click RCE via WebSocket header validation failure. The ClawHavoc malware campaign embedded 847 malicious skills in ClawHub, several of which achieved thousands of installs before detection. This guide consolidates the practical hardening steps that experienced community members have developed in response β covering network isolation, Docker sandboxing, skill auditing, credential management, and runtime permission controls.
One-click RCE via token exfiltration β WebSocket origin header not validated. Patch: v2026.1.29+
safeBins bypass using GNU long-option abbreviations. Patch: v2026.3.12+
Command injection in Docker sandbox via insecure PATH handling. Patch: v2026.1.29+
skills.status endpoint leaks sensitive config data (e.g., Discord API tokens). Patch: v2026.2.14+
Indirect prompt injection β web content not sanitized before LLM processing. Ongoing mitigation.
Bind the gateway exclusively to 127.0.0.1:18789 β the default 0.0.0.0 binding exposes your API to every interface on the machine, meaning anyone on your local network can reach it without authentication. Run 'netstat -an | grep 18789' to verify the binding. For remote access, Tailscale is the community-recommended approach: it provides a WireGuard-based overlay network that requires device authentication and leaves no ports exposed to the internet.
If external access is unavoidable (webhook integrations, remote team access), front the gateway with Cloudflare Tunnel or Nginx with TLS termination and a valid certificate. Plain HTTP in production means credentials transit unencrypted β a risk no longer acceptable post-CVE-2026-25253. Cloudflare Tunnel has the additional advantage of not requiring any inbound port forwarding.
Replace the default password immediately β it is publicly documented and appears in automated scan signatures. Use gateway.auth.token or gateway.auth.password with a minimum 32-character random value generated by a password manager. Rotate gateway tokens quarterly and after any team member departure. Avoid storing the token in shell history (.zsh_history, .bash_history) β set it via environment variable instead.
docker run --read-only --cap-drop=ALLRun with read-only filesystem and drop all Linux capabilities
--memory=2g --cpus=2Set resource limits to prevent denial-of-service from runaway processes
--network=none (for isolated tasks)Disable network for tasks that don't need internet access
OPENCLAW_TZ=Your/TimezoneSet timezone explicitly for accurate logging and cron execution
The ClawHavoc campaign demonstrated that 800+ malicious skills infiltrated ClawHub β including credential stealers and malware loaders disguised as popular tools.
Never hardcode API keys in openclaw.config.yaml β config files get accidentally committed to Git, shared with support teams, and backed up to cloud storage where they can be discovered. Use the openclaw secrets workflow (openclaw secrets set ANTHROPIC_API_KEY) or export from your shell profile. The config file should reference ${ANTHROPIC_API_KEY} rather than the literal key.
The default ~/.openclaw/credentials/ directory stores API tokens in plaintext, which means any process running as your user can read them. On macOS, migrate to the system Keychain using openclaw secrets --backend=keychain. On Linux, use libsecret or a standalone secrets manager like pass. Plaintext credential files are the first thing malicious skills look for.
Create dedicated API keys for OpenClaw at each provider β separate from any keys used in your code or CI/CD β and set monthly spending caps 20-30% above your typical usage. This limits the blast radius if a key is compromised. Rotate all provider API keys on the first of each month, or immediately after any security incident.
Set chmod 600 on both ~/.openclaw/openclaw.config.yaml and the ~/.openclaw/credentials/ directory. On multi-user systems, a world-readable config file exposes your token to every logged-in user. Also set chmod 700 on the .openclaw/ directory itself to prevent directory listing.
OpenClaw updates frequently with critical security patches. Enable the built-in auto-updater or check releases weekly.