Repository navigation
[Security] Sandboxed tool process can read the dsh parent environment (provider keys), bypassing env scrubbing #13799
rockmelodies
started this conversation in
General
Replies: 0 comments
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.
Uh oh!
There was an error while loading. Please reload this page.
Summary
The
bashtool runs with a scrubbed child environment, so provider credentialssuch as
DEEPSEEK_API_KEYare not visible throughenvinside the sandbox. Thelong-lived
dshprocess itself still holds those credentials.On macOS the default Seatbelt profile is
(allow default)plus a write deny(
packages/sandbox/sandbox-local/src/profiles.ts). That leavessysctl(KERN_PROCARGS2)available, so a small helper compiled into the workspacecan read the parent PID's environment and return the provider key in full. No
file write, no outbound request, and no approval prompt are involved.
Verified on 0.2.2-rc.5, macOS 15.8.3, default
workspace-write: the child envdoes not contain the key, while the parent environment read returns it verbatim.
Inside the sandbox
/bin/psitself is refused by macOS code-signing policy, buta self-compiled helper is not.
Scope
--unshare-pidisolates the parent)/procis readable) — not testedImpact
Theft of provider API keys (DeepSeek/OpenAI/Anthropic), cloud credentials exported
into the environment, and secrets of other same-user processes. This bypasses an
explicit defense — environment scrubbing — and needs only one command in the
default sandbox, reachable through prompt injection from repository content, a
fetched page, or a document.
Suggested direction
Keep provider credentials out of the long-lived process environment (read them
from the credentials store per request), or hand them to adapters through a
restricted FD / broker. Seatbelt operation denies do not close this: adding
(deny process-info*)or(deny sysctl-read)still allowedKERN_PROCARGS2intesting.
Related but distinct: #8678 (credentials file readable from the sandbox) and
CVE-2026-82533 (control-plane Host-header trust, fixed in 0.1.2-alpha.1).
Please consider enabling GitHub private vulnerability reporting or publishing a
security contact; the full reproduction, helper source, and screenshots are ready
to send privately.
— rockmelodies (rockysocket@gmail.com)
Reproduction evidence
fig1.png — Project-level skill in the test repository; no trust prompt is involved.
fig2.png — First model request: the repository skill's catalog entry is already in context.
fig3.png — Default
workspace-write: one bash call reads a file outside the workspace and reaches 127.0.0.1.fig4.png — Seatbelt profile behaviour: reads pass, writes outside are denied, network is open.
fig5.png — Session log:
workspace-write,approval/policy=ask, zeroapproval/askedevents.fig6.png — Credential read and POST: tool result, collector log, and session log all hold the plaintext value.
fig7.png — Same-name skill shadowing: project rank 100 replaces the user-level skill (rank 400).
fig8.png — Web UI renders the assistant message; the remote image is fetched by the browser.
fig9.png — Collector log: the browser request triggered by the rendered message.
fig10.png — Parent environment read: child env is scrubbed, the provider key is still returned.
All reactions