Skip to content

security(windows): elevated sandbox ACL setup has a path replacement race #728

Closed

Description

@PierrunoYT

Summary

Elevated Windows sandbox setup inspects and modifies ACL targets through separate pathname operations without binding those operations to a no-follow handle or stable file identity.

A lower-privileged process able to rename or replace a user-controlled workspace/ACL target with a junction during setup may redirect inherited capability-SID ACLs onto an unintended directory.

Affected code

  • internal/sandbox/windows_setup_windows.go:12-18 requires elevated setup.
  • internal/cli/sandbox.go:127-175 collects workspace/profile paths before launching the elevated helper.
  • internal/sandbox/windows_acl_apply_windows.go:75-135 performs Stat, GetNamedSecurityInfo, and SetNamedSecurityInfo by pathname.
  • internal/sandbox/windows_acl_apply_windows.go:147-183 installs inheritable capability-SID ACEs.
  • internal/sandbox/windows_runner.go:573-607 places the capability SID in later restricted tokens.

Race outline

  1. Begin elevated sandbox setup for a path the invoking user can rename or replace.
  2. Between pathname validation and ACL mutation, replace a path component or target with a junction/reparse point.
  3. The elevated helper reopens the pathname and may apply the capability ACL to the replacement target.
  4. Later restricted sandbox tokens containing that SID may receive unintended access.

Impact

If the race is achievable against a privileged target, this can become a local privilege-escalation primitive by granting the sandbox capability SID inherited access to a directory selected through path replacement.

This finding was established by static review and still needs a focused Windows reproduction across the actual privilege boundary.

Suggested fix

  • Open targets without following reparse points.
  • Reject unexpected reparse tags in user-controlled path components.
  • Retain handles/file IDs across security-descriptor read and write.
  • Verify object identity immediately before mutation and rollback.
  • Add a Windows integration test that attempts target replacement during elevated setup.

Activity

  1. added
    issue-approved
    on Jul 21, 2026
  2. added a commit that references this issue on Jul 21, 2026
    4945684
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

issue-approved

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions