Skip to content

fix(sandbox): Landlock + relative-token block for workspace FS escapes - #74

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/high-severity-issues-26f5
Draft

fix(sandbox): Landlock + relative-token block for workspace FS escapes#74
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/high-severity-issues-26f5

Conversation

@cursor

@cursor cursor Bot commented Aug 26, 2026

Copy link
Copy Markdown

Summary

CRITICAL workspace escape that survived open PRs #66/#68:

With sandbox.enabled + workspace_only, has_path_chars only flags tokens starting with / ~ .. Concrete trigger on main:

  1. python3 -c 'import os; os.symlink(os.path.join(os.sep,"etc","passwd"),"leak")' → allowlist allow (no absolute / fragment; survives fix(sandbox,gateway): shell allowlist quoted-path bypass + bind to configured host #68 embedded-path scan)
  2. cat leak → allowlist allow (bare relative name)

unshare(CLONE_NEWNS) alone does not hide the host FS, so the shell tool could read host secrets.

Fix

  1. sandbox_exec: when workspace_path is set, apply a Linux Landlock ruleset (workspace RW + minimal RO system paths for /bin/sh / interpreters). Blocks symlink and chr(47) / os.sep indirection at execution time.
  2. allowlist_check_shell_command: resolve bare relative tokens against the workspace and reject when realpath escapes (defense-in-depth for cat leak).

Test plan

  • tests/test_allowlisttest_relative_symlink_indirection
  • tests/test_sandbox — Landlock symlink + obfuscated python /etc/passwd read blocked
  • Manual PoC: cat leak blocked by allowlist; sandbox output has no root:x:
Open in Web View Automation 

cursoragent and others added 2 commits August 26, 2026 11:13
…kens

Allowlist only flagged tokens starting with / ~ ., so relative symlink
indirection (python os.sep symlink + cat leak) and interpreter path
obfuscation bypassed workspace_only. Namespaces alone do not hide the
host FS. Apply Landlock to the configured workspace in sandbox_exec and
resolve bare relative tokens against the workspace in the allowlist.

Co-authored-by: esadrianno <esadrianno@gmail.com>
Passing REFER/TRUNCATE in handled_access_fs makes create_ruleset fail
on ABI 1, skipping the whole FS policy. Probe the ABI, mask unknown
bits, and pass the ABI-1 attr size to avoid E2BIG.

Co-authored-by: esadrianno <esadrianno@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant