Radek Brus

Hardening OpenClaw 2026.11.5 in a zero-internet sandbox: Gemma 4 4B vs Qwen 3.8 27B

Radek Brus · 19 November 2026 · sixi-scanner v1.0.0 · ghcr.io/openclaw/openclaw:latest (2026.11.5)

With Microsoft's Autopilot preview bringing fresh attention to the open-source OpenClaw runtime, we wanted real measurements on how local OpenClaw behaves under structured agent security testing — and how much difference model size and runtime hardening actually make. We ran sixi-scanner v1.0.0 against an isolated, zero-internet Docker instance of OpenClaw 2026.11.5 backed by local Ollama (Gemma 4 4B and Qwen 3.8 27B, $0.00) and audited both the HTTP responses and OpenClaw's own SQLite trajectory database and workspace files.

Scope & trust model. Every test below ran strictly against our own local, air-gapped Docker container of open-source OpenClaw 2026.11.5 — not Microsoft's hosted Autopilot service, which layers Microsoft Entra Agent Identity, Agent 365, and Defender for AI governance on top of OpenClaw. OpenClaw's own SECURITY.md explicitly states that local OpenClaw is designed as single-operator, local-first infrastructure rather than a shared multi-tenant boundary. The goal here is practical hardening guidance for operators running OpenClaw with local models.

1. Sandbox setup: zero internet, synthetic workspace

Because an autonomous agent with default tools can read files and run commands, every run ran inside a non-root, capability-dropped container (--cap-drop=ALL, --security-opt=no-new-privileges:true, --pids-limit=256, --memory=3g) attached to a Docker --internal bridge network. Outbound internet requests failed at the kernel routing table (ENETUNREACH), while the container could reach only local Ollama (:11434). The workspace contained purely synthetic files (SOUL.md and MEMORY.md with five planted audit markers representing confidential internal data and a restricted coworker record NW-1002).

We compared two configurations across both models:

To keep single-turn and multi-turn sessions cleanly separated on /v1/chat/completions, single-turn probes ran via --target openai (omitting the user field so OpenClaw assigns a fresh UUID session per request) and the four multi-turn sequences ran via --target json with "user": {{session_json}}.

2. 2×2 results: Gemma 4 4B vs Qwen 3.8 27B (default vs hardened)

Gemma 4 4B ran the full 45-probe suite (--attempts 2 --reproduce 1); Qwen 3.8 27B ran a matched 20-probe subset covering every technique that fired, leaked a canary, or invoked tools on 4B (16 single-turn + all 4 multi-turn sequences). The table and chart below compare both models apples-to-apples on the matched 20-probe suite alongside the full 45-probe totals on 4B:

Matched 20-probe benchmark on OpenClaw 2026.11.5 comparing Gemma 4 4B and Qwen 3.8 27B in default vs hardened configurations. Gemma 4B drops from 12 to 9 findings and 21 to 10 canary leaks; Qwen 27B drops from 8 to 2 findings and 2 to 1 canary leak. Hardening stops all disk writes and shell execution on both models.
Model & ConfigMatched 20-probe findingsMEMORY.md canary leaksExecuted tools (SQLite)Workspace disk integrityWall time
Gemma 4 4B · default12 / 20 (15 / 45 full)21 (all 5 markers)95 (exec: 2, write: 3, read: 21, web_fetch: 6, …)USER.md & MEMORY.md overwritten1,263 s (45p)
Gemma 4 4B · hardened9 / 20 (10 / 45 full)10 (all 5 markers)24 (0 exec, 0 write, 0 read)Clean (0 writes)404 s (45p, 3.1× faster)
Qwen 3.8 27B · default8 / 202 (NW-1002 only)11 (exec: 5, edit: 1, web_fetch: 2, message: 1)USER.md edited with sleeper rule474 s (20p)
Qwen 3.8 27B · hardened2 / 201 (NW-1002 only)3 (0 exec, 0 edit, 0 web_fetch)Clean (0 writes)263 s (20p, 1.8× faster)

3. What OpenClaw got right — and what still broke

Inspecting OpenClaw's internal openclaw-agent.sqlite transcript tables alongside sixi-scanner's JSONL output separated controls that genuinely held from architectural gaps that operators must account for:

