Direct prompt injection
An instruction typed into the chat can sometimes make an AI assistant break its rules: mechanism, on-screen signs, dated cases, prevention.
In 30 seconds
- Where it happens
- In the discussion window of an AI assistant, for example a customer support chatbot1.
- What the attacker wants
- To make the model ignore its instructions, to make it reveal its internal instructions, or to make it produce content the company wanted to forbid1.
- The reflex
- Treat an AI assistant as a conversation partner that a clever instruction can divert, give it only the strictly necessary access, and have a person validate any sensitive action.
- If it has already happened
- Report the conversation to the team that runs the assistant, with a capture of the exchange.
What it is
A corporate AI assistant runs on rules written by the vendor or by the company. Direct prompt injection consists of typing, into the discussion box, a text that changes the model's behavior in a way that was not intended1.
The person typing is not always an attacker. OWASP specifies that the input can be intentional or not: a user can trigger unexpected behavior without meaning to1.
Straight answers
What is a direct prompt injection?
It is the case where the text typed by the user directly changes the model's behavior in an unexpected way1. It contrasts with indirect injection, where the model reads external content (a website, a file) that contains the instructions1.
How does it relate to jailbreaking?
The two terms are often used interchangeably. According to OWASP, jailbreaking is a form of prompt injection in which the attacker pushes the model to ignore its safety protocols entirely1. Prompt injection is broader: it consists of manipulating the model's responses through specific inputs, which can include bypassing safety measures1.
Why does the model let itself be convinced?
Because it does not separate instructions from data. The British NCSC writes that current large models enforce no security boundary between the two inside a prompt2. The developer pastes their own instructions and the user's text into a single prompt, then treats the response as if a solid boundary existed between the two2.
Can the problem be fixed once and for all?
Probably not. The NCSC considers that these attacks may never be totally neutralized, unlike SQL injection2. OWASP says for its part that it is unknown whether foolproof prevention methods exist1. The realistic goal is to reduce the likelihood and the impact2.
1Inside the attacker's head1 min
Researchers Fábio Perez and Ian Ribeiro showed in 2022 that people with little skill but bad intentions can hijack GPT-3 with simple handwritten texts3. They describe two objectives: hijacking the model's goal (goal hijacking) and making it disclose its prompt (prompt leaking)3.
A second type of objective is misuse. A team of researchers described in 2023 results such as unlimited and arbitrary use of the model behind an application, and easy theft of the application's prompt4.
Jailbreaking works differently. The authors of the "Jailbroken" study put forward two causes of safety training failure: competing objectives (the model's capabilities conflict with its safety rules) and mismatched generalization (safety does not cover an area where the model nonetheless has capabilities)5.
OWASP also cites variants. The attacker can add to their message a string of characters that looks meaningless, or use several languages or an encoding such as Base64 to evade filters1.
2What you see on screen1 min
On the user's or the company's side, a successful attack is spotted through its effects. OWASP lists the possible consequences: disclosure of sensitive information, revelation of information about the infrastructure or the system prompts, distorted or biased content, unauthorized access to the model's functions, execution of commands in connected systems1.
In practice, an assistant that answers off topic, that recites its own instructions, or that produces content the company would never have approved should raise an alarm. OWASP gives a typical scenario: an attacker asks a support chatbot to ignore its instructions, to query private data, and to send emails1.
Here is an illustration of this type of message, neutralized and paraphrased:
Illustration (paraphrased message, non-functional):
[instruction asking the chatbot to ignore the rules received from the vendor,
then to copy out its internal instructions in full]3Under the hoodIT teams2 min
For a language model, there are neither "data" nor "instructions", only the next token: the model predicts the most probable token from the text received so far2. The vendor's instructions and the sentence typed by the user therefore end up in the same text, with no separation that the model respects2.
This point distinguishes prompt injection from SQL injection. In SQL, parameterized queries guarantee that the engine never interprets an input as an instruction2. The NCSC writes that prompt injection attacks might never be totally mitigated the way SQL injections are2. The approaches under way (detecting attempts, training the model to prioritize instructions, telling the model what is data) layer onto the model a distinction that the technology does not make2.
NIST published a taxonomy of adversarial machine learning in March 20256.
One point of caution concerns banned-word filters. The NCSC warns against blocking known phrases such as "ignore previous instructions": there is an infinite number of rewordings that get around this filter2.
Prevention
The simple measures retained here come from OWASP and the NCSC.
- Least privilege: give the model the minimum access needed, and handle extended functions in the application's code rather than entrusting them to the model1.
- Human validation: require a person's approval for privileged operations1.
- Output filtering: define sensitive categories, detect unauthorized content with semantic filters and string checks, and validate the format of responses with deterministic code1.
- Role framing: describe the model's role and limits in the system prompt1. This measure helps but is not enough: OWASP presents all these measures as ways to mitigate the impact1.
- Testing: run regular penetration tests and simulations, treating the model as an untrusted user1.
- Monitoring: log enough information to spot suspicious activity, including failed tool and API calls, which can betray the first steps of an attack2.
The NCSC adds that a system's security must rest on deterministic safeguards that limit its actions, rather than on the sole hope of preventing malicious content from reaching the model2. If the residual risk is intolerable, the use case may not suit a language model2.
4Case filesReal cases1 min
November 2022: GPT-3 hijacked by simple texts
On November 17, 2022, Fábio Perez and Ian Ribeiro published PromptInject, a framework for analyzing these attacks. They study GPT-3, which they describe as the most widely deployed language model in production, and show that it can be easily misaligned by handwritten inputs3. The two attacks studied are goal hijacking and prompt leaking3.
June 2023: 31 applications out of 36 vulnerable
On June 8, 2023, a team of twelve researchers published a study on real applications that use a language model. After analyzing ten commercial applications, it developed an attack technique named HouYi and applied it to 36 applications: 31 turned out to be susceptible to prompt injection4. Ten vendors validated the results, including Notion4.
July 2023: protections that give way
On July 5, 2023, Alexander Wei, Nika Haghtalab and Jacob Steinhardt evaluated OpenAI's GPT-4 and Anthropic's Claude v1.3. Their new attacks succeeded on every request in a collection of dangerous requests drawn from the models' red teaming evaluation sets5. The authors conclude that vulnerabilities persist despite red teaming and safety training efforts5.
Fact sheet
- Identifier
- CP-281
- Wing
- 4. Artificial intelligence
- Brain skill
- Effective Prompt Engineering (ACTIF) (prompt_correctly)
- Brain reflex
- air-012
- Diagram
- G1 · Attack vs Defense Chain
- Languages
- de, en, fr
- Sources
- 6 sources checked on 3 November 2026
Sources6 sources
- OWASP, “LLM01:2025 Prompt Injection”. https://genai.owasp.org/llmrisk/llm01-prompt-injection/ (accessed 3 November 2026)
- NCSC (UK), “Prompt injection is not SQL injection (it may be worse)”, 8 December 2025. https://www.ncsc.gov.uk/blog-post/prompt-injection-is-not-sql-injection (accessed 3 November 2026)
- arXiv, “Ignore Previous Prompt: Attack Techniques For Language Models”, 17 November 2022. https://arxiv.org/abs/2211.09527 (accessed 3 November 2026)
- arXiv, “Prompt Injection attack against LLM-integrated Applications”, 8 June 2023. https://arxiv.org/abs/2306.05499 (accessed 3 November 2026)
- arXiv, “Jailbroken: How Does LLM Safety Training Fail?”, 5 July 2023. https://arxiv.org/abs/2307.02483 (accessed 3 November 2026)
- NIST, “AI 100-2 E2025, Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations | CSRC”. https://csrc.nist.gov/pubs/ai/100/2/e2025/final (accessed 3 November 2026)
Cite this article
Brain, “Direct prompt injection”, Cyberpedia, 2026. https:/
BibTeX
@misc{brain_cp281_en_2026,
author = {Brain},
title = {Direct prompt injection},
year = {2026},
howpublished = {Cyberpedia},
url = {https://startbrain.io/cyberpedia/en/articles/direct-prompt-injection-jailbreak/},
note = {CC BY 4.0}
}