AI Security Flaws: Sandbox Escapes and Data Injection Attacks in Cursor, Gemini, and Codex

by Anika Shah - Technology
0 comments

Security researchers have identified a critical vulnerability in AI-powered coding assistants, including Cursor, GitHub Copilot (Codex), and Google Gemini. The flaw allows attackers to bypass sandbox environments by executing malicious commands directly on a user’s machine. This "prompt injection" technique tricks AI agents into misinterpreting instructions, effectively granting them unauthorized access to the host system’s shell and file structure.

How AI Agent Sandbox Escapes Work

The vulnerability stems from the way AI coding tools interact with the local development environment.

By injecting specially crafted prompts into the AI agent, an attacker can force the model to ignore its security constraints. Because the AI is often granted "agentic" capabilities—the ability to perform actions autonomously—it functions as a proxy for the attacker, bypassing traditional sandbox protections that are designed to isolate untrusted code rather than the AI itself.

Affected Platforms and Known Risks

The research highlights that the risk is not limited to a single provider.

Affected Platforms and Known Risks
  • GitHub Copilot (Codex): While primarily a code completion tool, Copilot’s growing "agentic" features—which allow it to suggest and run terminal commands—introduce similar attack vectors.
  • Google Gemini: When used within CLI (Command Line Interface) environments or integrated into developer workflows, Gemini can be manipulated to execute system-level operations if the input sanitization is insufficient.

Security Implications for Developers

If an AI agent is compromised via a "data injection" attack—where the agent reads a malicious instruction from a repository or a web-based document—it may execute that instruction with the same privileges as the developer. This effectively turns the developer’s own tools into an attack vector, potentially leading to credential theft, data destruction, or the installation of persistent backdoors on the developer’s machine.

Security Implications for Developers

Mitigating AI Agent Vulnerabilities

Developers and organizations can take several steps to limit the impact of these vulnerabilities:

Mark Brand and Sergei Glazunov Data Only Sandbox Escapes
  • Restrict Permissions: Run AI coding assistants in isolated containers or virtual machines rather than directly on the host OS.
  • Human-in-the-Loop: Configure AI tools to require explicit human approval before executing any terminal command. Never allow an agent to run commands silently.
  • Environment Auditing: Regularly audit the permissions granted to AI extensions within IDEs like VS Code.
  • Input Sanitization: Treat all external data—including README files, documentation, and external libraries—as untrusted, as these are the primary sources for malicious prompt injections.

Until these platforms implement more robust isolation, the responsibility remains with the user to verify every action initiated by an AI assistant.

Related Posts

Leave a Comment