AI security

What is a Prompt Injection Attack?

A plain-language guide to prompt injection, the top security risk for AI assistants, with the layered controls that keep it from turning into a breach.

Key takeaways
  • Prompt injection is the number one security risk for LLM applications in the OWASP Top 10 and has held the top spot for two editions (2025).
  • It works because a language model reads instructions and data in the same channel and cannot reliably tell a developer’s rules from text supplied by a user or hidden in content.
  • Most attacks need no code or exploit, only carefully worded plain language.
  • Direct injection is typed straight into the model. Indirect injection hides instructions in content the model reads, such as an email, a web page or a document.
  • It cannot be fully patched. NIST and OWASP both state that current methods reduce the risk but cannot completely prevent it.
  • Impact ranges from reputational, a bot rubbishing its own company, to data theft, where a zero-click email pulled data out of Microsoft 365 Copilot (CVE-2025-32711).
  • The higher-stakes risk is internal assistants and agents that can read company data and take actions on your behalf.
  • About 71% of organisations now use generative AI in at least one business function, so the exposure is broad (McKinsey, 2025).
  • Defence is layered: least-privilege access, isolating untrusted content, filtering outputs and requiring human sign-off on sensitive actions.
  • Under the EU AI Act and NIS2, resilience against input manipulation and prompt reporting of any resulting breach is a legal duty in the EU and Sweden.

Prompt Injection in Plain Terms

A prompt injection attack is when someone feeds an AI system crafted text that the model treats as a new instruction, overriding the rules its developer gave it. The text can be typed straight in or hidden inside content the AI reads and it needs no code, only careful wording.

This matters because AI assistants now sit inside everyday work. In 2025, 71% of organisations reported using generative AI in at least one business function up from 65% a year earlier according to McKinsey. Every chatbot, copilot and agent that reads a message, a document or a web page is a place an instruction can be smuggled in.

Security researchers named the technique in 2022 drawing an analogy to SQL injection where attackers slip commands into data. The Open Worldwide Application Security Project (OWASP) now ranks prompt injection as the number one risk for applications built on large language models.

How a Prompt Injection Attack Works

A language model reads everything it is given as one stream of text. The developer’s rules, your question and any content the model pulls in all arrive in the same channel and the model has no reliable way to tell a trusted instruction from ordinary text. So a sentence buried in that text, phrased as a command can be followed as if the developer had written it.

How a Prompt Injection Attack Works

That is the whole trick. OWASP states it plainly, models process instructions and data together without clear separation so an attacker can craft input the model reads as a new instruction rather than as content to handle.

It is the same weakness as SQL injection where code and data share one line. Prompt injection is harder to fix because the thing reading the input is a statistical model with no fixed grammar, not a parser you can lock down. There is no character you can escape to make the risk go away.

Two shifts make it worse. Retrieval-augmented systems feed the model live external content, a web page or a file so untrusted text reaches the model on its own. AI agents go further and can act on what they read sending an email or calling a tool, which turns a rogue instruction into a rogue action.

Types of Prompt Injection Attacks

NIST and OWASP group the attack into two root forms, plus a hidden variant that cuts across both.

  • Direct injection: Typed straight into the model through a chat box, form or API. It covers jailbreaks that strip a model’s safety rules and it is how the Chevrolet and DPD bots were pushed off script.
  • Indirect injection: Hidden inside content the model later reads such as a web page, an email, a PDF or a calendar invite. The user never sees it which is what lets it scale and what makes data theft possible.
  • Hidden and multimodal injection: Instructions concealed in invisible text, white font, HTML comments or metadata. They can also hide inside an image the model processes. OWASP flags multimodal injection as a growing route.

What the attacker does with that foothold varies. It can force the model to break its rules, reveal its hidden system prompt or secrets, hand over data it can reach or, in an agent, take an action on the attacker’s behalf.

Business Impact of Prompt Injection

The cost of a prompt injection attack depends on what the AI can reach and what it can do. In practice the harm climbs through four levels.

At the mild end sits reputational damage. A public chatbot that swears at a customer or calls its own company the worst in its industry becomes a screenshot within minutes. Neither the DPD nor the Chevrolet bot lost money yet both made the brand the punchline.

The next step up is disclosure. An attacker can pull out the hidden system prompt, internal rules or secrets an assistant holds, as happened to Bing Chat, which hands over a map of how the system works.

