Update cookies preferences

Remote Code Execution (RCE)

Updated:
 
August 14, 2026
Overview

Remote Code Execution (RCE) is a class of vulnerability in which an attacker causes arbitrary code to run on a target system without authorized access. In AI agent contexts it usually arises when an agent's tool use can be steered – through prompt injection, tool poisoning, or a compromised MCP server – into executing commands the operator never intended.

  • An attacker runs arbitrary code on a system without authorized access to it
  • Agent RCE is the worst-case failure mode of tool use and autonomy
  • The agent's execution environment sets the blast radius, not the model
  • Practical defense sits at the agent runtime layer rather than the model layer

Why is remote code execution important?

RCE through an AI agent is the worst-case failure mode of agent autonomy. The agent inherits the credentials and permissions of its execution environment, so if it can be steered toward a code-executing tool, the attacker inherits that same scope. A prompt becomes a command, and the command runs with whatever the agent was trusted to hold.

This is no longer theoretical. CrowdStrike documented malicious prompts injected into legitimate AI tools at more than 90 organizations during 2025, generating commands that stole credentials and cryptocurrency, alongside exploitation of AI development platforms to establish persistence and deploy ransomware. Both CISA and OWASP have flagged agent RCE patterns in recent guidance.

What makes agent RCE distinct from classical RCE is the entry point. There is no memory corruption bug to patch. The vulnerability is that an agent with tool access will follow instructions it finds in the data it processes.

What is remote code execution?

Remote code execution is a vulnerability class allowing an attacker to run commands on a target system without physical access or valid credentials for it. Classically the attacker exploits a flaw in how a system handles untrusted input, then executes code at the privilege level of the compromised process.

In AI agent environments the mechanism changes while the outcome does not. An agent reads external content – a document, or a tool response it has no reason to distrust – that carries instructions crafted by an attacker. The agent treats those instructions as legitimate and calls a tool that can execute code, write files, install packages, or invoke another agent. Nothing was exploited in the traditional sense; the agent was persuaded.

Three paths recur. Prompt injection carries the instruction. Tool poisoning compromises the tool an agent trusts. A compromised MCP server sits between the agent and everything it reaches. In each case the defense is the same: evaluate the tool call before it executes.

Types of remote code execution

RCE is usually grouped by the flaw that enables it, and agent environments add a category that did not previously exist.

Classical paths include memory corruption, where malformed input overwrites execution state; insecure deserialization, where untrusted serialized data reconstructs into executable objects; command injection, where unvalidated input reaches a shell or interpreter; and template or expression injection in web frameworks.

Agent-mediated RCE is the newer category, and it does not require a software defect at all. The agent is functioning as designed – reading content, choosing a tool, calling it. What fails is authorization at the action boundary. Sub-paths include instruction injection through retrieved content, poisoned tool descriptions that misrepresent what a tool does, and compromised MCP servers that return attacker-controlled results.

The distinction matters for remediation. Classical RCE is patched. Agent-mediated RCE is governed, because there is no bug to fix.

Remote Code Execution & Onyx

Onyx inspects every tool call at the request boundary, with action-class controls that intercept the steps an RCE chain depends on. Destructive action detection flags operations capable of altering or deleting state. Tool restrictions limit which agents may reach code-executing tools at all. Package provenance checks what an agent is about to install before it installs it.

Because enforcement happens inline, an agent steered toward a code-executing tool meets a policy decision before the call resolves rather than an alert afterward. Runtime and prompt injection defense handles the instruction path, and MCP security governs the servers an agent depends on.

Frequently Asked Questions

How is agent RCE different from a traditional RCE vulnerability?
Traditional RCE exploits a software defect and is fixed by patching. Agent RCE exploits legitimate tool access using instructions hidden in content the agent processes. Nothing is broken, so there is nothing to patch – the control has to sit at the action boundary instead.
Can an AI agent cause RCE without any code vulnerability present?
Yes, and this is the important case. If an agent can call a shell or install a package, an attacker who can influence what that agent reads can reach those capabilities. The agent behaves correctly throughout.
What limits the damage when an agent is steered into executing code?
The permissions of its execution environment. An agent scoped to a single read-only dataset causes less harm than one holding broad cloud credentials. Just-in-time, task-scoped permissions shrink the blast radius more reliably than reviewing standing access.
Which OWASP category covers this?
Excessive agency comes closest, since it addresses agents granted more capability or autonomy than the task requires. Prompt injection is the usual delivery mechanism. Both appear in the OWASP Top 10 for LLM Applications.
How do we test whether our agents are exposed?
Red team the tool surface rather than the model. Inventory which agents can execute code or write files, then attempt to reach those tools through content the agent ingests. MITRE ATLAS catalogs the relevant technique patterns.
Related terms:
Table of Contents