Definition · AI security
Remote code execution
Remote code execution (RCE) is a vulnerability that lets an attacker run their own code on a system they do not control. In AI systems, the path is frequently a prompt injection, a model file or an open tool endpoint. The attacker sends text or a file. A part of the system runs it as code.
Last reviewed
Key points
- RCE lets a remote attacker run code with the rights of the software that runs it.
- The usual root cause is input that becomes code (MITRE CWE-94, code injection).
- OWASP LLM05:2025 names model output sent to a shell, exec or eval as a cause of RCE.
- AI examples include LangChain (CVE-2023-29374, CVSS 9.8), Langflow (CVE-2025-3248, CVSS 9.8, in the CISA KEV catalog) and GitHub Copilot (CVE-2025-53773, CVSS 7.8).
How remote code execution happens
An attacker gets input into the system. Then a part of the system runs that input as code. MITRE CWE-94 calls this code injection.
AI systems show four frequent paths:
| Path | What runs the input | Example |
|---|---|---|
| Model output to an interpreter | Python exec, eval or a shell | LangChain, CVE-2023-29374 |
| Model changes its configuration | The control software of a coding agent | GitHub Copilot, CVE-2025-53773 |
| Open code endpoint | A web API | Langflow, CVE-2025-3248 |
| Model file | A pickle loader | Hugging Face models, 2024 |
The first two start with prompt injection. The attacker puts text where the model reads it.
Why remote code execution is dangerous
The attacker gets the rights of the software that runs the code. The Copilot researcher wrote that Copilot “can escalate privileges and execute code to compromise the developer’s machine”.
In practice: AI examples and controls
Three AI vulnerabilities and their CVSS 3.1 scores:
- LangChain, CVE-2023-29374: 9.8. Network attack, no login, no user step (CISA score, April 2023).
- Langflow, CVE-2025-3248: 9.8. No login. CISA added it to its Known Exploited Vulnerabilities catalog on 5 May 2025.
- GitHub Copilot, CVE-2025-53773: 7.8. Local attack, and a user must start the payload (Microsoft, August 2025).
The sources above show five controls:
- Do not send model output to exec, eval or a shell. If code must run, run it in a sandbox.
- Do not let a model change its own configuration. The Copilot attack wrote the file that disabled approvals.
- Put a login on each endpoint that runs code. The Langflow record names CWE-306, missing authentication for a critical function.
- Do not open pickle files from sources that you do not trust. The Python documentation says: “Never unpickle data that could have come from an untrusted source.” See also trust_remote_code.
- Give the software the minimum rights that it needs. The attacker gets those rights. Least privilege limits the damage.
For RCE through AI agents in the OWASP Top 10 for Agentic Applications, see unexpected code execution.
Where definitions disagree
The word “remote” has two meanings in advisories.
| Source | What “remote” means |
|---|---|
| CVSS 3.1 (FIRST) | Attack vector Network: the attacker can be anywhere on the Internet. Attack vector Local: the attacker path is through read, write or execute access. |
| Microsoft (CVE-2025-53773) | “The word Remote in the title refers to the location of the attacker.” The attack “is carried out locally”. |
Thus a vulnerability with the name RCE can have a CVSS attack vector of Local. Read the CVSS vector, not only the title.
A second dispute is about scope. CVE-2023-48022 says that Ray 2.6.3 and 2.8.0 let a remote attacker run code through the job submission API.
The record has the tag “disputed”. The vendor says that Ray “is not intended for use outside of a strictly controlled network environment”. Thus the two sides do not agree if a missing login is a vulnerability or a deployment error.
Questions and answers
How does prompt injection cause remote code execution?
Prompt injection puts attacker text in front of a model. The text becomes code when the system sends model output to a shell, exec or eval. It also becomes code when the model can change its own configuration. The LangChain LLMMathChain (CVE-2023-29374) ran model output with Python exec. GitHub Copilot (CVE-2025-53773) could disable its own approval step.
Is remote code execution the same as arbitrary code execution?
The two terms overlap. Arbitrary code execution (ACE) means that an attacker runs code that the attacker selects. Microsoft says the word Remote in an RCE title "refers to the location of the attacker". It says this type of exploit "is sometimes referred to as Arbitrary Code Execution (ACE)".
Can a model file cause remote code execution?
Yes, if the file format runs code when software opens it. The Python documentation says that malicious pickle data can "execute arbitrary code during unpickling". In February 2024, JFrog found approximately 100 malicious models on Hugging Face. One model opened a reverse shell when it was opened.
Sources
- CWE-94: Improper Control of Generation of Code (Code Injection)MITRE
- CVE-2023-29374CVE Program, 5 Apr 2023
- CVE-2025-53773CVE Program (Microsoft as CNA), 12 Aug 2025
- Security Update Guide, CVE-2025-53773Microsoft Security Response Center, 12 Aug 2025
- GitHub Copilot: Remote Code Execution via Prompt Injection (CVE-2025-53773)Embrace The Red (Johann Rehberger), 12 Aug 2025
- CVE-2025-3248CVE Program, 7 Apr 2025
- CVE-2023-48022CVE Program, 28 Nov 2023
- pickle, Python object serializationPython Software Foundation
- Data Scientists Targeted by Malicious Hugging Face ML Models with Silent BackdoorJFrog, 27 Feb 2024
- LLM05:2025 Improper Output HandlingOWASP Gen AI Security Project
- Common Vulnerability Scoring System v3.1: Specification DocumentFIRST