Prompt Engineering

Prompt Injection Explained: The Hidden AI Security Risk

Prompt injection hides instructions in content an AI reads, and no fool-proof fix exists yet. Here is how it works, which real CVEs show it, and a four-question access review to limit the damage.

Toolbit AI - Team
5 min read
Prompt Injection Explained: The Hidden AI Security Risk

Short answer: Prompt injection hides instructions inside content an AI reads, so the model follows the attacker instead of you. OWASP says no fool-proof prevention is known, so the practical goal is limiting what a hijacked AI tool can reach and do.

The stakes rose once AI tools started acting, not just answering. A chatbot can be fooled into a strange reply. An agent with your inbox, your files and a shell can be fooled into leaking data or running commands. OWASP tracks the risk as "LLM01:2025 Prompt Injection" in its list for LLM applications.

How does prompt injection work?

Prompt injection works because a language model reads your request and the content it processes as one stream of text. It has no reliable way to separate your instructions from a command buried in a webpage.

There are two kinds:

  • Direct injection: the attacker types the malicious instruction into the chat.
  • Indirect injection: the instruction sits in content the AI reads later, such as a webpage, email, file or calendar invite. The user never sees it.

A typical indirect attack, as an illustration, runs in three steps:

  1. An attacker sends you an email with hidden text telling any AI assistant to forward recent invoices to an outside address.
  2. You ask your assistant to summarize today's inbox, and it reads the planted email with the rest.
  3. The model treats the hidden text as a task. If it can send email, the invoices leave.

Simon Willison, who coined the term, put the core problem this way: "AI is about probability. Security based on probability is no security at all." Prompt engineering, such as defining the model's role and scope, is one OWASP mitigation, but it reduces risk rather than removing it.

Which AI systems are most exposed to prompt injection?

The most exposed systems combine three ingredients that Simon Willison calls the lethal trifecta: access to private data, exposure to untrusted content, and a way to communicate externally. Remove any one, and an injected instruction has much less to steal or send.

The lethal trifecta: an AI tool that reads private data, takes in untrusted content and can act externally gives an attacker a path to your data

Private data means an inbox, files or a codebase. Untrusted content means web pages, emails or shared documents. The outbound channel is any message, API call or command the tool can send. Every tool you connect in multi-agent systems can add one of these ingredients.

Scored vulnerabilities in the NVD show the ingredients at work:

VulnerabilityWhat the CVE record saysCVSSIngredient it exposes
CVE-2025-32711, Microsoft 365 Copilot, June 2025AI command injection lets an attacker disclose information over a network, with no user interaction9.3Private data leaving through an outbound channel
CVE-2026-22708, Cursor before 2.3, January 2026In Auto-Run Mode, some shell built-ins skipped the allowlist, so prompt injection could poison the shell7.2 (CVSS 4.0)External action
CVE-2026-25592, Semantic Kernel .NET SDK, February 2026Arbitrary file write in the SessionsPythonPlugin, fixed in 1.71.09.9External action
CVE-2026-26030, Semantic Kernel Python SDK, February 2026Remote code execution in the InMemoryVectorStore filter before 1.39.49.9External action

The two Semantic Kernel CVE records do not mention prompt injection themselves; Microsoft's write-up covers them as flaws in AI agent frameworks.

Microsoft's write-up on the Semantic Kernel flaws states the lesson plainly: "your LLM is not a security boundary." It adds: "The tools you expose define your attacker's affected scope."

How often does prompt injection succeed?

Success rates depend heavily on what the model can touch. Anthropic's system card for Claude Opus 4.6, as reported by VentureBeat in February 2026, shows the gap within one model:

  • Constrained coding environment: 0% success across 200 attempts, with no safeguards needed.
  • GUI-based setup with extended thinking, one attempt: 17.8% got through without safeguards.
  • GUI-based setup with extended thinking, 200 attempts: 78.6% without safeguards and 57.1% with them.
Claude Opus 4.6 prompt injection success by setting: 0% in a coding sandbox over 200 tries, but 78.6% by attempt 200 in a GUI setup without safeguards

A persistent attacker was about 4.4 times as successful at attempt 200 as at attempt 1. Safeguards lowered the 200-attempt rate, but not to zero.

Coding agents are a weak spot. The AIShellJack study ran 314 attack payloads, covering 70 MITRE ATT&CK techniques, against GitHub Copilot and Cursor. It found "attack success rates can reach as high as 84% for executing malicious commands." If your team uses agentic IDEs, treat auto-run settings as a security decision.

Security agencies treat the risk as lasting. In May 2026, Five Eyes agencies including CISA, NSA and the UK NCSC published "Careful Adoption of Agentic AI Services." The Cloud Security Alliance's summary calls prompt injection "the most persistent and difficult-to-fix threat."

Prompt injection vs jailbreaks and supply-chain attacks: what's the difference?

Prompt injection turns content the AI reads against the user, while neighboring attacks target the model's rules or the software around it. Mixing them up leads to the wrong fix.

TermWhat it isHow it differsExample
Prompt injectionInstructions hidden in input that the AI then followsA third party hijacks the model through contentCVE-2025-32711 in Microsoft 365 Copilot
JailbreakA user talks the model out of its own rulesThe user is the attacker; the target is the model's policyA user asks the chatbot to role-play past its rules
Supply-chain attackA trusted package ships malicious codeNo AI instruction needed; the code is the attackLiteLLM 1.82.7 and 1.82.8 harvested credentials, March 24, 2026
Classic bug exploitA coding flaw in software around the AIPatched like any other bugCVE-2025-6514, OS command injection in mcp-remote, CVSS 9.6

FutureSearch counted 47,000 downloads of the bad LiteLLM versions in 46 minutes. A smaller case, postmark-mcp, turned malicious in version 1.0.16 and copied every email sent through it to an attacker.

Try the four-question access review on your AI tools

Run this review on every AI tool that reads outside content. Each question maps to a mitigation on OWASP's list:

  1. Does it need this data? Cut privileges to the minimum the task requires.
  2. What outside content does it read? Treat web pages, emails and shared files as untrusted, and keep them apart from instructions.
  3. What can it do without asking? Require human approval for high-risk actions such as payments, external email and shell commands. Our guide to tool allowlists and approval gates shows one setup.
  4. When did you last attack it? Run regular adversarial tests, and validate outputs before they reach another system.

Decision rule: if a tool has all three trifecta ingredients, remove one or gate it behind human approval before you connect it. Keep your usual application security tools on the software around the AI, since classic bugs still apply.

Share this article

Related articles

Continue exploring similar guides and insights