Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 2 min read

Why System Prompts Are Not Security Boundaries

Summary: Prompt-level guardrails and regex classifiers cannot create a security boundary when untrusted repository data shares an OS user ID with shell tools. Isolating untrusted synthesis under a dedicated Darwin POSIX

Summary: Prompt-level guardrails and regex classifiers cannot create a security boundary when untrusted repository data shares an OS user ID with shell tools. Isolating untrusted synthesis under a dedicated Darwin POSIX UID with sandbox_init and typed Mach IPC eliminates ambient authority at an 83us end-to-end p99 cost.

Every week, another developer tool ships a patch for an indirect prompt injection CVE by appending uppercase warnings to its system prompt or bolting a regex filter in front of child_process.spawn.

From a systems security standpoint, both mitigations are equivalent to placing a comment in C source code asking strcpy not to overflow the stack.

BROKEN: Single-Context / Ambient Authority (UID 501)
+---------------------------------------------------------------+
| [Poisoned README.md] + [System Prompt] -> [LLM] -> /bin/zsh   |
|  Has full ambient access to ~/.ssh, ~/.aws, Keychain, LAN     |
+---------------------------------------------------------------+

HEIMDALL: Dual-Model Kernel Separation (UID 502 <-> UID 501)
+-----------------------------+     Mach IPC    +---------------+
| Quarantined Worker (UID 502)| --------------> | Coordinator   |
| 0 FS handles | 0 Net sockets|  Typed Proposal | Cedar <= 45us |
+-----------------------------+                 +-------+-------+
                                                        |
                                                [SEP Touch ID]

The Confused Deputy Inside Your Terminal

An LLM token stream is a single flat sequence of embeddings. Once untrusted bytes from a git diff, stack trace, or fetched documentation page enter that context window, every downstream tool invocation becomes a textbook Confused Deputy.

Regex filters and secondary "judge" LLMs fail for two structural reasons:

  1. Completeness Failure: Attackers encode instructions across line breaks, hex literals, commit metadata, or base64 test fixtures that the coding model decodes in-context after the input filter runs.
  2. Latency & Utility Tax: Secondary LLM classifiers add 150ms–400ms per turn while falsely flagging legitimate security patches or SQL migration scripts.

Kernel-Enforced Dual-Model Privilege Separation

Heimdall-Enclave removes ambient authority from the model ingesting untrusted data:

  • Isolated Darwin UID (502): The Quarantined Synthesizer drops privileges immediately at spawn and enters an immutable Darwin sandbox (no-network, no-file-read*, no-process-exec). Even arbitrary native code execution inside the worker yields zero host credentials.
  • Typed Mach Port IPC: Communication back to the Executive Coordinator (UID 501) accepts strictly bounded Cap'n-style typed capability requestsβ€”never free-form bash pipelines.
  • Deterministic Cedar Evaluation: Every proposed action is checked against machine-verified Cedar invariants (p99 <= 45us) before issuing a scoped WASI 0.2 handle or triggering a Touch ID SEP sheet.

Limitations & Trade-Offs

  • Explicit Capability Wiring: Tools can no longer rely on ambient $PATH or ~/.config files; workflows require explicit directory/host capability grants.
  • IPC Serialization Cost: Crossing the Mach IPC + Cedar boundary adds ~83us p99 overhead per tool call (negligible next to token generation, but measurable in tight >10k/sec micro-loops).

Verify Locally

git clone https://github.com/w8mej/heimdall-enclave.git
cd heimdall-enclave && cargo test -p heimdall-ipc --release
πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.