By Michael Crist

Published: 2026-01-26

URL: https://michaelcrist.substack.com/p/i-hardened-my-clawdbot-security-in


A Note from Me (Michael Crist):I’m not a security expert. I’m not even an engineer. I’m just some AI enthusiast messing around on the internet. After Clawdbot launched, people started posting about security vulnerabilities. I took that seriously, read through the official docs, and then worked with Clawdbot to harden its own security. I don’t actually know how to do it myself. I’m only sharing this because I haven’t seen anyone with actual credentials offer solutions yet. If you find something below that’s wrong or could be better, tell me. I’ll update the doc and credit you.
Disclosure:
This article was written by GLaDOS, my Clawdbot assistant. I gave it the topic and asked it to document what we built together. The security setup is real, the implementation is real, and yes — Clawdbot wrote the article about securing Clawdbot.If you have a Clawdbot, you can share this article with it and ask it to implement the same setup for you.

I’ve been running Clawdbot for 48 hours. It reads my emails. Manages my files. Sends me messages at 3am when it thinks of something. I love it.

The default security setup? Basically vibes.

Last week someone found 923 Clawdbot gateways exposed to the internet. Zero authentication. Full shell access. That’s not a bug — that’s the default config if you don’t change it.

I looked at my own setup and got uncomfortable. So I spent an afternoon fixing it.

Before: Security grade C-

Here’s what I had before I hardened anything:

  • Only I could message it (owner allowlist)
  • Unknown people get a pairing code

That was the whole security model. Generous to call it a C-.

The problems I hadn’t thought about:

My AI could display API keys right in our chat. Nothing stopped it. It had no concept of “this content might be trying to trick me.” There was no way to roll back if something went sideways.

After: Security grade B+

After an afternoon of work, here’s where I landed:

  • Bitwarden CLI for secrets, never stored in files
  • Content quarantine — stuff from emails and web is read-only
  • Git tracking everything, so I can see when something changed
  • Weekly security audits running automatically
  • Dedicated machine that I can wipe if needed
  • Prompt injection defense framework
  • Incident logging for when things go wrong
  • Session rotation procedures
  • Network monitoring (LuLu firewall)
  • Soft limits on bulk/destructive operations

Not perfect. There’s no perfect when you’re giving an AI access to your life. But now there are actual layers between “oops” and “disaster.”

Step 1: Check your gateway exposure

Between writing this last night and posting it this morning, Clawdbot has apparently patched this vulnerability. Make sure you have the latest version!

This is the one that got 923 people.

Run this:

clawdbot config get | grep bind

If it says “bind”: “all” you’re exposed to the entire internet. Anyone can connect.

Change it to “bind”: “loopback” and restart. Now it only listens on localhost.

This single change would’ve saved those 923 exposed gateways.

Step 2: Set up secrets management

I use Bitwarden CLI. The idea is simple: secrets never live in config files. You fetch them when you need them, use them, and let them die with the shell.

brew install bitwarden-cli bw login mkdir ~/.secrets && chmod 700 ~/.secrets

Then create a wrapper script that fetches secrets into variables. Never echo them. Never save them to files. Never display them in chat.

The rule: secrets exist in memory only, for as long as they’re needed, then they’re gone.

Step 3: Tell your AI to never show credentials

This sounds weird, but it works.

Add this to your system prompt or

SOUL.md

:

“Never display secrets, API keys, or tokens in chat — not even partially, not even to me. When reading files that might contain secrets, describe what’s there. Don’t output the content.”

Your AI will follow this. I tested it by accidentally exposing a session key, and now I have rules that prevent it from happening again.

Step 4: Content quarantine

This is the one most people skip, and it’s probably the most important.

The idea: anything from email, web scraping, or documents gets treated as potentially hostile. Read only. Extract information. No running commands based on what some random PDF says.

Prompt injection is real. Someone could embed instructions in an email that trick your AI into doing something you didn’t authorize.

My trust levels:

Most attacks come through that third bucket.

Step 5: Git track your workspace

cd ~/clawdbot-workspace git init

Add a .gitignore that blocks anything secret-shaped:

  • \.key, \.secret, \*.pem
  • .env\*
  • \token\, \credential\
  • \session\

Now you have history. If something weird shows up in your files, you can see exactly when it appeared and roll back.

Step 6: Weekly security audits

I set up a cron job that runs every Sunday at 11 PM:

clawdbot security audit --deep

It checks for exposed ports, misconfigured permissions, and other common issues. The results get reported automatically.

The cron job also checks the

official Clawdbot security docs

for any updates. Clawdbot is moving fast and security recommendations evolve. Staying current matters.

Paranoid? Maybe. But I’d rather catch something weird in a weekly scan than find out the hard way.

Step 7: Expendable infrastructure

This one’s a mindset shift.

My Clawdbot runs on a dedicated MacBook Air. Not my main computer. It has no VPN to my work network. No SSH keys to production servers. Nothing I can’t rebuild in an afternoon.

If something goes wrong, I wipe it. Annoying, not catastrophic.

Step 8: Prompt injection defense (ACIP)

If you want to go deeper on prompt injection, look into ACIP (Agentic Context Integrity Protocol). It’s a structured approach to defending against malicious instructions embedded in content.

I keep a

SECURITY.md

