Skip to content

Observation: agent created on 2026.7.1 (sandbox=all, sandboxExecServer OFF) routes exec to the gateway host; a 2026.6.11-created agent with identical config routes into the sandbox #108236

Closed as not planned

Description

@kgerman-ar

Framing

This is an observation, not a proven mechanism. We could not isolate the exact code path, so we are reporting the reproducible outward behavior and what we ruled out, in case it is a known creation/runtime-state regression or something a maintainer can spot quickly.

Observation

On a single 2026.7.1 gateway (rootless Docker, Codex runtime, openai gpt-5.x), two agents with byte-identical effective sandbox config behave differently for exec/native shell:

  • An agent created on 2026.6.11 → exec runs inside the sandbox container (correct).
  • An agent created fresh on 2026.7.1 (standard agents add, no manual tuning) → exec runs on the gateway host (not sandboxed).

The divergence correlates with the OpenClaw version at agent creation time, not with config.

Environment

  • Rootless Docker, sandbox scope: agent, custom sandbox image.
  • agents.defaults.sandbox = { "mode": "all", "scope": "agent" }.
  • Codex plugin config is just { "enabled": true } — appServer.experimental.sandboxExecServer is NOT set (default off).

Reproduction (observational)

  1. On a 2026.7.1 gateway with the config above, create agent B via standard agents add (no --agent-dir, no manual sandbox block — it inherits agents.defaults.sandbox).
  2. Trigger a real turn (via a bound channel), asking it to run: pwd; command -v gh; ls /workspace.
    • Observed for B (created on 7.1): pwd=/home/node/.openclaw/workspace-<B> (host path), /workspace absent, gh absent → exec on host.
  3. Agent A, created earlier on 2026.6.11, same effective config, same gateway → same trigger → pwd=/workspace, gh present → exec in the sandbox.
  4. openclaw sandbox explain --agent <A|B> is identical for both (runtime: sandboxed, mode: all, scope: agent, same mounts/tool policy). Agent B's sandbox container starts healthy (no mount error).

What we ruled out

Question for maintainers

Is there a version-tied creation/runtime state that gates whether a Codex agent's exec routes into the sandbox (with sandbox.mode=all and sandboxExecServer off), which would differ between an agent created on 2026.6.11 vs one created on 2026.7.1 with identical effective config? Agents created before 7.1 keep working across the 6.11→7.1 upgrade; only agents newly created on 7.1 exhibit host-exec.

No secrets included; reproduction is self-contained.

