You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BaseContainer: USER32-importing workloads fail with STATUS_DLL_INIT_FAILED from a non-interactive session even with ui.disable=false / isolation=desktop #1465
Backend-ProcessContainer-UIFor UI related Windows process containment issuesIssue-DocsDocumentation improvements, corrections, or additions.OS-WindowsApplies specifically to Windows hosts or Windows behavior.
When wxc-exec (or the SDK) is invoked from a session-0 process (an OpenSSH shell with a network-logon token; the same applies to services and CI build agents), every contained workload that imports USER32 fails with STATUS_DLL_INIT_FAILED (0xC0000142): whoami, powershell, node, cl.exe all die, while cmd.exe and curl.exe (no USER32) run fine. This happens regardless ofui.disable, processContainer.ui.isolation (desktop included) or desktopSystemControl.
The identical request works from an interactive session (console or RDP, e.g. launched through a scheduled task with /it).
The launch diagnostic makes this worse: it tells you to set ui.disable: false, which is already set, so it looks like an MXC UI-policy bug and costs a long time to pin down.
Repro
ssh user@host # Windows OpenSSH, lands in session 0
mkdir C:\work
type > C:\work\repro.json (contents below)
wxc-exec.exe C:\work\repro.json
The target executable exited with STATUS_DLL_INIT_FAILED (0xC0000142). This often means the sandbox is blocking Win32k system calls (UI subsystem access), which is often required to initialize. Enable UI access in your sandbox policy: set `ui.disable: false` in the JSON config, or `ui.allowWindows: true` if you are using the SDK's SandboxPolicy.
{"error":{"code":"backend_error","message":"The target executable exited with STATUS_DLL_INIT_FAILED (0xC0000142). ..."}}
wxc-exec.exe C:\work\repro.json -- cmd /c echo hi prints hi from the same shell, and the unchanged repro.json prints the user name when run from the console session.
Expected
Either document that process containers need an interactive window station and make the 0xC0000142 diagnostic say so when the caller is in a non-interactive session, or support non-interactive hosts (services, CI agents).
I can reproduce this on a second machine and have narrowed it down. In short: for AppContainer children the window station is the cause and can be worked around, but BaseContainer (PSEC) children still fail in session 0 even on a fully accessible private desktop. That part looks like it is below MXC.
Environment: Windows 11 Home 25H2, build 26200.9711, x64; MXC 1.0.0 via the mxc-sdk crate (v1::run, Containment::Process, ui.disable = false). Session 0 was reached with an S4U scheduled task ("Run whether user is logged on or not", "Do not store password"), so the caller is on a Service-0x0-…$ window station without WSF_VISIBLE.
Reproduction
Caller
cmd /c echo
whoami.exe
node --version
Interactive session 1
ok
ok
ok
Session 0 (S4U task)
ok
0xC0000142
0xC0000142
Isolating the cause without MXC
From the same session-0 task, using plain Win32 calls:
ok, if the objects carry both of the settings below
The ACEs that WinSta0 / WinSta0\Default grant:
AC and S-1-15-2-2: 0x20327 on the window station and CCDCLCSWRPWPDTLOSDRCWDWO on the desktop;
RC: 0xf037f.
The Low mandatory label S:(ML;;NW;;;LW) that WinSta0 and Default carry. An unlabelled window station or desktop counts as Medium, so a Low-IL AppContainer cannot open it for the access USER32 initialisation needs. The DACL alone is not enough.
So for AppContainer children, the service window station's DACL and missing Low label explain the failure.
With MXC
I prototyped a fix in a local build:
Detect a non-visible caller window station (GetUserObjectInformationW(UOI_FLAGS) without WSF_VISIBLE).
Create a private window station and Default desktop with the DACL and Low label above.
Launch onto it: pass "<station>\Default" as lpDesktop in both runners, replacing the hard-coded winsta0\default in appcontainer_runner.rs.
Lifetime: keep the handles until the child exits.
Interactive callers are unchanged. Results in session 0, with the BaseContainer tier that MXC selects on this build:
still 0xC0000142 with the private desktop, for every processContainer.ui.isolation value (container, desktop, handles, atoms);
still 0xC0000142 when the private station is also made the caller's current station (SetProcessWindowStation) for the whole spawn, including security-environment creation;
still 0xC0000142 with the private objects fully open: GA for WD, AC, S-1-15-2-2 and RC, plus an Untrusted (S-1-16-0) label;
lpDesktopis honoured on this path: a non-existent name makes whoami fail with 0xC0000142 in session 1;
captureDenials in Allow mode records no window-station or desktop denial; the child still fails.
So with BaseContainer, the child lands on a desktop it should be able to use and still cannot initialise USER32. That suggests the restriction sits in the Process Security Environment or win32k handling of non-interactive sessions, not in anything MXC passes. I could not fully verify the AppContainer tier from session 0. Forcing it (force-tier-testing, MXC_FORCE_TIER=appcontainer-dacl) needs WRITE_DAC on every PATH directory. From session 0 it hung after applying the DACL ACEs, but the plain AppContainer test above shows the same private-desktop approach working for that kind of process.
Suggestions
Diagnostic. When the workload exits with 0xC0000142 and the caller's window station lacks WSF_VISIBLE, say so ("process containers cannot load USER32 from a non-interactive session, e.g. a service, SSH or S4U task"). Today it points to ui.disable: false, which is already set.
Probe. Report this in v1::probe() / --probe so hosts can detect it before launching.
AppContainer tier. Use a private Low-labelled window station and desktop instead of winsta0\default when the caller is not interactive. I'm happy to send the patch as a PR (about 200 lines, one new module) if that direction is wanted.
A related hazard. When the forced AppContainer-DACL tier hung and its process was then terminated, the ACEs it had added for its AppContainer SID (read/execute on every PATH directory and on JAVA_HOME) stayed in place, because restoration only runs on a clean exit. They had to be removed by hand with icacls /remove. A crash-safe cleanup, or recording the pending changes so a later run can roll them back, would help.
I reproduce this with wxc-exec.exe 1.0.1 and PowerShell 7.6.7 and Windows Build 26300.9711.
The caller runs as a dedicated standard account through a Windows service broker and ConPTY. Process metadata confirms session 0.
Results:
cmd.exe /d /c echo MXC_OK succeeds.
An absolute-path pwsh.exe -NoProfile -NoLogo -NonInteractive -Command "Write-Output MXC_PS_OK" fails with 0xC0000142.
ui.disable is already false.
Adding processContainer.ui.isolation: "desktop" produces the same failure.
PowerShell works from my normal interactive account.
This blocks embedding PSEC into an existing console-only restricted-account workflow. Is this an unsupported Windows session context, an OS defect, or something MXC can accommodate without exposing the caller’s interactive desktop?
We are experiencing a similar issue with MXC BaseContainer when launching Codex in a non-interactive Windows Session 0 environment.
Environment
Windows build: 26300.9974
Codex CLI: 0.169.0
Sandbox: MXC BaseContainer
Observed behaviour
The initial Codex coordinator launches, but two descendant processes exit with 0xC0000142 (STATUS_DLL_INIT_FAILED). The coordinator subsequently returns the same error.
The executable imports USER32.dll, although we have not confirmed which DLL initializer is failing.
This appears consistent with the behaviour described in this issue.
Questions
Is there a supported fix or workaround for MXC BaseContainer running in Session 0?
Are there recommended diagnostics to identify the failing DLL initializer?
Is this execution scenario currently supported?
We would prefer to retain the existing sandbox isolation and Windows security protections.
Backend-ProcessContainer-UIFor UI related Windows process containment issuesIssue-DocsDocumentation improvements, corrections, or additions.OS-WindowsApplies specifically to Windows hosts or Windows behavior.
Activity
Forenxics commentedon Oct 16, 2026
I can reproduce this on a second machine and have narrowed it down. In short: for AppContainer children the window station is the cause and can be worked around, but BaseContainer (PSEC) children still fail in session 0 even on a fully accessible private desktop. That part looks like it is below MXC.
Environment: Windows 11 Home 25H2, build 26200.9711, x64; MXC 1.0.0 via the
mxc-sdkcrate (v1::run,Containment::Process,ui.disable = false). Session 0 was reached with an S4U scheduled task ("Run whether user is logged on or not", "Do not store password"), so the caller is on aService-0x0-…$window station withoutWSF_VISIBLE.Reproduction
cmd /c echowhoami.exenode --version0xC00001420xC0000142Isolating the cause without MXC
From the same session-0 task, using plain Win32 calls:
whoamiPROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES),whoami0xC0000142WinSta0/WinSta0\Defaultgrant:ACandS-1-15-2-2:0x20327on the window station andCCDCLCSWRPWPDTLOSDRCWDWOon the desktop;RC:0xf037f.S:(ML;;NW;;;LW)thatWinSta0andDefaultcarry. An unlabelled window station or desktop counts as Medium, so a Low-IL AppContainer cannot open it for the access USER32 initialisation needs. The DACL alone is not enough.So for AppContainer children, the service window station's DACL and missing Low label explain the failure.
With MXC
I prototyped a fix in a local build:
GetUserObjectInformationW(UOI_FLAGS)withoutWSF_VISIBLE).Defaultdesktop with the DACL and Low label above."<station>\Default"aslpDesktopin both runners, replacing the hard-codedwinsta0\defaultinappcontainer_runner.rs.Interactive callers are unchanged. Results in session 0, with the BaseContainer tier that MXC selects on this build:
0xC0000142with the private desktop, for everyprocessContainer.ui.isolationvalue (container,desktop,handles,atoms);0xC0000142when the private station is also made the caller's current station (SetProcessWindowStation) for the whole spawn, including security-environment creation;0xC0000142with the private objects fully open:GAforWD,AC,S-1-15-2-2andRC, plus an Untrusted (S-1-16-0) label;lpDesktopis honoured on this path: a non-existent name makeswhoamifail with0xC0000142in session 1;captureDenialsinAllowmode records no window-station or desktop denial; the child still fails.So with BaseContainer, the child lands on a desktop it should be able to use and still cannot initialise USER32. That suggests the restriction sits in the Process Security Environment or win32k handling of non-interactive sessions, not in anything MXC passes. I could not fully verify the AppContainer tier from session 0. Forcing it (
force-tier-testing,MXC_FORCE_TIER=appcontainer-dacl) needsWRITE_DACon everyPATHdirectory. From session 0 it hung after applying the DACL ACEs, but the plain AppContainer test above shows the same private-desktop approach working for that kind of process.Suggestions
0xC0000142and the caller's window station lacksWSF_VISIBLE, say so ("process containers cannot load USER32 from a non-interactive session, e.g. a service, SSH or S4U task"). Today it points toui.disable: false, which is already set.v1::probe()/--probeso hosts can detect it before launching.winsta0\defaultwhen the caller is not interactive. I'm happy to send the patch as a PR (about 200 lines, one new module) if that direction is wanted.PATHdirectory and onJAVA_HOME) stayed in place, because restoration only runs on a clean exit. They had to be removed by hand withicacls /remove. A crash-safe cleanup, or recording the pending changes so a later run can roll them back, would help.I can share the session-0 test scripts if useful.
fmuecke commentedon Oct 18, 2026
I reproduce this with wxc-exec.exe 1.0.1 and PowerShell 7.6.7 and Windows Build 26300.9711.
The caller runs as a dedicated standard account through a Windows service broker and ConPTY. Process metadata confirms session 0.
Results:
cmd.exe /d /c echo MXC_OKsucceeds.pwsh.exe -NoProfile -NoLogo -NonInteractive -Command "Write-Output MXC_PS_OK"fails with0xC0000142.ui.disableis already false.processContainer.ui.isolation: "desktop" produces the same failure.This blocks embedding PSEC into an existing console-only restricted-account workflow. Is this an unsupported Windows session context, an OS defect, or something MXC can accommodate without exposing the caller’s interactive desktop?
{ "version": "1.0.0", "containment": "processcontainer", "process": { "commandLine": "\"C:\\Program Files\\PowerShell\\7\\pwsh.exe\" -NoProfile -NoLogo -NonInteractive -Command \"Write-Output MXC_PS_OK\"", "cwd": "C:\\AgentSandbox\\mxc", "timeout": 10000 }, "filesystem": { "readwritePaths": [ "C:\\AgentSandbox\\mxc"] }, "fallback": { "allowDaclMutation": false }, "network": { "egress": { "default": "deny" }, "ingress": { "default": "deny", "hostLoopback": "allow" } }, "ui": { "disable": false }, "processContainer": { "ui": { "isolation": "desktop" } } }seanjrenner commentedon Nov 30, 2026
We are experiencing a similar issue with MXC BaseContainer when launching Codex in a non-interactive Windows Session 0 environment.
Environment
Observed behaviour
The initial Codex coordinator launches, but two descendant processes exit with
0xC0000142(STATUS_DLL_INIT_FAILED). The coordinator subsequently returns the same error.The executable imports
USER32.dll, although we have not confirmed which DLL initializer is failing.This appears consistent with the behaviour described in this issue.
Questions
We would prefer to retain the existing sandbox isolation and Windows security protections.
Thank you.