Skip to content

Sandbox provisioning failure (error 5) leaves the Windows user profile at Low integrity, breaking icons, Edge credentials and Python launchers #58107

Open

Description

@sdiouci11

What version of the Codex App are you using (From “About Codex” dialog)?

26.1023.6621.0

What subscription do you have?

Plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Sandbox provisioning fails on every normal (non-elevated) launch:

helper_sandbox_lock_failed: lock sandbox bin dir C:\Users<user>.codex.sandbox-bin failed: SetNamedSecurityInfoW sandbox dir failed: 5

The failed provisioning is NOT rolled back: the whole user profile is left at Low integrity (Mandatory Label\Low Mandatory Level). Because AppData\Local sits inside the profile, every program launched from it inherits Low:

  1. Desktop shortcuts (.lnk) render as blank white pages — Explorer refuses to extract icons from Low-IL locations. Clearing iconcache_*.db does not help.
  2. Edge's App-Bound Encryption service ends up stopped and cannot validate against the Low-IL User Data directory, so saved passwords (v20 format) and all session cookies become unreadable — the user appears logged out of everything.
  3. py.exe (C:\Users<user>\AppData\Local\Programs\Python\Launcher\py.exe) inherits Low, so EVERY py -3 process starts at Low integrity: it cannot create files in Medium-IL temp dirs (E:\Temp → PermissionError [Errno 13]), and cannot launch Medium-IL Edge — webbrowser.open() returns True but nothing opens.

Framing note: Low integrity itself is by design for the sandbox user — I am not arguing the mechanism is wrong. The bug is the SCOPE of the label left behind: the sandbox has no reason for py.exe, Edge User Data, or Explorer's Desktop icon extraction to run at Low.

Verified with before/after controls — restoring only the integrity level to Medium fixes all three symptoms:

Object Before (Low) After (Medium)
Desktop .lnk icons all blank white all restored
Edge credentials unreadable, logged out everywhere service auto-starts, credentials OK
py -3 launched Python S-1-16-4096, no TEMP, cannot open browser S-1-16-8192, everything works

Notably D:\Python\python.exe (outside the profile) stayed Medium the whole time — the same Python version behaved differently depending on which launcher started it, which made this very hard to diagnose.

Environment: Windows 11 Pro 10.0.26200 x64 (zh-CN). Account is the built-in Administrator with a UAC-filtered token (BUILTIN\Administrators shows "Group used for deny only", process IL = Medium).

Related: #27889, #36475 (same SetNamedSecurityInfoW ... 5 on .sandbox-bin), and #55908 (elevated sandbox provisioning SUCCEEDS but the sandbox user still cannot write the workspace — a different failure point).

What steps can reproduce the bug?

  1. Use a Windows account whose token is UAC-filtered (Administrators = "Group used for deny only"), so Codex Desktop runs at Medium integrity.
  2. Launch Codex Desktop normally (NOT "Run as administrator") with [windows] sandbox = "elevated".
  3. Provisioning fails: %USERPROFILE%.codex\setup_error.json is written with
    helper_sandbox_lock_failed / SetNamedSecurityInfoW sandbox dir failed: 5
  4. Inspect the leftover state (this is the actual bug — nothing rolled it back):
    icacls %USERPROFILE% → Mandatory Label\Low Mandatory Level
    icacls %USERPROFILE%\Desktop → same
    icacls "%LOCALAPPDATA%\Programs\Python\Launcher\py.exe" → Low Mandatory Level
  5. Confirm the Python consequence:
    py -3 -c "import subprocess;subprocess.run(['whoami','/groups'])"
    → Mandatory Label\Low Mandatory Level S-1-16-4096
  6. Observe the user-visible damage: Desktop shortcut icons are blank white; Edge is logged out of every site; py -3 cannot write E:\Temp and cannot open a browser.
  7. Repair: icacls /setintegritylevel "(OI)(CI)M" /T /C on the affected paths → all three symptoms disappear.

Note: reproduction does NOT require the sandbox to ever work. The damage happens at the failed-provisioning step, before any sandbox command can run.

