TL;DR
Giving AI agents access to a command-line shell makes them remarkably capable, but it also opens the door to catastrophic mistakes and prompt-injection attacks. FLOWSH solves this by bringing information-flow control (IFC) to the shell: it dynamically tracks where data comes from during command execution and only pauses to ask for human approval when an actual unsafe effect—like leaking confidential data or overwriting protected files—is about to happen.
What Problem Does This Paper Address?
Modern AI agents rely on shell tools to write code, run tests, and process files. Unfortunately, a single shell command can silently read sensitive files, download untrusted scripts, and exfiltrate data. Today’s defenses force an uncomfortable trade-off:
- Command-based approval: Asking humans (or another AI) to approve every shell command leads to severe decision fatigue—Anthropic reports that users blindly approve roughly 93% of permission prompts—and even simple-looking commands can have unpredictable effects.
- Static sandboxing: Locking down the filesystem and network with static allowlists either leaves gaps (a "Lax" sandbox) or breaks legitimate tasks (a "Strict" sandbox).
Information-flow control (IFC) offers a middle ground by tracking confidentiality (who can read data) and integrity (whether data is trusted) labels. While IFC has been applied to structured agent tools (like sending an email), it doesn't easily translate to the shell, because you can't reliably predict what a shell command will do before it runs.
Methods
Instead of trying to predict a shell command's effects up front, FLOWSH monitors the command as it runs inside a Bubblewrap sandbox and enforces IFC policies on its actual effects:
- Dynamic Input Monitoring: An eBPF monitor watches file reads at the kernel's inode level, while a man-in-the-middle (MITM) proxy (
mitmproxy) intercepts all network traffic. Whenever the shell reads a file or opens a network connection, FLOWSH joins that input's label into a single shell context label. - Staged File Effects (OverlayFS): File modifications are written to an OverlayFS layer rather than the host filesystem. Once the command finishes, FLOWSH checks the final shell context label against the IFC policy. Safe changes are applied automatically; unsafe ones are held for a single, unified user approval.
- Mediated Network Effects: Because you can't "undo" a network request once sent, the MITM proxy checks each outgoing request before forwarding it. Blocked requests return an error and an
approval ID, allowing the agent to explicitly ask the user for permission to retry in a later command. - Persistent Labels: FLOWSH stores file labels in Linux inode extended attributes (
xattrs), ensuring that security restrictions persist across commands and even separate agent sessions.
Datasets
The authors evaluated FLOWSH (using GPT-6.2 Sol) across two main workloads:
- Terminal-Bench 2.0: An existing benchmark of 89 real-world shell tasks.
- Curated Knowledge-Work Tasks: A newly constructed suite of 17 realistic daily-work tasks (e.g., managing emails/calendars, literature comparison, GitHub issue triage) running in a mock environment with webpages and MCP servers.
- Prompt-Injection Tasks: 19 attack scenarios built from the 11 knowledge tasks that touch untrusted data, evaluated against a worst-case Byzantine adversary (where the attacker gains full control of the model's output the moment an injected payload enters its context).
Key Insights and Ideas
- Enforce at the effect, not the input: Traditional OS-level IFC systems often block reading a confidential file if a public network socket is merely open. By propagating labels into a shell context and checking policies only when a file is written or a network request is sent, FLOWSH avoids unnecessary blocks.
- Command-level staging enables clean approvals: Using OverlayFS lets the agent's commands run naturally—even reading their own temporary writes—while keeping the host safe until a human signs off on the final, consistent set of changes.
- Persistent metadata matters: Storing labels in
xattrsprevents an agent from laundering untrusted or secret data by simply writing it to a file and reading it back in a new session.
Key Results
- Drastic reduction in approvals: In a security-aligned setting (with an ideal approver), FLOWSH reduced approval requests per completed task by 5.8× on knowledge tasks (1.2 vs. 6.7) and 22.5× on Terminal-Bench (0.4 vs. 9.7) compared to the Lax sandbox, while maintaining task completion rates within 7.9 and 9.7 percentage points, respectively.
- Zero successful attacks without approval: In an autonomy-aligned setting (no human approver), FLOWSH achieved a 0% Byzantine attack success rate (B-ASR), compared to 100% for the Lax sandbox and 7.7% for the Standard sandbox. Among defenses with 0% B-ASR, FLOWSH achieved the highest task completion rates (58.8% on knowledge tasks, 61.8% on Terminal-Bench).
- Moderate overhead: FLOWSH adds 412–982 ms per shell call (vs. 61–78 ms for Lax), resulting in 17–34% longer end-to-end execution times and 17–55% more tokens.
Limitations and Future Work
- Conservative tracking: FLOWSH tracks information flow at the granularity of an entire command, joining all observed inputs into one context label. Reading a confidential file after writing an unrelated file, or reading a secret that doesn't actually influence a subsequent network request, can still trigger false-positive blocks.
- Shell and network restrictions: Because the sandbox terminates all processes when a command ends, FLOWSH does not support background processes (like servers) or cross-command IPC. Its proxy also currently only supports TCP, excluding UDP and QUIC (HTTP/3).
- Future directions: The authors suggest exploring finer-grained network IFC (e.g., tying labels to OAuth tokens or accepting labels from trusted remote hosts) and studying whether FLOWSH's detailed flow explanations actually help humans and AI approvers make better decisions.
Summary updated