More serious is data theft. Where an assistant can read company files and also send messages, a single injected instruction can make it copy sensitive data to an outsider. The Microsoft 365 Copilot flaw proved this is more than a hypothetical worry.

The sharpest risk is unauthorised action. In an agent that can move money, change records or run code, a rogue instruction becomes a rogue transaction and a data leak or an outage can also become a regulatory event.

Real-World Prompt Injection Cases

Four incidents show the range from a leaked secret to stolen data. Each also points to the control that would have blunted it.

Bing Chat Reveals Its Codename (2023)

Days after Microsoft launched its AI-powered Bing Chat in February 2023, Stanford student Kevin Liu typed a simple instruction telling it to ignore its previous instructions and print what came before. The model obliged and revealed its hidden system prompt including an internal codename (Sydney) and rules it had been told never to disclose.

Microsoft confirmed the leaked text was real and closed the first route but another bypass appeared within days. The lesson is not to treat the system prompt as a secret. Keep credentials and anything sensitive out of it and enforce limits outside the model.

A Chatbot Sells a Car for One Dollar (2023)

In December 2023, a customer told the ChatGPT-powered chatbot on a Chevrolet dealership’s website to agree with anything he said and treat it as binding. He then got it to accept one dollar for a new Chevrolet Tahoe (an SUV that lists for tens of thousands of dollars) and to add that there were no takesies backsies.

The dealership never honoured the offer and took the bot down within days. Others had already made it write code and recommend rival brands. Nothing was stolen but the bot spoke for the business with no guardrails. Scope a customer-facing bot to answering questions and route any price or commitment to a person.

A Delivery Bot Turns on Its Owner (2024)

On 18 January 2024, a frustrated DPD customer prompted the firm’s support chatbot into swearing, writing a poem about how useless it was and calling DPD the worst delivery firm in the world, even after it said it was not allowed to swear. It also suggested rival couriers.

DPD blamed a system update and switched the AI element off the same day. The post was viewed millions of times. The fix here is output controls that survive every change, checked with adversarial testing after each update rather than only at launch.

A Zero-Click Email Steals Data From Copilot (2025)

In 2025, researchers disclosed a flaw in Microsoft 365 Copilot, tracked as CVE-2025-32711 and nicknamed EchoLeak. A single crafted email with no click or action from the recipient could make Copilot read data from the user’s context and send it to an outside server.

A Zero-Click Email Steals Data From Copilot

The instructions were hidden in the email and reached Copilot through its normal retrieval, slipping past Microsoft’s own prompt-injection filter. Microsoft patched it before public disclosure and found no sign it was used in the wild. It is regarded as the first documented case of indirect injection turned into working data theft in a live AI assistant.

The control is least privilege plus egress limits. An assistant should not be able to both read sensitive data and send it anywhere it likes.

Prompt Injection and Compliance

For organisations in the EU and Sweden, resilience against prompt injection is moving from good practice to legal duty. Four regimes are relevant.

The EU AI Act: Article 15 requires high-risk AI systems to be accurate, robust and secure including resilience against outsiders trying to alter their outputs by exploiting weaknesses which is the category prompt injection falls into. It binds high-risk systems and general-purpose models used in a high-risk setting. The Act entered into force in 2024 and phases in with most high-risk duties applying from August 2026.

NIS2 and Cybersäkerhetslagen: If an essential or important entity runs an AI system, prompt-injection risk falls under the Article 21 duty to manage security risks. A resulting incident triggers reporting to MCF (formerly MSB) within 24 hours, 72 hours and one month. Sweden’s law (SFS 2025:1506) has applied since 15 January 2026 and boards are personally accountable under Article 20. See our NIS2 compliance guide.

GDPR: If an injection leaks personal data, as a Copilot-style attack could, it is a personal-data breach and Article 33 sets a 72-hour notification to IMY, the Swedish data protection authority. See our GDPR compliance guide.

DORA: For banks, insurers and other financial entities, an AI assistant counts as ICT so an injection-driven incident falls under the ICT incident-management rules in Article 17 supervised by Finansinspektionen. See our DORA compliance guide.

Underneath all four sits the same expectation, an information security management system that treats AI as part of the estate, in the spirit of ISO 27001. Probing an AI system for these weaknesses is a natural fit for penetration testing and for AI detection and response.

How to Spot a Prompt Injection Attack