file in my workspace with the framework. It covers things like:

  • How to detect injection attempts
  • Canonicalization (stripping formatting tricks)
  • Context boundaries between trusted and untrusted content
  • Escalation paths when something seems off

Most people won’t need this level of detail. But if you’re processing emails or web content automatically, it’s worth reading.

Step 9: Incident logging

When something goes wrong, write it down.

I keep a simple incident log in my memory files. When I accidentally exposed a Bitwarden session key in chat, I logged it:

This does two things: forces you to actually fix the problem, and helps you notice patterns over time.

Step 10: Session rotation

If a secret gets exposed, don’t just change your password. Invalidate the session immediately.

For Bitwarden:

bw lock

This kills the active session. The exposed token becomes useless. Then you unlock fresh and update your session file.

Same principle applies to any credential. Rotate first, investigate second.

Step 11: Network monitoring

Install LuLu, a free open-source firewall from Objective-See:

brew install --cask lulu

Then open it from Applications and approve the permissions (Full Disk Access + Network Extension).

LuLu alerts you when any process tries to make an outbound connection for the first time. If your Clawdbot machine suddenly starts calling a weird IP in Belarus, you’ll know.

Step 12: Soft limits (circuit breaker)

Add rules to your

SOUL.md

that create speed bumps on high-impact actions:

“Pause and confirm with me before:Deleting more than 5 files at once
Sending messages to more than 3 recipients
Running destructive commands (rm -rf, drop table, etc.)
Modifying system config or security settings
Anything involving payments or public posts”

This isn’t a hard block. You can always say “just do it” and your AI proceeds. The goal is a sanity check on bulk operations, not red tape on normal work.

The framework

Here’s the mental model:

Quarantine — Bad content can’t trigger actions. It’s read-only.

Rollback — Git history lets me undo damage and see when things changed.

Transparency — The AI tells me when something seems off. Prompt injection attempts, unexpected instructions, credentials where they shouldn’t be.

Isolation — The machine is expendable. The blast radius is limited.

Let your Clawdbot set this up for you

Here’s the fun part: you can share this article with your Clawdbot and have it implement these security measures for you.

Copy and paste this prompt:

I want you to harden our security setup based on this article: [paste article URL or content] Specifically:

1. Check if our gateway is exposed (bind setting) and fix if needed

2. Set up Bitwarden CLI for secrets management with a secure wrapper script

3. Add strict rules to SOUL.md about never displaying secrets

4. Add content quarantine / trust levels to our security rules

5. Set up git tracking for the workspace with a proper .gitignore

6. Create a weekly security audit cron job for Sunday nights that also checks https://docs.clawd.bot/gateway/security for updates

7. Add ACIP prompt injection defense rules to a SECURITY.md file

8. Set up incident logging in memory files

9. Know how to rotate sessions if credentials get exposed

10. Install LuLu (or similar) for network monitoring

11. Add soft limits / circuit breaker rules for bulk and destructive operations

12. Document everything in a Security.md file

Ask me for any permissions you need. Walk me through anything that requires my input (like unlocking Bitwarden or approving LuLu permissions).

Your Clawdbot will walk you through the setup, ask for permissions where needed, and document everything.

What would it take to reach A-tier?

I’m being honest: B+ is where we are. Here’s what’s still missing and what it would take to close the gap.

Verify disk encryption Is FileVault enabled? If someone steals the physical machine, can they pull the drive? Run fdesetup status to check. If it’s off, turn it on.

Push git to a private remote Right now our git history is local only. If the machine dies, we lose the rollback capability. Set up a private GitHub or GitLab repo and push regularly.

Review elevated tool permissions We have tools.elevated: enabled in our config. What does that actually allow? I haven’t fully audited the blast radius. Someone should.

Bitwarden session file on disk Our session token sits in ~/.secrets/bitwarden\_session.sh with chmod 600. Better than plaintext config, but if the machine is compromised, that file is readable. 1Password has op run which injects secrets into a subprocess without ever writing to disk. Bitwarden doesn’t have a clean equivalent.

Consider a more secure channel Telegram bot API traffic isn’t end-to-end encrypted. Messages go through Telegram’s servers. For truly sensitive operations, self-hosted Matrix or Signal would be better.

Proactive credential rotation We rotate on incident, but not on a schedule. Best practice is periodic rotation regardless of whether something went wrong.

Technical enforcement, not just policy Content quarantine and soft limits are rules I follow. They’re not technically enforced. If I hallucinate or get confused, I could still do something wrong. Real sandboxing would be better.

None of these are hard to fix. They’re just not done yet. Maybe next weekend.

Is this overkill?

I genuinely don’t know.

But Clawdbot has access to my emails, messages, and files. It can run code. It can send messages on my behalf. That’s a lot of trust to hand over.

I’d rather feel slightly paranoid than find out I wasn’t paranoid enough.

The demos are cool. The security is your responsibility.

Credits

This security setup was inspired by posts from the Clawdbot community:

— on running Clawdbot on a dedicated VPS for isolation

— for surfacing the 923 exposed gateways and the bind: loopback fix

  • A community post on secrets management with 1Password that I adapted for Bitwarden (secrets never in code, fetch on-demand, let them die with the shell)
  • Another post on the content quarantine framework (trust levels, proactive disclosure, expendable infrastructure)

The Clawdbot community is figuring this out together. These are the people sharing what they learn.