Repository navigation
Replies: 1 comment
|
| 若…… | 则成因是 |
|---|---|
只有带 CREATE_NO_WINDOW/CREATE_NEW_CONSOLE 的命令失败,普通命令正常 |
:127 控制台隔离 |
| 所有命令都失败(含最简命令) | 倾向 :102 keep-alive 组缺失 |
| 失败发生在 DLL 初始化期(进程刚起就死) | 两者都可能,看进程创建标志 |
3. 请与 #8534 合并(同一现象、更早的报告)
同在 Q&A 区另有一条:#8534「workspace-write cannot start any child (0xC0000142); read-only works」——同一个错误码、同一个模式对照。我在那边给过同样的建议:列出失败子进程的启动标志,并对照 read-only 的令牌默认 DACL。
⇒ 建议两贴互引并合并为一条(你这条若补充了 STA 这一面,正好是 #8534 缺的那一半)。
4. 请补三样
- 失败命令的最小例子与它的启动标志(是否带
CREATE_NO_WINDOW/CREATE_NEW_CONSOLE); read-only下同一命令是否成功(这是#8534已给出的对照,你复现一遍就能确认同源);- 版本:请写版本(当前最新
0.2.1-alpha.1)。
一条边界
我确认的是文档对 0xC0000142 的两处成因描述(足以说明"必须先分开")。你撞的是哪一条以第 2 节的对照为准——我没有 Windows 受限令牌环境。
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
@deepseek-ai/dsh-sandbox-windows-acl(via@deepseek-ai/dsh-pwsh-sandbox/dsh-bash-sandboxthroughdsh-sandbox-local)win32x6444.0.0danger-full-access, which bypasses the file sandbox entirely1. Summary
Under the
workspace-writefile policy, every command-tool call (pwsh,bash, and any native target) fails with:3221225794=0xC0000142=STATUS_DLL_INIT_FAILED.The same command in the same session under
danger-full-accessworks immediately.read-onlyalso works. So the failure is confined to theworkspace-writeconfinement path and is independent of the command being run.2. Root cause
AclSandbox.init()names a capability SID (the per-workspace / per-session write SID) as the trustee of the restricted token's default DACL.read-onlynever does this — it falls through toworldSid(Everyone).workspace-writeis the only mode that takes the capability-SID branch.The confined child is then created with a console subsystem. Something on the console / loader-initialization path cannot use an object whose default DACL names a capability SID that no other process holds, so the child dies during DLL initialization with
0xC0000142before any user code runs — which is why there is no output at all and no runner diagnostic.This is consistent with the limitation already documented in
sandbox-windows-acl/README.md:and with
S-1-2-1(console logon) being deliberately absent from the restricting list.Subsystem dependence (key evidence)
read-onlyworkspace-writeConsoleApplication0xC0000142WindowsApplicationThe failing path is console-specific, not process-creation-specific.
3. Reproduction
Via the product (end user):
workspace-write).echo hello.(no output)+ exit code3221225794.Minimal, isolated reproduction (no DSH UI needed):
Load the deployed
AclSandboxand spawn a console target under a seam-managedworkspace-writetoken:The identical snippet with
mode: 'read-only'returns7.4. Control experiments (single-variable)
Bisection performed by loading the delegated chunks through an ESM
loadhook and changing exactly one thing per run. Argv built the same way aswindowsAclRunnerArgv:--workspace <ws> --temp %TEMP% --mode workspace-write -- cmd /c echo A.workspace-write)-1073741502(0xC0000142)ELECTRON_RUN_AS_NODEremoved from the runner env-1073741502-1073741502-1073741502worldSidA, exit0Additional independent checks on the same machine:
DeepSeek Harness.exe+ELECTRON_RUN_AS_NODE=1) started as an ordinary child is viable (-e,--version, plain scripts all return 0). So the problem is not "Electron cannot start" — it is loader initialization under the restricted token.CREATE_NO_WINDOW(Node'swindowsHide: true) is not the cause: toggling it changes nothing (both variants0xC0000142).AclWriteGrant.add()(the ACL mutation itself) completes fine even under the Electron Node runtime — so the failure is specifically in restricted-token process creation, not in the ACL machinery.ELECTRON_RUN_AS_NODEenvironment variable does leak into the confined child (the subprocess env scrubber forwards it: it is neither credential-shaped norDSH_-prefixed). This looks causal but is not: removing it does not change the outcome, andread-onlyworks with the same leak in place.5. Suggested fix
One line, which makes
workspace-writebehave exactly like the already-workingread-onlypath at this site:The capability SIDs remain where they carry confinement authority:
grantWritemandatory labels are untouched;Only the default DACL of objects created by the confined child changes — which is precisely what
read-onlyhas always done.A more conservative variant, if the capability trustee was intentional for some scenario, is to keep the capability trustee only for non-console targets and use
worldSidfor console-subsystem targets.Optional hardening for the leaked selector
The subprocess env scrubber could additionally treat
ELECTRON_RUN_AS_NODEas internal plumbing (like theDSH_*prefix), so no confined child inherits it. This is not required for this bug but closes a surprising leak.6. Verification that confinement is preserved
After applying the one-line change, measured inside a confined
workspace-writechild:0(was0xC0000142)WROTEDENIED(still confined)Low Mandatory Level(S-1-16-4096)cmd,powershellandpwshall start again underworkspace-write, andwhoami /allstill reports the Low mandatory level.7. Impact
workspace-write(and any confined mode deriving from it).danger-full-access, i.e. the file sandbox is bypassed — a security-relevant outcome, not merely an inconvenience.8. Second, likely separate issue (not fixed by the above)
Inside a confined
workspace-writeshell, schannel/.NET HTTPS clients cannot complete a TLS handshake:curl https://example.com→curl: (35) schannel: AcquireCredentialsHandle failed: SEC_E_NO_CREDENTIALS (0x8009030e)Invoke-WebRequest https://api.github.com/→ "the connection was closed while receiving"Both work in an unconfined shell on the same host with the same local proxy. This is not fixed by the default-DACL change and is probably a separate consequence of the restricted token (CNG /
\Device\CNGis mentioned in the package README as a write trustee thatpwshneeds).9. Environment where reproduced
44.0.0…\Programs\DeepSeek Harness\resources\app.asar(payload underapp.asar/dsh/node_modules)DeepSeek Harness.exe(Electron 44 / Node 24) started withELECTRON_RUN_AS_NODE=1EnableLUA=0; host runs at High integrity as a full administrator tokenI:\DS工作区(NTFS, non-ASCII path; also reproduced onC:)dsh-sandbox-windows-acl/lib/types-Cl_DXjhk.js,dsh-win32-process/lib/index.js,dsh-subprocess-local/lib/runner-launch-B2zsQ1Dz.jsNote on build layout: in
44.0.0the sandbox payload lives atapp.asar/dsh/node_modules/…, and the sandbox chunk file name istypes-Cl_DXjhk.js. Any third-party patcher must therefore be content-addressed, not keyed on a fixed chunk file name — several community plugins hard-code other names (e.g.types-CNjZgO4h.js) and silently skip on this build. Likewise, this build already shipsdwFlags: 257+wShowWindow: 0at bothencodeStartupInfocall sites, so the "console window flash" patch is not needed on44.0.0(dwFlags: 256does not occur at all).10. Minimal-diff patch used to confirm the fix locally
Length-neutral, so archive offsets and every other entry's
integrity.hashare unaffected; only the patched entry's ownintegrity.hashrecord is re-synced.Both sides are 52 bytes, so nothing downstream moves. After the patch the archive still parses (12 967 entries) and 0 entries mismatch their recorded hashes.
11. Credit
The root cause and the one-line fix were identified by a commenter on discussion #8130. This report consolidates that analysis with independent on-machine verification (controls, confinement re-verification, and the build-layout findings in §9).
All reactions