Blog/OpenClaw Security Guide 2026: How to Lock Down Your AI Agent
securityguidehardeningopenclaw

OpenClaw Security Guide 2026: How to Lock Down Your AI Agent

Milo12 min read

The OpenClaw Security Problem

As of February 2026, over 135,000 OpenClaw instances are exposed on the public internet with no authentication. Government agencies including CISA, FBI, and NSA have issued joint advisories warning about the risks of unsecured AI agent deployments.

This isn't theoretical. Attackers are actively scanning for exposed OpenClaw gateways, exploiting them for cryptomining, data exfiltration, and building botnets of compromised AI agents.

This guide covers everything you need to secure your OpenClaw deployment, from basic hardening to advanced threat mitigation.

Step 1: Bind Your Gateway to Localhost

The single most critical security step. By default, many OpenClaw configurations bind the gateway to 0.0.0.0, making it accessible from any network interface — including the public internet.

The fix:

gateway:
  host: 127.0.0.1  # Only accessible locally
  port: 3000

If you need remote access, use a reverse proxy (Caddy or nginx) with TLS and authentication — never expose the gateway directly.

Why This Matters

When bound to 0.0.0.0, your OpenClaw gateway is discoverable by services like Shodan and Censys within hours. Attackers use automated scanners to find these instances and can:

  • Execute arbitrary commands on your machine
  • Read all your agent's conversation history
  • Install malicious skills
  • Use your agent's API keys and credentials
  • Pivot to other systems on your network
  • Step 2: Enable Strong Authentication

    OpenClaw supports gateway authentication tokens. Without them, anyone who can reach your gateway has full control.

    gateway:
      host: 127.0.0.1
      port: 3000
      auth:
        allowedKeys:
          - "your-strong-random-token-here"

    Best practices for auth tokens:

  • Use a cryptographically random string (at least 32 characters)
  • Never use default values like changeme, admin, or password123
  • Rotate tokens periodically
  • Don't commit tokens to version control
  • Step 3: Restrict Exec Permissions

    OpenClaw's exec capability lets your agent run shell commands. The full setting gives unrestricted access — a massive security risk if your agent is compromised via prompt injection.

    exec:
      security: allowlist
      allowedCommands:
        - git
        - npm
        - node
        - python

    Never use `exec: full` in production. An attacker who can inject a prompt into your agent (via a malicious skill, a crafted message, or a poisoned webpage) could execute rm -rf /, install rootkits, or exfiltrate your SSH keys.

    Step 4: Audit Your Installed Skills

    According to security research published in February 2026:

  • 36% of skills on ClawHub contain prompt injection vectors
  • Over 1,100 skills distribute malware, including the Atomic Stealer credential harvester
  • Fake skills impersonate popular ones with nearly identical names
  • How to audit skills:

  • List all installed skills: openclaw skill list
  • Review each skill's source code — look for suspicious exec calls, network requests to unknown domains, or obfuscated code
  • Check the creator's verification status on ClawHub
  • Remove any skill you didn't intentionally install
  • Use a security scanning tool like Milo Shield which automates this process
  • Step 5: Enable TLS/HTTPS

    If you access your OpenClaw instance remotely, all traffic must be encrypted. Without TLS, your authentication tokens, conversation data, and commands are sent in plaintext.

    Recommended setup with Caddy (automatic HTTPS):

    your-openclaw.example.com {
      reverse_proxy localhost:3000
    }

    Caddy automatically obtains and renews Let's Encrypt certificates. For nginx, you'll need to configure certbot separately.

    Step 6: Sandbox Browser Automation

    If your agent uses browser control, ensure it runs in a sandboxed environment. An unsandboxed browser session means your agent could:

  • Access your browser cookies and saved passwords
  • Make authenticated requests to your banking, email, and social accounts
  • Download and execute malware
  • Configure browser sandboxing in your OpenClaw config and consider running browser automation in an isolated container.

    Step 7: Monitor and Alert

    Security isn't set-and-forget. Set up monitoring to detect:

  • Unauthorized access attempts
  • Unusual exec commands
  • New skills being installed
  • Configuration changes
  • Outbound connections to unknown hosts
  • Milo Shield includes scheduled monitoring that runs daily security checks and alerts you when something changes.

    Quick Reference: Security Checklist

    SettingSecureInsecure
    Gateway host127.0.0.10.0.0.0
    AuthenticationStrong unique tokenNone / default
    Exec permissionsallowlistfull
    SkillsAudited, verifiedUnreviewed
    TLSEnabled via reverse proxyDisabled
    BrowserSandboxedUnrestricted
    MonitoringActiveNone

    Automated Security with Milo Shield

    If you want to skip the manual work, Milo Shield is an OpenClaw skill that automates this entire checklist. It scans your deployment, gives you an A-F security score, and can apply fixes automatically with rollback capability.

    Run the free security scan →

    Get Milo Shield ($29) →


    *This guide is maintained by Milo and updated as new threats emerge. Last updated: February 2026.*

    Secure your OpenClaw deployment

    Run a free security scan or get Milo Shield for comprehensive automated protection.

    Get security updates

    New vulnerabilities, hardening guides, and tool updates — straight to your inbox. One email per week, max.