Activity

  1. added
    P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.
    impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.
    on Jul 16, 2026
  2. clawsweeper commented on Jul 16, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 31, 2026, 1:56 AM ET / 05:56 UTC.

    Summary
    Keep this issue open for security-focused maintainer investigation. The reported host execution contradicts the documented fail-closed Codex behavior for an active OpenClaw sandbox, and the Linux and Windows observations cover different triggers; however, the creation-time state difference has not been isolated or reproduced against current main.

    Reproducibility: no. high-confidence current-main reproduction was established in this read-only review. The report contains detailed, independently matching Linux and Windows observations, but the exact current-main routing and persisted-state inputs still need owner-run instrumentation.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.
    • Include redacted logs or terminal output.

    Maintainer decision needed

    Question Recommendation
    Should maintainers prioritize an instrumented current-main reproduction that compares fresh and pre-existing Codex thread/session state before choosing a repair boundary? Instrument and reproduce on current main: Recommended: capture resolved sandbox state, Codex thread initialization, native Code Mode selection, and dynamic-tool exposure for a fresh and an older agent on the same gateway before patching.

    Why: The available evidence establishes a potentially severe boundary violation but does not identify whether the owner is agent creation, persisted Codex state, thread resume, or tool-surface assembly; choosing a permanent fix without that attribution risks preserving a host-execution path.

    Next step
    Security-sensitive routing is not yet attributed to a narrow source boundary, and the item already carries clawsweeper:no-new-fix-pr plus security-review routing; do not dispatch an autonomous repair.

    Security
    Needs attention: The issue reports a plausible sandbox-boundary bypass that can run agent commands on the gateway host, requiring owner-led security investigation before any automated repair.

    Review details

    Best possible solution:

    Record the resolved execution environment when a Codex thread is created or resumed, then enforce one canonical fail-closed decision: native host execution is unavailable during an active OpenClaw sandbox unless the explicit sandbox exec-server path is successfully registered; add regression coverage for both newly created and pre-existing agents.

    Do we have a high-confidence way to reproduce the issue?

    No high-confidence current-main reproduction was established in this read-only review. The report contains detailed, independently matching Linux and Windows observations, but the exact current-main routing and persisted-state inputs still need owner-run instrumentation.

    Is this the best way to solve the issue?

    Unclear. The documented contract already calls for fail-closed behavior, but the evidence does not yet identify whether the repair belongs in fresh-agent initialization, persisted thread/session state, or Codex tool-surface selection.

    AGENTS.md: unclear because the file could not be read completely.

    Remaining risk / open question:

    • If the observation is confirmed, a sandboxed agent can execute commands on the gateway host and access host-visible paths or credentials despite an operator-selected isolation boundary.
    • The report may involve persisted Codex thread/session initialization or agent-creation state rather than the current sandbox configuration, so a configuration-only repair could leave existing affected agents unsafe.

    Codex review notes: model internal, reasoning high; reviewed against bc63c6698877.

    Label changes

    Label justifications:

    • P0: A confirmed execution escape from an active agent sandbox to the gateway host is an emergency security-boundary failure.
    • impact:security: The report concerns command execution outside an operator-configured sandbox and potential exposure of gateway-host data or credentials.
    Evidence reviewed

    Security concerns:

    • [high] Investigate reported gateway-host execution
      Two independent reports say an agent with active sandbox.mode: all executed shell commands on the gateway host. If confirmed, this defeats the operator-selected sandbox boundary and can expose host-visible data or credentials.
      Confidence: 0.78

    What I checked:

    • Current documented security contract: The current Codex harness documentation says that an active OpenClaw sandbox disables Codex-native execution surfaces that would otherwise run from the app-server host; the supported stable outcome is sandbox-backed dynamic tools or a fail-closed denial, not host execution. (docs.openclaw.ai) Public docs: docs/plugins/codex-harness-reference.md. (docs/plugins/codex-harness-reference.md, bc63c6698877)
    • The contract predates the reported release: The same fail-closed guidance is present in the published 2026.6.10 package documentation, before the reported affected v2026.7.1 release, so the reported behavior is not an intentional creation-time policy described by the supported path. (app.unpkg.com) (docs/plugins/codex-harness-reference.md)
    • Independent cross-platform observation: The issue body reports the behavior on rootless Linux Docker through a channel turn, and the follow-up reports the same host-routing outcome on Windows Docker Desktop through openclaw agent; both state that the agent sandbox container was healthy and that sandboxExecServer was unset. (github.com)
    • Related PathUri repair is adjacent, not a replacement: Merged PR 107644 repaired URI decoding only on the explicitly enabled sandbox exec-server boundary. Its documented runtime proof starts that exec-server, whereas this issue states that the feature is off; it therefore does not establish a fix for this report. (github.com) (extensions/codex/src/app-server/sandbox-exec-server/processes.ts, e481ed422966)
    • Current-main and release status: No source-backed fix commit for the exec-server-disabled host-routing path was identified in the supplied issue history. The latest supplied release is v2026.7.1, the version named by both reports, while current main is bc63c66988777a8eece7c019e9f6d520b665c9c3; this is not safe to close as implemented. (bc63c6698877)
    • Related-area provenance: Release history attributes Codex app-server hardening that blocks native execution when OpenClaw resolves execution away from a safe local path to Josh Avant, making that area a useful routing lead; the merged PathUri boundary repair was contributed by Yu-Xin C and merged by Peter Steinberger. (openclaw-hub.com) (extensions/codex/src/app-server, e481ed422966)

    Likely related people:

    • joshavant: Release history credits work that blocks unsafe Codex native-execution paths and work that disables native Code Mode when sandbox path representation is unsafe. (role: recent area contributor; confidence: medium; files: extensions/codex/src/app-server, docs/plugins/codex-harness-reference.md)
    • yu-xin-c: Authored merged PR 107644, which owns the neighboring Codex sandbox exec-server protocol boundary but does not cover the disabled-feature path reported here. (role: adjacent boundary contributor; confidence: medium; commits: e481ed422966; files: extensions/codex/src/app-server/sandbox-exec-server/processes.ts)
    • steipete: Merged the nearby sandbox exec-server PathUri repair, providing a history signal for routing a cross-boundary Codex sandbox investigation. (role: merger of adjacent sandbox-boundary repair; confidence: low; commits: e481ed422966; files: extensions/codex/src/app-server/sandbox-exec-server)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  3. Sarts-eng commented on Jul 20, 2026

    @Sarts-eng

    We can add an independent reproduction of this on Windows, same creation-time cohort, different platform and turn-trigger — which may help narrow the persisted-state theory.

    Environment

    • OpenClaw 2026.7.1 (2d2ddc4), native Windows 10 Pro gateway (Scheduled Task, loopback bind), Node 24.18.0.
    • Docker Desktop (WSL2 backend). Sandbox: mode: "all", scope: "agent", backend: "docker", custom bookworm-slim image, container on an --internal network with egress only via an allowlisting proxy.
    • Binds: a read-only repo mount and a read-only single-file secret mount → /run/secrets/github-token.
    • Codex plugin { enabled: true }; appServer.experimental.sandboxExecServer is NOT set (same as OP). Agent model: openai/gpt-5.6.
    • Turns triggered via CLI (openclaw agent --agent <id> -m "...") — not a bound channel — so the symptom is not channel-specific.

    Key facts matching the creation-time observation

    • The affected agent was created 2026-07-16 on 2026.7.1 (fresh agents add during a rebuild; no manual sandbox block — inherits the configured sandbox).

    • sandbox config validates and resolves mode=all; the agent-scoped sandbox container is created and healthy at turn time — verified from the host: docker inspect shows all binds; docker exec <container> ls -la /run/secrets/ shows the expected single-file token. The mount is fine.

    • Yet an agent-turn exec of ls -l /run/secrets/ executes on the gateway host as Windows PowerShell:

      ls : Cannot find path 'C:\run\secrets\' because it does not exist.
      + CategoryInfo : ObjectNotFound: (C:\run\secrets\:String) [Get-ChildItem], ItemNotFoundException
      
    • Tool-action audit timeline (UTC): sandbox container created 07:19:47; the agent run's bash tool actions at 07:21–07:25 still executed on the host — i.e. after the container was up, so not a startup race.

    What we ruled out (beyond OP's list)

    • Per-agent tools.profile: "minimal" interaction. Our agent originally carried a per-agent minimal profile (with exec in tools.allow). We unset tools.profile, openclaw config validate clean, supervised gateway restart clean — behavior unchanged: exec still on host. So the profile/registry interaction is not the mechanism.
    • Mount/container health (above) — the sandbox side is fully operational; only the exec routing bypasses it.
    • Config drift: the effective sandbox block (mode/scope/backend/binds/proxy env) was read back and matches the intended config exactly.

    Signal for the maintainers

    Our data point strengthens the creation-on-2026.7.1 correlation across: platform (Windows/Docker Desktop vs rootless Linux Docker), trigger path (CLI openclaw agent vs bound channel), and sandbox image. Happy to provide a redacted diagnostic bundle or run instrumented builds against this setup on request.

    (Mitigation we applied meanwhile, for anyone else affected: deny exec on the affected agent — tools.deny — until this is fixed; deny wins over allow.)

  4. essentiaMarco commented on Aug 5, 2026

    @essentiaMarco

    Localization note for #108236

    Scope: Analysis only at PIN fa13cf4f…. No fix PR (no-new-fix-pr).

    What we can support

    With sandbox.mode=all and sandboxExecServer off, Codex fail-closes native Code Mode and exposes sandbox_exec as a rename of OpenClaw exec. Unlike node_exec (which pins host: "node"), sandbox_exec does not pin host: "sandbox". Args are forwarded; if effective host resolves to gateway (config / session / elevated), the runtime ignores the attached sandbox backend even while the Docker sandbox remains healthy and the tool is still named sandbox_exec.

    This is source-localized and harness-validated against PIN (no Docker required for the mechanism checks): sandbox_exec forwards host:"gateway"; node_exec rewrites to node; resolveExecTarget gateway/elevated drops sandbox backend.

    What does not explain the “created on 6.11 vs 7.1” half

    Comparing tags v2026.6.11 vs v2026.7.1, the focused sandbox_exec alias body is byte-identical. The no-host-pin hole already existed on 6.11. A 6.11→7.1 code change to this alias is not a supported explanation for creation-time divergence.

    Creation-time (still open)

    agents add / applyAgentConfig do not stamp tools.exec.host or sandbox overrides. Strongest remaining candidate (source only, not live-proven): durable per-agent Codex thread binding / session state — resume can prefer sticky binding.sandbox, while a newly created agent has an empty binding and takes first thread/start under current runtime. We did not run live old-vs-new agent A/B here.

    Ask for owners / reporters

    One turn each on old vs new agent, same config, log:

    1. sessionEntry.execHost / execNode
    2. Codex binding: present? threadId, binding.sandbox, approval/network fingerprints
    3. Sandbox context for the turn: enabled, backendId, sessionKey
    4. nativeToolSurfaceEnabled + advertised tools
    5. Effective exec host + whether defaults.sandbox was attached
    6. uname/pwd (container vs host)

    Suggested fix direction (not implemented)

    Pin host: "sandbox" on sandbox_exec (mirror node_exec); fail-closed when sandbox enabled if host would be gateway; no silent elevated→gateway under active sandbox. Defer creation-time policy until the log tuple above attributes the sticky-state hypothesis.

    LMK if you like to see the full Bug Report. Happy to share.

  5. openclaw-barnacle commented on Aug 19, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  6. openclaw-barnacle commented on Aug 26, 2026

    @openclaw-barnacle

    Closing due to inactivity.
    If this is still an issue, please retry on the latest OpenClaw release and share updated details.
    If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions