Flowsh shell controls data flow to secure AI agent actions
Flowsh: An Information Flow-Controlled Shell for AI Agents
Cryptography and Security
Summary
AI agents can run commands and access files and networks, but this can cause problems like accidentally leaking private data or messing up files. The authors created Flowsh, a shell that watches how information moves in these commands to prevent unsafe actions without needing lots of human checks. Flowsh tracks what data is trusted or not and stops or asks for approval only when needed. This makes AI agents safer and more efficient when working with computers.
What this means in practice
- •For cloud infrastructure teams: Control and monitor AI agents running scripts on cloud servers to prevent data leaks and unauthorized file changes without excessive human approval requests.
- •For security operations teams: Secure shell environments used by automated systems to enforce dynamic information-flow policies, reducing risks from automated code execution and network activities.
Authors
Juhee Kim, Leon Trampert, Boris Köpf, Aashish Kolluri, Shruti Tople, Santiago Zanella-Béguelin
Abstract
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 pressure. 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 guarantees. 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 resources, 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 monitoring, and by maintaining an information-flow label for the context and updating it with the labels of observed inputs. 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-23x compared with sandboxes, while preserving utility and ensuring that approval is requested for every unsafe action.