← Anvil Scanner

Guide · Cloud Security

Securing Your Self-Hosted OpenClaw on AWS

You put a powerful AI agent — one with access to your files, tools, and API keys — on a public cloud server. Here’s how not to get owned.

By David Moore, Anvil Cloud · June 2026

Self-hosting OpenClaw is great: it’s your own personal AI assistant, on your own box, your way. But the moment you spin it up on a public EC2 instance (or any cloud VM), you’ve created something attackers love — an internet-reachable host running an agent that can read files, execute tools, and hold valuable API keys. Bots scan new public IPs within minutes of launch, and most people deploy OpenClaw and never harden the host underneath it.

This is the checklist I run on every OpenClaw deployment. It’s cloud-first, with AWS specifics called out, and it’s the same set of checks I automated into Anvil Scanner — more on that at the end.

The threat model, in one breath

An exposed OpenClaw host typically gets hit through: open management/gateway ports, weak SSH, an unpatched host or known OpenClaw CVE, an over-privileged agent (tools run on the host with full access by default), leaked LLM API keys, and — on AWS specifically — the instance metadata endpoint. Let’s close each.

1. Lock down network exposure (AWS Security Groups)

Your security group is your first and most important control.

2. Enforce IMDSv2 and scope the instance role (the AWS gotcha for AI agents)

This one is specific to AWS and specific to agents, and it’s the step most people miss.

OpenClaw can browse, call tools, and act on untrusted input — which means a prompt injection or SSRF can try to reach the EC2 instance metadata endpoint (169.254.169.254) and steal your instance’s IAM credentials. Defend it:

3. Harden SSH

SSH is the other door bots hammer constantly.

(There are ~40 individual SSH settings worth checking — algorithms, permissions, login limits — which is exactly the kind of tedium worth automating.)

4. Patch the host, and watch OpenClaw’s CVEs

5. Constrain the agent’s blast radius

By default, OpenClaw runs tools on the host with full access for your main session — convenient when it’s just you, dangerous if anything untrusted reaches it.

6. Harden the container (if you run it in Docker)

7. Protect your secrets

Your LLM API keys (Claude, OpenAI, etc.) are real money and real blast radius if leaked.

8. Know what the internet already sees

Within minutes of going live, your public IP is indexed by scanners like Shodan. Check what’s exposed (Shodan’s free InternetDB is a fine start), watch for open ports you didn’t intend, and keep an eye out for indicators of compromise (suspicious cron jobs, unexpected processes, auth-log anomalies).

Automate all of this

Doing the above by hand, on every box, every time you change something, is exactly the kind of error-prone tedium that gets skipped — and skipped security is how people get popped.

That’s why I built Anvil Scanner — a single static binary (no Python, no pip) that runs every check above and more: host + SSH (44 checks) + firewall hardening, container runtime + image CVE scanning, threat intelligence (Shodan, CVE exposure, CISA KEV, local IoC), an openclaw security audit pass, an encrypted secrets store, and an AI-generated risk score with prioritized recommendations. It snapshots every file before it changes anything and can revert in one command. Linux, macOS, Raspberry Pi, and Windows.

# Full scan: host + OpenClaw + threat intel + AI analysis
sudo anvil-scanner

# Apply the hardening fixes (everything is backed up first)
sudo anvil-scanner --harden

It’s free for internal use on OpenClaw deployments you own or operate. Point it at your box, read the report, and fix the red lines before someone else finds them.

Security is continuous, not a one-time pass — re-scan after every change. Stay safe out there.

Built something you self-host on the public internet? I’d genuinely like to hear what tripped you up — the failure modes are where the good checklists come from. info@anvilcloud.ai

Scan. Score. Harden.

Get Anvil Scanner from GitHub, or talk to us about rolling it out across your fleet.

View on GitHub → Email Us