[Bug][Windows] workspace-write sandbox: every spawned console app dies with 0xC0000142 and raises a modal Windows error dialog on each tool call #7292
Replies: 2 comments
|
This is a documented boundary of the Windows restricted-token sandbox, and the repository states it in
packages/sandbox/sandbox-windows-acl/README.md:117
The module header lists the same under "Known boundaries (inherent to restricted tokens, not this port)"
The
I am not going to tell you those flags are the cause. Your report establishes that a console program fails That turns the open question into "what differs in your environment" rather than "which flag is wrong". The
Nothing in the tree calls For what it is worth, #2730 is the same symptom a month earlier on Windows 10 22H2 and is also unanswered. |
|
Confirmed still reproducing on DeepSeek Harness Desktop 0.1.7-alpha.2 (Windows 11), and I narrowed it down with a controlled experiment that isolates the exact breaking link. Symptom
Controlled experiment (runner extracted from the installed app)I extracted
Instrumenting runner.js shows the whole runner chain succeeds under the Electron interpreter — win32 API loaded, restricted token created ( Conclusions
Suggested fix directions
Happy to share the full repro scripts if useful. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Version
@deepseek-ai/dsh0.1.5-rc.2·@deepseek-ai/dsh-sandbox-windows-acl0.1.5-rc.2OS Windows 11 Pro 25H2, build26200.9457· Nodev24.19.0· Executor shell Windows PowerShell5.1.26100.9444(no PS7 on this host) Modeworkspace-write(default, sandbox confirmed active) · launched withnpx dshfrom an interactive PowerShell with a console · zh-CN localeSymptom
Console children started inside a
Pwshtool call raise a modal Windows "Application Error" dialog and die withSTATUS_DLL_INIT_FAILED(0xC0000142) — but only on some spawn paths. Because agent activity constantly reachescmd.exe-dependent tooling (.cmd/.batshims = thenpm.cmd/npx.cmd/pnpm.cmdpath), the user gets a popup on essentially every conversation turn. GUI processes are unaffected.The decisive matrix (all inside ONE sandboxed
Pwshcall)A
.cmdchild that writes a probe file succeeds on the direct path and never executes on theCREATE_NO_WINDOWpath — a real execution difference, not a reporting artifact.-WindowStyle Hiddenstill allocates a console, so window visibility is not the factor.Interpretation
The restricted token is not the blocker: the same token runs
cmd.exe/node.exe/.cmdfine when the child gets a console. The failing paths are exactly those where the caller does not create a console (CREATE_NO_WINDOW, and theShellExecuteroute through Explorer), leavingcmd.exetoAllocConsole()itself and fail. Note this contradicts a literal reading of the documented boundary ("CREATE_NO_WINDOW/CREATE_NEW_CONSOLEchildren die during DLL initialization"): in my testsCREATE_NEW_CONSOLEworks andCREATE_NO_WINDOWalone is sufficient to kill.The host console is not the trigger — this host is launched from a console-attached PowerShell, and a sandboxed
CreateProcessthat creates a console succeeds, so #810's "console-less host" does not describe this machine.Sandbox is demonstrably active
Outside the sandbox (user's own terminal) the identical command returns
0.Windows
Systemlog, providerApplication Popup(ID 26), one entry per failure:Application popup: cmd.exe - Application Error : 应用程序无法正常启动(0xc0000142)。请单击“确定”关闭应用程序。Popup census by day: 0
cmd.exe/node.exepopups from 08-25 to 09-07 (before DSH was ever launched; the ~19 entries there areSakuraCat.exe/audiodg.exe/steamwebhelper.exe), then 188 on the first DSH session day (cmd.exe×122,node.exe×27,where.exe×19,ipconfig×4,whoami/HOSTNAME/python/tasklist×3 each,attrib×2,PING×1,powershell×1). 53 of them (cmd.exe×30,node.exe×23) occurred in the first 27 minutes, before any of my own bulk testing — plain agent activity is enough.Ruled out here
Valid Microsoft signature on
cmd.exe; no malicious/unknown DLLs inSystem32;AppInit_DLLsempty +LoadAppInit_DLLs=0(both bitnesses), noAppCertDlls, nocmdAutoRun; no IFEO hijack; Huorong 6.0 AV very likely irrelevant (itshipsdaemon.logshows no interception ofcmd.exe/node.exe; disabling hardening, whitelisting the binaries and a reboot changed nothing); no console/terminal delegation misconfiguration; 32-bit and 64-bit console apps behave identically; CRT DLLs present.Questions
CREATE_NO_WINDOW/ShellExecutefor command execution whenCREATE_NEW_CONSOLE/inherited-console spawns work under the same token? Relaxing that flag appears to fix both the popups and the outright failure of.cmd-based tooling.STARTF_USESHOWWINDOW+SW_HIDE, orSetErrorMode(SEM_FAILCRITICALERRORS))? A silent failure beats a modal box on every turn (cf. #1344).SANDBOX_UNAVAILABLE/denial fact instead of a bareAccess is denied?Related: dsh-win32 compatibility notes list this signature (
0xC0000142/STATUS_DLL_INIT_FAILEDassociated with restricted-token launch) and point at Desktop PR #266 — https://raw.githubusercontent.com/sjh9714/dsh-win32/refs/heads/master/docs/windows-first-run.mdHappy to run any diagnostic on this machine — it reproduces 100% of the time. Environment is stock: no packaged runtime files modified, AV not disabled, permissions not widened.
Version @deepseek-ai/dsh 0.1.5-rc.2 · @deepseek-ai/dsh-sandbox-windows-acl 0.1.5-rc.2 OS Windows 11 Pro 25H2, build 26200.9457 · Node v24.19.0 · Executor shell Windows PowerShell 5.1.26100.9444 (no PS7 on this host) Mode workspace-write (default, sandbox confirmed active) · launched with npx dsh from an interactive PowerShell with a console · zh-CN localeSymptom
Console children started inside a Pwsh tool call raise a modal Windows "Application Error" dialog and die with STATUS_DLL_INIT_FAILED (0xC0000142) — but only on some spawn paths. Because agent activity constantly reaches cmd.exe-dependent tooling (.cmd/.bat shims = the npm.cmd/npx.cmd/pnpm.cmd path), the user gets a popup on essentially every conversation turn. GUI processes are unaffected.
The decisive matrix (all inside ONE sandboxed Pwsh call)
Spawn method Result
Start-Process cmd.exe (PS 5.1 default = ShellExecute) -1073741502 + popup ❌
.NET ProcessStartInfo, UseShellExecute=$true (WindowStyle Normal or Hidden) -1073741502 + popup ❌
.NET ProcessStartInfo, UseShellExecute=$false, CreateNoWindow=$true -1073741502 + popup ❌
Start-Process -NoNewWindow throws Access is denied ❌
UseShellExecute=$false + CreateNoWindow=$false + WindowStyle=Normal cmd /c "echo OK" prints OK, exit=0 ✅
… same path where.exe node → prints path, exit=0 ✅
… same path node.exe -e "console.log(...)" → prints output, exit=0 ✅
… same path python.exe -c "print(1)" → prints 1, exit=0 ✅
… same path _probe_shim.cmd (exit /b 5) → prints SHIM-RAN, exit=5 ✅
… same path via cmd /c _probe_shim.cmd → runs, exit=0 ✅
CREATE_NO_WINDOW (either direct or via cmd /c) _probe_shim.cmd → -1073741502 + popup ❌ (never runs)
GUI (notepad.exe) exit=0 ✅
A .cmd child that writes a probe file succeeds on the direct path and never executes on the CREATE_NO_WINDOW path — a real execution difference, not a reporting artifact. -WindowStyle Hidden still allocates a console, so window visibility is not the factor.
Interpretation
The restricted token is not the blocker: the same token runs cmd.exe/node.exe/.cmd fine when the child gets a console. The failing paths are exactly those where the caller does not create a console (CREATE_NO_WINDOW, and the ShellExecute route through Explorer), leaving cmd.exe to AllocConsole() itself and fail. Note this contradicts a literal reading of the documented boundary ("CREATE_NO_WINDOW/CREATE_NEW_CONSOLE children die during DLL initialization"): in my tests CREATE_NEW_CONSOLE works and CREATE_NO_WINDOW alone is sufficient to kill.
The host console is not the trigger — this host is launched from a console-attached PowerShell, and a sandboxed CreateProcess that creates a console succeeds, so #810's "console-less host" does not describe this machine.
Sandbox is demonstrably active
复制
Set-Content C:\Users\28139_dsh_sandbox_probe.txt → Access to the path ... is denied.
Set-Content D:\Deepseek Harness_dsh_sandbox_probe.txt → success
TMP = C:\Users\28139\AppData\Local\Temp\dsh-wT3NhX (private per-session temp)
Outside the sandbox (user's own terminal) the identical command returns 0.
Windows System log, provider Application Popup (ID 26), one entry per failure: Application popup: cmd.exe - Application Error : 应用程序无法正常启动(0xc0000142)。请单击“确定”关闭应用程序。
Popup census by day: 0 cmd.exe/node.exe popups from 08-25 to 09-07 (before DSH was ever launched; the ~19 entries there are SakuraCat.exe/audiodg.exe/steamwebhelper.exe), then 188 on the first DSH session day (cmd.exe×122, node.exe×27, where.exe×19, ipconfig×4, whoami/HOSTNAME/python/tasklist×3 each, attrib×2, PING×1, powershell×1). 53 of them (cmd.exe×30, node.exe×23) occurred in the first 27 minutes, before any of my own bulk testing — plain agent activity is enough.
Ruled out here
Valid Microsoft signature on cmd.exe; no malicious/unknown DLLs in System32; AppInit_DLLs empty + LoadAppInit_DLLs=0 (both bitnesses), no AppCertDlls, no cmd AutoRun; no IFEO hijack; Huorong 6.0 AV very likely irrelevant (its hipsdaemon.log shows no interception of cmd.exe/node.exe; disabling hardening, whitelisting the binaries and a reboot changed nothing); no console/terminal delegation misconfiguration; 32-bit and 64-bit console apps behave identically; CRT DLLs present.
Questions
Why does the spawn path use CREATE_NO_WINDOW/ShellExecute for command execution when CREATE_NEW_CONSOLE/inherited-console spawns work under the same token? Relaxing that flag appears to fix both the popups and the outright failure of .cmd-based tooling.
Failing that, can the modal dialog be suppressed (STARTF_USESHOWWINDOW + SW_HIDE, or SetErrorMode(SEM_FAILCRITICALERRORS))? A silent failure beats a modal box on every turn (cf. #1344).
Should console-dependent spawns be surfaced as a structured SANDBOX_UNAVAILABLE/denial fact instead of a bare Access is denied?
Related: dsh-win32 compatibility notes list this signature (0xC0000142 / STATUS_DLL_INIT_FAILED associated with restricted-token launch) and point at Desktop PR #266 — https://raw.githubusercontent.com/sjh9714/dsh-win32/refs/heads/master/docs/windows-first-run.md
Happy to run any diagnostic on this machine — it reproduces 100% of the time. Environment is stock: no packaged runtime files modified, AV not disabled, permissions not widened.
All reactions