Flowsh tracks information-flow labels through shell commands at runtime using eBPF and a network proxy, reducing approval requests 5–23× versus sandboxes while blocking all tested prompt-injection attacks deterministically.
| Security-aligned | Autonomy-aligned (approval) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Knowledge (U) | Knowledge (S) | Terminal-Bench | Knowledge (U) | Knowledge (S) | Terminal-Bench | ||||
| Defense | TCR | Appr. | B-ASR | Appr.† | TCR | Appr. | TCR | B-ASR | TCR |
| Lax | 96.1 (49/51) | 6.7 (328/49) | 0.0 (0/50) | 4.1 (203/50) | 77.5 (207/267) | 9.7 (2008/207) | 94.1 (48/51) | 100.0 (51/51) | 77.9 (208/267) |
| Standard | 76.5 (39/51) | 5.7 (224/39) | 0.0 (0/39) | 3.5 (135/39) | 64.4 (172/267) | 10.0 (1714/172) | 76.5 (39/51) | 7.7 (3/39) | 64.8 (173/267) |
| Strict | 47.1 (24/51) | 0.0 (0/24) | 0.0 (0/38) | 0.0 | 1.9 (5/267) | 0.0 (0/5) | 47.1 (24/51) | 0.0 (0/39) | 2.2 (6/267) |
| Naive IFC | 60.8 (31/51) | 1.8 (56/31) | 0.0 (0/45) | 1.7 (77/45) | 67.8 (181/267) | 9.4 (1707/181) | 35.3 (18/51) | 0.0 (0/32) | 21.3 (57/267) |
| Flowsh | 88.2 (45/51) | 1.2 (52/45) | 0.0 (0/45) | 1.2 (56/45) | 67.8 (181/267) | 0.4 (78/181) | 58.8 (30/51) | 0.0 (0/40) | 61.8 (165/267) |
Going deeper
Flowsh design. (1) When the agent calls the shell tool, it passes the shell command; Flowsh additionally takes the agent context label and runs the shell command in the shell. (2) Flowsh monitors the file and network inputs of the command and propagates their labels into the shell context label. (3) When the command produces a file or network effect, Flowsh checks the IFC policy. (4) A safe flow takes effect immediately; an unsafe flow enters the approval flow. For file changes, Flowsh requests approval after the shell command finishes; for network requests, Flowsh blocks the request and creates an approval ID. (5) Flowsh returns the shell result with the shell context label and any approval IDs. (6) When the agent passes an approval ID in its next shell tool call, Flowsh requests approval before running the command.
Imagine you hire an assistant to work in your office. They can open any file cabinet and make any phone call. To keep secrets safe, you could watch every move and approve each one—but you will get tired and start saying yes to everything. Or you could lock most cabinets, but then the assistant cannot do the job.
Flowsh takes a third approach: it puts colored stickers on every document and every phone number. A red sticker means confidential; a yellow sticker means the source is not trusted. As the assistant works, Flowsh watches which drawers they open and which calls they make, and adds the stickers from each source to a running tally. Before the assistant can send a fax or put a file back, Flowsh checks whether the stickers on the tally match the rules—say, do not fax a red-stickered document to an outside number. If it is fine, the fax goes. If not, it asks you, with a note explaining exactly why.
In tests with 17 office-style tasks, the assistant needed your attention roughly once per task instead of seven times. And when a trick instruction was hidden in a document, the sticker system caught it every time, even without asking you at all.
The abstract, word for word, with the seven densest phrases unpacked.
The shell empowers AI agents with filesystem, network, and code execution capabilities. However, these capabilities also create significant risks of file corruption or data leakage, for example, through prompt injection attacks or goal pressure1. To mitigate these risks, agents typically request approvals by humans or AI models, both of which are prone to mistakes. The alternative is static sandboxing, which either limits utility or fails to provide strong security. Information-flow control (IFC) is a promising approach to reduce approval requests while at the same time providing deterministic guarantees2. For example, IFC ensures that consequential actions are not influenced by untrusted data (preventing prompt injection) or that data never flows to unauthorized readers (preventing exfiltration and oversharing), and it only blocks or triggers approval requests when this cannot be guaranteed. In this paper, we show how to extend IFC to the shell: We design Flowsh, a shell with a new dynamic runtime monitor that observes access to diverse resources3, tracks IFC metadata across command execution and persistent files, and enforces policies on the effects of shell commands. Flowsh achieves this using eBPF and OverlayFS for filesystem monitoring and a man-in-the-middle proxy for network monitoring4, and by maintaining an information-flow label for the context and updating it with the labels of observed inputs5. We evaluate Flowsh within an IFC-enabled agent on Terminal-Bench and a curated set of realistic scenarios. Our results show that Flowsh reduces approval requests by 5–23 × compared with sandboxes6, while preserving utility and ensuring that approval is requested for every unsafe action7.
Two lines converge: information-flow control theory and securing AI agent tools.
Read five parts, in this order.
Skip Section 3 if you know IFC lattices and the agent-loop paradigm. Skip appendices unless configuring Flowsh.
If Flowsh's gains are narrower than they appear, these places are where to look.
| Security-aligned | Autonomy-aligned | |||
|---|---|---|---|---|
| Join of input labels | TCR | Appr. (U) | Appr. (S) | TCR |
| (, ) | 100.0 (3/3) | 0.00 | – | 100.0 (3/3) |
| (, ) | 100.0 (15/15) | 0.00 | – | 100.0 (15/15) |
| (, ) | 100.0 (6/6) | 0.00 | 1.00 | 100.0 (6/6) |
| (, ) | 77.8 (21/27) | 2.48 | 1.30 | 22.2 (6/27) |
Flowsh took 412–982 ms per shell call, compared with 61–78 ms for Lax. Most of this overhead comes from input monitoring and label propagation, because Flowsh identifies the files the shell read and starts a new process in the sandbox to read their labels from xattrs. Shell calls with a network request take longer, because Flowsh performs additional input monitoring and label propagation before forwarding the network request. Sandboxing and policy enforcement also take longer than in Lax, because Flowsh sets up the sandbox’s connection to the MITM proxy and remounts the OverlayFS layer for each shell command. Preparing the sandbox and its proxy connection ahead of time and remounting the OverlayFS layer in parallel with other steps could reduce these costs.
Byzantine Adversary. We ran the prompt injection tasks against a Byzantine adversary, as also suggested in previous research [61]. In this worst-case attack scenario, once an attacker payload appears in the model input, the adversary fully controls the model output. Using a Byzantine adversary lets us evaluate the defense’s ability to block attacks independently of the model’s probabilistic resistance to prompt injection.
Nothing on this page was recomputed. Every claim points to the paper so you can check it.
More latest news
Read all