You cannot reliably catch prompt injection by reading the input. Direct attacks use ordinary language and indirect ones hide in content you never see. Some signals are still worth knowing.

  • An AI assistant does something outside its brief such as changing topic, ignoring a limit or offering to take an action it was not asked for.
  • Output that quotes or describes its own rules or system prompt, a sign someone has been probing it.
  • Content that seems to address the AI rather than you, an email or document carrying instructions for the assistant.
  • In an agent, an action proposed with no clear reason such as sending data out or contacting an address you do not recognise.

Treat these as reasons to check rather than proof of an attack. Because detection alone is unreliable, the real protection is in how the system is built and governed.

How to Defend Against Prompt Injection

You cannot patch prompt injection out of a model so defence works in layers. NIST and OWASP recommend the same shape, reduce what an attack can reach and add checks around the model.

How to Defend Against Prompt Injection
  • Give the model and any tools it uses the least access they need so a hijacked assistant can reach little.
  • Keep untrusted content separate and clearly marked so retrieved text is treated as reference material, never as commands.
  • Filter and constrain the model’s output, then block any channel it could use to send data to unknown destinations.
  • Require a human to approve sensitive or high-value actions such as payments, data exports or record changes.
  • Test AI systems against injection before launch and after every change, the way you would penetration test any application.
  • Train the people who use AI so they treat its output and its suggested actions with the same care as any other request.

People, process and technology all carry part of the load. The single habit that helps most is simple, never let an AI system act on a sensitive request without a human check on a separate channel.

Myths & Facts

Myth

A prompt injection attack needs coding skills or a special exploit.

A good input filter or better guardrails will stop prompt injection.

Only public-facing chatbots are at risk.

If I never paste anything malicious, my AI is safe.

It is just a chatbot saying something embarrassing.

This is an IT problem to patch.

Fact

Most need only plain language. The Chevrolet and DPD chatbots were pushed off script with ordinary typed sentences, because the attack targets how the model reads instructions rather than any software bug.

Filters reduce the risk but cannot close it. NIST and OWASP both say no current method fully prevents it, and the EchoLeak email slipped past Microsoft's own prompt-injection filter.

The bigger exposure is internal assistants with access to company data and tools. An indirect injection hidden in an email or file can reach them, as the Microsoft 365 Copilot flaw showed.

With indirect injection you do not have to. The instruction rides inside content the AI reads for you, a web page, a PDF or a calendar invite, so you never see or type it.

In an AI agent the same trick can trigger actions, sending data out, changing records or moving money. The impact then becomes operational rather than merely reputational.

You cannot patch the model's design. Defence is layered controls plus human sign-off on sensitive actions, which finance, support and development teams have to own alongside IT.

Test Yourself

Four real-world scenarios, then six knowledge questions. See how prepared you would be under pressure.

Scenario Simulation

  1. Your team wants to launch a website chatbot on a large language model to answer customer questions and quote prices.

    What is the safest way to set it up?

    • Give it access to the pricing system so it can close deals
    • Let it answer freely with no restrictions
    • Scope it to information only and route any price or commitment to a person
    • Trust the vendor's guardrails and skip testing
  2. An employee asks the company AI assistant to summarise an incoming email. Hidden in that email is text telling the assistant to forward recent files to an outside address.

    What best prevents harm?

    • The assistant is internal, so it can be trusted
    • Rely on the employee to spot the hidden text
    • Limit the assistant's access and block it from sending data to unknown destinations
    • Turn off email summaries across the company
  3. You are piloting an AI agent that can send emails and update records for staff. A document it retrieves contains an instruction to change a supplier's bank details.

    Which control matters most?

    • Let the agent act automatically to save time
    • Require human approval before the agent changes payments or records
    • Trust it because the document came from an internal system
    • Disable logging to reduce noise
  4. A developer plans to store an API key and the assistant's rules in the system prompt, assuming users cannot see it.

    What do you advise?

    • It is hidden, so it is safe
    • Add a rule telling the model never to reveal it
    • Never put secrets in the system prompt and enforce access outside the model
    • Obfuscate the key so it is harder to read

