Skip to content

fix(sandbox,gateway): shell allowlist quoted-path bypass + bind to configured host - #68

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-bug-management-a285
Draft

fix(sandbox,gateway): shell allowlist quoted-path bypass + bind to configured host#68
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-bug-management-a285

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Two HIGH-severity security fixes from the critical bug hunt:

  1. Shell allowlist quoted/embedded path bypass (sandbox/allowlist.c)

    • With sandbox.enabled + workspace_only, whitespace tokenization never saw paths inside quotes or -c strings (e.g. cat '/etc/passwd', python3 -c "open('/etc/passwd')"), so the command was allowed.
    • Sandbox namespaces do not chroot; the allowlist is the host FS gate.
    • Fix: scan the full command for absolute path fragments, strip surrounding quotes on tokens, fail-closed on OOM.
    • Default sandbox is still OFF unless configured; example config enables it.
  2. Gateway ignored gateway.host for listen bind (gateway/http.c)

    • http_start read host only to reject literal 0.0.0.0 without allow_bind_all, but never set lws info.iface.
    • LWS defaults iface=NULLINADDR_ANY, so a configured host = "127.0.0.1" still listened on all interfaces.
    • Fix: set info.iface = host unless binding all (0.0.0.0/* with allow_bind_all).

Test plan

  • tests/test_allowlist — new cases for quoted paths and python -c embedded /etc/passwd
  • Gateway integration: with host=127.0.0.1, confirm listen is loopback-only (ss -ltnp / external connect fails)
  • With allow_bind_all=true and host=0.0.0.0, confirm all-interfaces bind still works
Open in Web View Automation 

cursoragent and others added 3 commits August 16, 2026 11:08
Whitespace tokenization missed cat '/etc/passwd' and python -c
open('/etc/passwd') when workspace_only=1. Scan the full command for
absolute path fragments, strip surrounding quotes on tokens, and
fail-closed on OOM. Sandbox namespaces do not chroot, so this is the
host FS gate.

Co-authored-by: esadrianno <[email protected]>
http_start read gateway host but never set lws info.iface, so LWS
defaulted to INADDR_ANY even when host was 127.0.0.1. Pass host through
as iface unless allow_bind_all with 0.0.0.0/*.

Co-authored-by: esadrianno <[email protected]>
The embedded-path scanner treated every '/' as an absolute path, so
echo 3/4, ls src/foo, and curl https://example.com/api were blocked.
Only treat '/' or '~' as a filesystem path when they start a new token,
while still catching file:///etc/passwd.

Co-authored-by: esadrianno <[email protected]>
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