Skip to content

Harden sandbox against agent config tampering (defense-in-depth) #516

Description

@ericksoa

Context

#514 locks openclaw.json with filesystem permissions after startup. This issue tracks the remaining defense-in-depth measures to further harden the sandbox against agent self-modification attacks.

Hardening items

1. Tool policy deny list

Add .openclaw/openclaw.json and gateway restart commands (e.g. openclaw gateway run, kill) to SandboxToolPolicy.deny for the write, edit, and exec tools. This provides a software-level control independent of filesystem permissions.

2. Move config outside writable zone

Mount openclaw.json under a read_only path (e.g. /etc/openclaw/) instead of /sandbox/.openclaw/. This ensures the sandbox filesystem policy itself prevents writes, rather than relying on Unix permissions alone.

3. Enforce Landlock (drop best_effort)

Change landlock.compatibility from best_effort to enforce in nemoclaw-blueprint/policies/openclaw-sandbox.yaml. Audit for any functionality that breaks under strict enforcement.

4. Re-evaluate dangerous auth defaults

scripts/nemoclaw-start.sh sets allowInsecureAuth: True and dangerouslyDisableDeviceAuth: True in the gateway config. Evaluate whether these can be removed or scoped more narrowly (e.g. only in local development mode, not when CHAT_UI_URL points to a remote origin).

5. Lock parent directory

After #514's file-level lock, the agent can still delete openclaw.json from the parent directory if /sandbox/.openclaw/ is writable. Consider locking the directory to root:root 555 while keeping subdirectories (e.g. agents/) writable, or restructuring the directory layout.

Priority

Items 1-2 provide the strongest additional protection. Items 3-5 are incremental hardening.

Activity

  1. added
    enhancement
    on Mar 20, 2026
  2. added a commit that references this issue on Mar 22, 2026
    4ba73de
  3. BenediktSchackenberg commented on Mar 22, 2026

    @BenediktSchackenberg
    Contributor

    opened #654 for this — covers items 1 (tool policy deny list), 2 (config moved to /etc/openclaw/), and 5 (parent dir locked down).

    items 3 (landlock enforce) and 4 (auth defaults) are documented as TODOs but not implemented yet. landlock enforce needs way more testing before we flip it, and auth defaults need a broader discussion about what the production story should look like.

    builds on top of the permission fix from #514.

  4. added 3 commits that reference this issue on Mar 22, 2026
    e8c9802
    9b19ce8
    211f81f
  5. cluster2600 commented on Mar 24, 2026

    @cluster2600
    Contributor

    Verified on a live sandbox (openshell 0.0.14, base image) — rm -rf /sandbox/.openclaw succeeds despite the sticky bit on the parent directory.

    The sticky bit prevents unprivileged users from deleting files owned by other users inside a directory, but it doesn't prevent deleting the directory itself if the parent (/sandbox) is writable by the sandbox user. Since /sandbox is in the read_write Landlock policy, the sandbox user can remove .openclaw entirely.

    On the OpenClaw image with the immutability fix (#588), the files inside are root-owned so the sticky bit does protect them individually — but the directory structure itself can still be removed if the parent allows it.

    Reproduction:

    $ id
    uid=998(sandbox) gid=998(sandbox) groups=998(sandbox)
    $ rm -rf /sandbox/.openclaw
    $ echo $?
    0
    

    Suggestion: add /sandbox/.openclaw to the Landlock read_only list so the kernel prevents any modification, regardless of DAC permissions.

  6. BenediktSchackenberg commented on Mar 24, 2026

    @BenediktSchackenberg
    Contributor

    Hey — picked up on cluster2600's finding here. Added /sandbox/.openclaw to the Landlock read_only list in the sandbox policy so the agent can't nuke its own config even though /sandbox is writable. Fix is in PR #654.

  7. added 3 commits that reference this issue on Mar 24, 2026
    7a2848f
    9571811
    c72e42e
  8. added a commit that references this issue on Apr 14, 2026
    6020536
  9. added a commit that references this issue on Apr 14, 2026
    488e73e
  10. removed
    enhancement
    on Jun 8, 2026
  11. added
    area: policy
    area: security
    integration: openclaw
    on Nov 17, 2026
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

    area: policyarea: securityintegration: openclaw

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions