Urgent.News

What's breaking now, across thousands of outlets.

World

Sandboxing an Agent That Executes Code

The threat model is unusual and that is what makes it easy to get wrong. The code is not written by an attacker, and it is not written by a trusted developer either. It is written by a model that has been reading attacker-controlled text all afternoon. What you are actually defending against Three sources, ordered by how often they bite: Accident. An rm -rf with a variable that was empty, a…

Abstract editorial illustration

This report examines a security threat model involving a sandboxed agent that executes code. The code in question is not written by an attacker or a trusted developer, but rather by a model that has read attacker-controlled text. The primary concern is defending against potential accidents, such as destructive commands or scripts that consume excessive resources.

Indirect prompt injections pose another risk, where the agent reads instructions from external sources like web pages or issue comments. Direct abuse is also a concern, as users may prompt the agent to run their own code on the system's infrastructure. To mitigate these risks, the report outlines six critical defenses. Firstly, the container must be isolated from the kernel and cloud metadata endpoints to prevent exfiltration or reverse shell establishment.

Secondly, the container should run with minimal privileges, dropping all capabilities and restricting the user namespace to prevent privilege escalation. Thirdly, egress should be restricted by using a network namespace that does not allow outbound traffic. Fourthly, the bind mount containing the workspace must be carefully monitored, as symlinks and scripts within it could potentially execute malicious code outside the sandbox.

Fifthly, environment variables containing sensitive information should be avoided; instead, credentials should be requested through a secure, audited interface. Lastly, resource limits must be set to prevent prolonged execution or disk space exhaustion. The report emphasizes that while default seccomp profiles provide some protection, they are not sufficient for hosting truly untrusted code.

Implementing a custom allowlist profile tailored to the specific workload is recommended. Additionally, gVisor can provide an additional layer of isolation by interposing a user-space kernel between the workload and the host, reducing the risk of kernel vulnerabilities.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in World

More from Friday 7 August →