Featured Check out our Deep & Dark Web Monitoring Platform — DarkWiser Meet DarkWiser — Dark Web Monitoring

Research

AI Agent Runtime Penetration Testing for Sandbox Escape

AI agents increasingly execute code, access files, call APIs, and interact with internal services as part of everyday operations. Many deployments rely on containers or isolated sessions to keep these activities contained. However, recent research has exposed weaknesses at the boundaries between these environments and the systems around them. Helper functions, local services, and network connections can create routes to resources beyond the agent's intended access. AI agent runtime penetration testing examines whether these boundaries hold under attack and whether an agent can gain access to the host, internal services, or cloud infrastructure.

This article examines two documented cases in which weaknesses around agent execution environments enabled access beyond the intended boundaries. It explores the underlying design flaws, the areas a runtime assessment should cover, and how a penetration testing engagement can identify and validate these risks. The objective is to help security teams determine whether their agent deployments provide the level of isolation they expect.

1. Where Agent Isolation Breaks Down in Practice

An AI agent's runtime extends beyond the execution sandbox. It includes the underlying framework, host process, connected tools, management interfaces, and surrounding network infrastructure. Each interaction between these components can introduce a weakness that undermines isolation. For example, a sandbox may restrict direct access to host files, yet a connected host-side tool may still allow the agent to write files outside that environment.

Prompt injection can make these weaknesses easier to exploit by influencing the parameters an agent supplies to its tools. As Microsoft researchers explain, the model itself should not be treated as a security boundary. The tools exposed to it, and the permissions behind those tools, ultimately determine which resources an attacker may be able to reach.

2. Two Documented Paths from Agent Execution to Host Access

2.1 A File Transfer Helper Exposed to the Model

In one Semantic Kernel implementation, agent code ran inside Azure Container Apps dynamic sessions, which provide isolated cloud execution environments. However, a host-side file download helper in the .NET SDK was inadvertently exposed to the model as a callable tool. Tracked as CVE-2026-25592, the vulnerability affected versions before 1.71.0.

The helper accepted a local file path that determined where the host would write the downloaded data, but the input was not properly validated. By exploiting this behaviour through prompt injection, an attacker could instruct the agent to create a script inside the sandbox and then use the exposed helper to place it in the host's Windows Startup folder. The script would execute when the host user next signed in. The remediation removed the model's access to the vulnerable function and introduced path validation.

2.2 A Local Control Interface That Trusted Localhost

The AutoJack research describes a vulnerability in an AutoGen Studio setup where a browsing agent opened an attacker-controlled webpage on a developer's machine. The page established a WebSocket connection to a local MCP endpoint that trusted connections from localhost without requiring authentication. It also accepted the process-launch command from the incoming request, allowing the webpage to trigger process execution on the host.

Microsoft clarifies that this MCP WebSocket interface was never included in a published PyPI release. The issue was addressed in the upstream development branch.

3. Boundaries a Runtime Assessment Should Test

Both cases demonstrate how untrusted input can reach a privileged component that incorrectly trusts its source. A thorough runtime assessment should therefore examine every boundary the agent can interact with, either directly or through its connected tools. Key areas to test include:

  • Host-side tools and helper functions: Verify that file paths, commands, and other model-supplied parameters are properly validated before execution.
  • Runtime APIs and local interfaces: Assess authentication and access controls on APIs, WebSocket connections, and debugging endpoints, including any implicit trust placed in localhost.
  • Network access: Determine whether the agent can reach internal services, cloud metadata endpoints, or external destinations beyond its intended network permissions.
  • Filesystem and session isolation: Check whether mounted volumes, temporary files, and shared resources could expose data across host environments or concurrent agent sessions.
  • Container privileges and credentials: Review the permissions assigned to the runtime and identify whether the agent can access credentials or resources beyond those required for its tasks.

The UK NCSC guidance on agentic AI recommends defining sandbox boundaries around everything an agent can access or influence. It also highlights the risk of agents exploiting configuration weaknesses to move beyond those boundaries. A related example is Laburity's analysis of a workflow container running scripts as root, which illustrates how excessive execution privileges can expose sensitive credentials and metadata, increasing the potential impact of a security flaw.

4. How a Runtime Penetration Test Proceeds

A penetration testing engagement for an AI agent runtime begins with scoping and an architecture review. This establishes how the framework, execution environment, connected tools, management interfaces, and network paths interact. Testers then assess these components from the agent's execution context, using controlled test cases to determine whether its permissions or tool interactions can be manipulated to cross isolation boundaries.

Any identified weaknesses are validated in a controlled manner to establish their potential impact and determine which host resources, internal services, or infrastructure components could be reached. The final report documents the affected components, supporting evidence, risk levels, and recommended remediation measures. Retesting can then verify

Sandboxing is effective only when the components surrounding the execution environment enforce the same isolation boundaries. Model guardrails alone cannot guarantee this. The tools, interfaces, and services connected to an agent determine what it can access when an interaction is manipulated or exploited. Runtime penetration testing helps establish whether those connections remain within their intended security boundaries.

If you're looking to assess your organization's exposure to similar risks, Scan your organization's exposure, explore Laburity, or book a consultation.

Strengthen your security posture before attackers expose the gaps.

Don't wait for a breach, secure your cyber space now. You would be talking to an actual cyber security expert.

[email protected]+44 7380 443020