Windows Sandbox / Temporary Profile Leak with Codex Sandbox Users
What version of the IDE extension are you using?
Cursor
What subscription do you have?
26.429.30905
Which IDE are you using?
Cursor
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
Windows Sandbox / Temporary Profile Leak with Codex Sandbox Users
Summary
Codex on Windows appears to repeatedly create temporary Windows profiles (TEMP.<user>.*) during sandbox initialization or refresh operations.
In my environment this resulted in ~170 leaked temporary user profile directories under:
C:\Users\TEMP.David-PC.*
The issue appears related to the native Windows sandbox implementation and/or sandbox user management.
Observed components involved:
codex-windows-sandbox-setup.execodex-command-runner-0.128.0-alpha.1.exeCodexSandboxOfflineCodexSandboxOnline
This does not appear to be malware. The generated files are Windows DPAPI blobs and profile scaffolding.
The issue appears to be:
- sandbox/user bootstrap retry loops
- temporary profile fallback
- profile unload/cleanup failure
- or repeated failed noninteractive logons.
---
Environment
- Windows 11
- Native Windows sandbox mode (not WSL)
- Cursor extension using Codex
- Observed with:
codex-command-runner-0.128.0-alpha.1.exe
---
Symptoms
Hundreds of directories created under:
C:\Users\
Examples:
TEMP.David-PC
TEMP.David-PC.000
TEMP.David-PC.001
...
TEMP.David-PC.169
Characteristics:
- all directories contain nearly identical minimal contents
- not full normal user profiles
- timestamps appear in bursts
- creation continues while Codex sandbox processes are active
- creation stops after Codex processes are terminated
Example timing bursts:
- 2026-04-29 22:30–23:30
- 2026-05-01 02:00–03:00
- 2026-05-06 16:00–18:00
- 2026-05-07 01:00–02:30
---
Additional Observed Files
Each temp profile contains:
AppData\Local\Microsoft\Windows\SFAP\cache1.bin
Inspection of cache1.bin shows:
- standard Microsoft DPAPI header
- encrypted Windows credential/security blob
- not executable content
- not malware
DPAPI signature:
D0 8C 9D DF 01 15 D1 11 8C 7A 00 C0 4F C2 97 EB
This suggests the sandbox/user initialization path triggers:
- LSASS
- DPAPI
- User Profile Service
- SFAP cache initialization
---
Relevant Sandbox Log Entries
Observed in sandbox.log:
ensuring sandbox users offline=CodexSandboxOffline online=CodexSandboxOnline
setup refresh: spawning ... codex-windows-sandbox-setup.exe
helper launch
runner launch
command-runner
hide users: profile dir hidden for current user
The repeated setup refresh operations appear correlated with the temp profile creation bursts.
---
Important Observation
The log line:
hide users: profile dir hidden for current user
combined with existing Codex Windows sandbox issues suggests the implementation is manipulating:
- Windows local users
- profile directories
- ACLs
- hidden profile state
- or Explorer visibility
This appears related to:
- Windows sandbox user bootstrapping
- first-logon profile initialization
- or profile visibility suppression
---
Request
Please investigate:
- sandbox user initialization
- temporary profile fallback handling
- profile cleanup/unload
- repeated setup refresh behavior
hide_users.rs- interaction with Windows User Profile Service
The current behavior can silently generate hundreds of leaked temp profiles on Windows systems.
What steps can reproduce the bug?
Suspected Root Cause
My current hypothesis:
- Codex sandbox refresh runs
- Sandbox users are initialized or refreshed
- Windows attempts transient/noninteractive logon
- User Profile Service partially initializes a profile
- Profile attach/unload/setup fails
- Windows falls back to
TEMP.<user> - Cleanup does not occur
- Retry loop creates another temp profile
Possibly related APIs/components:
CreateProcessWithLogonWCreateProcessAsUserW- S4U logons
- User Profile Service
- LSASS
- DPAPI
- sandbox ACL setup
- hidden sandbox user profile handling
---
Repro Notes
Issue appears easiest to trigger when:
- using native Windows sandbox mode
- using Cursor/OpenAI Codex integration
- long-running agent/sandbox sessions
- repeated sandbox refreshes
- elevated/native Windows sandbox mode
---
Mitigation
Temporary mitigation:
- Fully exit Cursor/Codex
- Kill:
codex.execodex-command-runner.execodex-windows-sandbox-setup.exenode.exe
- Reboot
After this:
- new TEMP profiles stopped appearing
What is the expected behavior?
Codex not creating leaked profiles
Additional information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