What is the expected behavior?

A failed sandbox provisioning should roll back any integrity-level changes it already applied to the user profile.

At minimum it should detect that the profile was left at Low integrity — which silently breaks Explorer icons, browser credentials and Python launchers — and surface an explicit warning plus a repair command.

Right now the failure mode looks like unrelated system corruption, which sends users down a completely wrong diagnostic path (hours of chasing icon caches and browser profiles) before they find the integrity label.

Additional information

No response

Activity

  1. added
    app
    on Oct 29, 2026
  2. added
    bug
    windows-os
    sandbox
    on Oct 29, 2026
  3. github-actions commented on Oct 29, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  4. sdiouci11 commented on Oct 29, 2026

    @sdiouci11
    Author

    Not a duplicate. #57617 covers how to make provisioning succeed (ACL/ownership repair on .sandbox-bin). This issue reports what a FAILED provisioning leaves behind: the user profile is left at Low integrity and never rolled back, silently breaking Explorer icons, Edge credentials and Python launchers.

    The concrete error also differs: #57617 hits NtCreateFile: Access is denied while opening the directory, whereas here it is SetNamedSecurityInfoW sandbox dir failed: 5.

  5. sdiouci11 commented on Oct 30, 2026

    @sdiouci11
    Author

    Thanks, the DACL/SACL distinction is correct and I accept it: DACL_SECURITY_INFORMATION alone cannot write a mandatory label, so lock_sandbox_dir() is not the SACL writer. I've also corrected my framing — what I established is that the profile ends up at Low IL after a failed provisioning and that restoring only the integrity level fixes all three symptoms. I have not established which component wrote the label.

    Two questions I'd like answered:

    1. Is "a failed provisioning must not leave the profile at Low integrity" considered a Codex-side defect, or out of scope?
    2. If Codex never writes SACL anywhere, which component does? I'm willing to run a disposable-profile reproduction with pre/post SACL snapshots (GetNamedSecurityInfoEx, not just icacls) if someone can point me at the phase boundaries to instrument.

    I'm not trying to assign blame to a specific function — I want to know whether the invariant will be enforced, because on a real machine this failure mode is indistinguishable from system corruption.

  6. sdiouci11 commented on Nov 1, 2026

    @sdiouci11
    Author

    Correction to the reproduction steps in the original report (posted 2026-11-02).

    Two statements above are wrong, and one of them is unsafe to follow. Correcting them here so nobody copies them.

    1. Do not use /T in the repair command.

    The original text suggests icacls /setintegritylevel "(OI)(CI)M" /T /C. Run against the profile, that also flips %LOCALAPPDATA%\LocalLow and every AppData\Local\Packages\<pkg>\AC directory to Medium. Those are legitimately Low (AppContainer / low-rights sandboxes), and raising them breaks browsers and UWP apps.

    Change the root object only, with this single command:

    icacls "%USERPROFILE%" /setintegritylevel M
    

    Inherited labels on children are computed dynamically, so no /T and no per-directory pass is needed.

    2. "Explorer refuses to extract icons from Low-IL locations" is not accurate.

    Windows integrity policy only forbids write-up — a lower-integrity subject writing to a higher-integrity object. A Medium-integrity subject reading from a Low-integrity object is permitted. The icon anomaly and the Low label were observed together, but the mechanism is unverified and should not be stated as the cause.

    3. Minor: icacls /save / /restore cover DACLs only.

    A mandatory integrity label lives in the SACL, so those switches cannot snapshot or roll it back. Use a full SDDL snapshot instead, e.g. (Get-Acl -Path ... -Audit).Sddl.


    The core observation is unchanged: after a failed provisioning, the profile is left with an explicit, inheritable Low Mandatory Level:(OI)(CI)(NW) label, and restoring only the root to Medium makes the sandbox, the shell icons and the Python launcher work again — the sandbox recovery in particular is immediate.

    If it helps triage, I can provide pre/post SDDL snapshots (GetNamedSecurityInfo, SACL included) taken on a disposable profile across the provisioning boundary.

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

    appbugsandboxwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions