Security hardening guide for AI agents (OpenClaw/Moltbot/OpenClaw). Lock down gateway, fix permissions, set up auth. Based on real vulnerability research.
Security hardening guide for AI agents (OpenClaw/Moltbot/OpenClaw). Lock down gateway, fix permissions, set up auth. Based on real vulnerability research.
Your Moltbot gateway was designed for local use. When exposed to the internet without proper security, attackers can access your API keys, private messages, and full system access.
Based on: Real vulnerability research that found 1,673+ exposed OpenClaw/Moltbot gateways on Shodan.
TL;DR - The 5 Essentials
Bind to loopback — Never expose gateway to public internet
Set auth token — Require authentication for all requests
Fix file permissions — Only you should read config files
Update Node.js — Use v22.12.0+ to avoid known vulnerabilities
Use Tailscale — Secure remote access without public exposure
Prompt injection attack example: An attacker sends you an email with hidden instructions. Your AI reads it, extracts your recent emails, and forwards summaries to the attacker. No hacking required.
Quick Security Audit
Run this to check your current security posture:
openclaw security audit --deep
Auto-fix issues:
openclaw security audit --deep --fix
Step 1: Bind Gateway to Loopback Only
What this does: Prevents the gateway from accepting connections from other machines.
Check your ~/.openclaw/openclaw.json:
{"gateway":{"bind":"loopback"}}
Options:
loopback — Only accessible from localhost (most secure)
lan — Accessible from local network only
auto — Binds to all interfaces (dangerous if exposed)