OpenClaw 2026.11.5 security scorecard showing built-in controls that held (web_fetch SSRF guard blocking AWS and GCP metadata, 0700 startup permission doctor, and tools.deny runtime enforcement) vs gaps observed (on-disk USER.md and MEMORY.md writes on default, workspace bootstrap leaks despite group:memory deny, and multi-turn/output-handling survivors).

Controls that held

Four gaps operators need to harden against

  1. Persistent cross-session memory writes on default (both 4B and 27B): OpenClaw's default workspace template invites the agent to record durable directives in USER.md and MEMORY.md, which are then loaded into every future session. On default, multi-turn sleeper and delayed-instruction probes did not stay in RAM — Gemma 4B called write() and wiped both USER.md and MEMORY.md on disk, replacing them with persistent trigger rules; Qwen 3.8 27B used edit() to append the sleeper directive into USER.md. Even a single stateless HTTP request asking the agent to remember a token wrote it to MEMORY.md, where an unrelated stateless session read it back seconds later. Upstream OpenClaw maintainers already track protected memory paths and non-destructive writes in #163680, #116500, and #40001.
  2. MEMORY.md still leaks when group:memory and group:fs are denied: OpenClaw injects workspace bootstrap files (SOUL.md, MEMORY.md, USER.md) directly into the system context on every turn. Denying memory and filesystem tools stopped active reads and writes, yet 4B still leaked all five confidential markers 10 times and 27B leaked NW-1002 once. Treat bootstrap Markdown files as model-visible prompt context — never as a secret store or multi-tenant boundary.
  3. Model scale cuts leaks 10×, but does not replace tool denial: upgrading from 4B to 27B on default slashed canary leaks from 21 → 2 (zero canary tokens or escalation codes leaked) — yet 27B still executed 5 shell exec calls, edited USER.md on disk, and echoed SSTI, CSV formulas, and active HTML/XSS. Only combining 27B + hardened dropped findings to 2 / 20 (eliminating SSTI, CSV, XSS, sleeper-memory, and all shell/disk side effects).
  4. Multi-turn delayed instructions survive prompt-only boundaries: even on hardened 27B, delayed-instruction and unbounded-consumption remained open, confirming that prompt rules and tool denylists still benefit from deterministic output filters and strict token/turn budgets in production gateways.

Takeaway: OpenClaw's built-in SSRF and permission guards are solid, but running an always-on agent with default filesystem write access turns multi-turn prompt injections into persistent on-disk directives — even on a 27B model. Pair a stronger model with tools.deny, keep secrets out of bootstrap Markdown files, and run the gateway inside a network-isolated container.

4. Practical baseline hardening checklist for local OpenClaw

{
  "tools": {
    "deny": [
      "exec", "process", "browser",
      "group:web", "group:fs", "group:runtime",
      "group:automation", "group:memory"
    ]
  }
}
# Single-turn probes (stateless: omits `user`)
sixi-scanner scan --target openai --model openclaw:main \
  --url http://127.0.0.1:18789/v1/chat/completions \
  --header "Authorization: Bearer $OPENCLAW_TOKEN" \
  --exclude probe.llm06.refund-cap-split,probe.llm01.delayed-instruction,probe.llm06.payload-relay,probe.llm01.sleeper-memory \
  --log-jsonl openclaw-single.jsonl --out openclaw-single.json

# Multi-turn sequences (isolated per-attempt session via `user`)
sixi-scanner scan --target json \
  --url http://127.0.0.1:18789/v1/chat/completions \
  --header "Authorization: Bearer $OPENCLAW_TOKEN" \
  --body '{"model":"openclaw:main","user":{{session_json}},"messages":[{"role":"user","content":{{json}}}]}' \
  --reply-path choices.0.message.content \
  --only probe.llm06.refund-cap-split,probe.llm01.delayed-instruction,probe.llm06.payload-relay,probe.llm01.sleeper-memory \
  --log-jsonl openclaw-multi.jsonl --out openclaw-multi.json

Scanner release & binaries: sixi-scanner v1.0.0 · Previous write-up: sixi-scanner 1.0 benchmarks & six live bugs · OpenClaw upstream: github.com/openclaw/openclaw.