Skip to content

BaseContainer: USER32-importing workloads fail with STATUS_DLL_INIT_FAILED from a non-interactive session even with ui.disable=false / isolation=desktop #1465

Open

Description

Relevant area(s)

Windows, ProcessContainer (BaseContainer)

Brief description of your issue

Windows 11 25H2 build 26200.9550, MXC 1.0.0, tier base-container (--probe: enumeratePaths supported).

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 of ui.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

repro.json:

{
  "version": "1.0.0",
  "containment": "processcontainer",
  "process": { "commandLine": "whoami.exe", "cwd": "C:\\work" },
  "filesystem": { "readwritePaths": ["C:\\work"], "readonlyPaths": [] },
  "ui": { "disable": false },
  "processContainer": { "ui": { "isolation": "desktop" } },
  "network": { "egress": { "default": "deny" }, "ingress": { "default": "deny", "hostLoopback": "deny" } }
}

Output:

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).

Activity

  1. added
    Needs-Triage
    Issue-Docs
    OS-Windows
    on Oct 11, 2026
  2. added
    Backend-ProcessContainer
    Priority3
    and removed
    Needs-Triage
    on Oct 14, 2026
  3. Forenxics commented on Oct 16, 2026

    @Forenxics

    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:

    Process Inherited service window station Private window station + desktop
    Normal process, whoami ok ok
    Plain AppContainer (PROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES), whoami 0xC0000142 ok, if the objects carry both of the settings below
    1. 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.
    2. 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;
    • lpDesktop is 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

    1. 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.
    2. Probe. Report this in v1::probe() / --probe so hosts can detect it before launching.
    3. 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.
    4. 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 can share the session-0 test scripts if useful.

  4. fmuecke commented on Oct 18, 2026

    @fmuecke

    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?

    {
      "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" } }
    }
  5. removed
    Priority3
    on Oct 26, 2026
  6. added
    Backend-ProcessContainer-UI
    and removed
    Backend-ProcessContainer
    on Oct 27, 2026
  7. seanjrenner commented on Nov 30, 2026

    @seanjrenner

    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

    1. Is there a supported fix or workaround for MXC BaseContainer running in Session 0?
    2. Are there recommended diagnostics to identify the failing DLL initializer?
    3. Is this execution scenario currently supported?

    We would prefer to retain the existing sandbox isolation and Windows security protections.

    Thank you.

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

    Backend-ProcessContainer-UIIssue-DocsOS-Windows

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions