If you’d rather shut down your instance entirely instead of hardening it, see Terminate Your Instance. Not sure which path to take? See the Security Overview for context.
Before you start
Check if you’re already exposed. Look up your server’s public IP on the OpenClaw Exposure Watchboard. If your instance appears there, it is actively reachable from the internet. Find your public IP with:Step 1: Update OpenClaw
The single most impactful step is running a current version. Several critical vulnerabilities — including the ClawJacked WebSocket hijack (CVE-2026-25253, CVSS 8.8) — were patched in v2026.2.25. Older versions remain vulnerable regardless of other hardening steps.Step 2: Block the gateway port
This is the most impactful single step for instances running on a public VPS. OpenClaw’s gateway listens on port 18789 by default. Blocking inbound access to this port from the internet makes your instance invisible to the scanners that found 258,305 exposed instances.- UFW (Ubuntu/Debian)
- firewalld (RHEL/CentOS/Fedora)
- iptables
- Cloud firewall console
Step 3: Bind the gateway to localhost
Even with a host firewall, configure OpenClaw itself to listen only on the loopback interface. This is a defense-in-depth measure: if a firewall rule is ever misconfigured or temporarily disabled, the gateway is not reachable from the network. Edit~/.openclaw/openclaw.json (JSON5 format):
"all" (binds to 0.0.0.0). On v2026.1.29 and later, "loopback" is the default — verify your config explicitly if you upgraded from an older version.
Step 4: Enable strong authentication
Verify that authentication is configured and set a strong auth token (32+ characters):Step 5: Use zero-trust access for remote connections
If you need to access your instance remotely, use a zero-trust tunnel instead of opening ports. Tailscale is the most commonly cited option in community hardening guides — it creates an encrypted overlay network and makes your instance completely invisible to internet scanners. Install Tailscale on your server:Step 6: Put a reverse proxy in front
If you need public HTTPS access (e.g., for webhook integrations), put a reverse proxy in front of the gateway rather than exposing the gateway port directly. The proxy adds TLS termination, authentication headers, and rate limiting.- Caddy
- Nginx
Caddy handles TLS certificates automatically via Let’s Encrypt.See Caddy documentation for full configuration options.
Step 7: Lock down file permissions
OpenClaw credential files in~/.openclaw/ are protected only by filesystem permissions. Restrict access:
Step 8: Audit and lock down skills
Koi Security audited the ClawHub marketplace and found 341 malicious skills out of 2,857 reviewed. One of them was the #1 most-downloaded skill. The count later grew to 1,184 as more were identified. For each installed skill:- Review the skill’s source code before enabling it
- Check the ClawHavoc report for the skill name
- Disable any skill you didn’t explicitly install or can’t verify
~/.openclaw/openclaw.json:
Step 9: Rotate all secrets
If your instance was ever publicly reachable — even briefly — assume that credentials may have been read. Rotate everything the agent had access to:- Gateway token — Generate a new one as described in Step 4
- LLM API keys — OpenAI, Anthropic, Google, or any other provider key stored in
~/.openclaw/ - Connected account tokens — Any OAuth tokens or API keys for integrations (Gmail, Slack, GitHub, Notion, etc.)
- SSH keys — If the agent had SSH access, generate new keys and remove old authorized keys
Step 10: Ongoing monitoring
Enable audit logging
Enable audit logging
OpenClaw records session transcripts (tool calls, arguments, results) as local files. Enable and review these regularly:For centralized logging (recommended if the host is shared), configure the optional OpenTelemetry exporter documented in the OpenClaw docs.
Run the built-in security audit
Run the built-in security audit
OpenClaw ships a built-in security check command:Run this after initial hardening and periodically thereafter. It checks authentication configuration, network binding, file permissions, and known-vulnerable skill versions.
Monitor for brute-force attempts
Monitor for brute-force attempts
Install fail2ban to automatically block IPs that repeatedly fail authentication:Configure a jail for OpenClaw’s auth log path. See the fail2ban documentation for setup details.
Pin versions and review changelogs
Pin versions and review changelogs
OpenClaw has had 90+ security advisories. Pin to a specific version and review the release notes and security advisories before updating:
Community hardening guides
The security community published extensive hardening resources in response to the 2026 exposure crisis. The following guides are cited sources for this documentation:- DefectDojo: The OpenClaw Hardening Checklist — In-Depth Edition
- Clawctl: The Hardening Guide Nobody Wants to Write
- Penligent: A Practical Hardening and Validation Playbook
- Awesome Agents: How to Actually Secure OpenClaw
- Brian Christner: OpenClaw Security Checklist
- Fernando Lucktemberg / AI Maker: OpenClaw Security Hardening Guide
- Easton: Secure OpenClaw Deployment
- HAProxy: Properly Securing OpenClaw with Authentication