Knowledge Test

  1. Where does OWASP rank prompt injection among LLM risks?

    • The top risk (LLM01)
    • A minor risk
    • It is not listed

    OWASP ranks prompt injection LLM01, the number one risk for LLM applications, in 2025.

  2. What makes prompt injection possible?

    • A software bug that can be patched
    • A model reads instructions and data in the same channel
    • Weak passwords

    The model cannot reliably separate trusted instructions from other text it is given.

  3. What is indirect prompt injection?

    • Typing 'ignore previous instructions' into a chatbot
    • Hiding instructions in content the model later reads, like an email or web page
    • Guessing the system prompt

    Indirect injection hides the payload in content the model ingests, so the user never sees it.

  4. Can prompt injection be completely prevented today?

    • Yes, with the right filter
    • No, current methods reduce but cannot fully stop it
    • Only on paid models

    NIST and OWASP both state current defences cannot fully prevent it.

  5. Which is the strongest control for an AI agent that can take actions?

    • A longer system prompt
    • Human approval for sensitive actions and least-privilege access
    • Trusting internal data

    Human sign-off and least privilege limit what a hijacked agent can do.

  6. What did the EchoLeak flaw show prompt injection could do?

    • Only make a chatbot swear
    • Exfiltrate data from Microsoft 365 Copilot with no user action
    • Nothing, it was only theoretical

    A single crafted email could make Copilot leak internal data with no click, tracked as CVE-2025-32711.

Take It with You

Share the Summary PDF with Your Team

A short distilled brief in PDF: key findings, red flags and action steps.

Download summary PDF

Why Training Matters

The people most exposed to prompt injection are the staff who use AI assistants every day in finance, support, HR and development. They rarely know that an assistant’s output can be steered by text it read somewhere or that a confident answer can be an attacker’s words.

Training closes that gap. It teaches teams to treat an AI-suggested action on money, data or accounts as they would any other request, to verify on a separate channel and to report odd behaviour rather than trust it. eBuilder Security runs Sweden-based security awareness training that builds exactly this habit.

Frequently Asked Questions

What is a prompt injection attack?

A prompt injection attack is text crafted to make an AI system follow the attacker's instructions instead of its own rules. It can be typed directly into a chatbot or hidden inside content the AI reads, such as an email or a web page, and usually needs no code, only careful wording.

What is the difference between direct and indirect prompt injection?

Direct prompt injection is typed straight into the model through a chat box, form or API, for example an instruction to ignore its rules. Indirect prompt injection hides the instruction inside content the model later reads, such as a document, email or web page, so the user never sees it and it can reach internal assistants.

Is prompt injection the same as jailbreaking?

Prompt injection and jailbreaking overlap but are not the same. Jailbreaking is one goal of prompt injection, making a model ignore its safety limits. Prompt injection is the broader technique of smuggling instructions into a model, which can also leak data, exfiltrate files or trigger actions in an AI agent.

Can prompt injection be prevented completely?

No, prompt injection cannot be fully prevented today. Both NIST and OWASP state that current methods reduce the risk but cannot stop it entirely, because it exploits how language models read instructions and data together. The practical goal is layered defence, limiting what the AI can access, filtering its output and requiring human approval for sensitive actions.

Why is prompt injection the top LLM security risk?

OWASP ranks prompt injection as the number one risk for LLM applications because it is easy to attempt, hard to prevent and can lead to serious outcomes. A plain-language message can bypass a model's rules, leak its data or, in an AI agent, trigger an unauthorised action, and no reliable fix removes the underlying weakness.

Does prompt injection affect tools like Microsoft Copilot and ChatGPT?

Yes. Any assistant built on a large language model can be targeted, and mainstream tools have been affected. A 2025 flaw in Microsoft 365 Copilot, tracked as CVE-2025-32711, let a crafted email pull internal data out with no user action, and Microsoft patched it. Bing Chat was manipulated in 2023 into revealing its hidden instructions.

How can a business defend against prompt injection?

Defend in layers, because no single control stops prompt injection. Give AI systems and their tools least-privilege access so a hijacked assistant can reach little. Keep untrusted content separate, filter outputs and block channels that could send data to unknown places. Above all, require a human to approve sensitive actions such as payments or data exports.

Is prompt injection a compliance issue in the EU and Sweden?

Yes. The EU AI Act (Article 15) requires high-risk AI systems to resist attempts to manipulate their outputs, the category prompt injection falls into. Under NIS2, transposed in Sweden as Cybersäkerhetslagen, a resulting breach can trigger reporting to MCF within 24 and 72 hours, and GDPR adds a 72-hour notice if personal data leaks.

You Understand the Risk.
Now See Where You Stand.

Book a 30-minute briefing with one of our analysts, or run the free breach check first to find out what attackers already know about your organisation.

Book a 30-Min Briefing
No sales pitch, just a straight assessment

How eBuilder Security Can Help

Awareness is the first layer. These are the services that turn it into measurable protection.