System prompt extraction

System prompt extraction, also called prompt leaking, is getting a chatbot or AI app to reveal the hidden instructions its developer gave it, usually by asking cleverly worded questions.

Every chatbot and AI product runs with a system prompt: instructions from the developer, placed before the user's messages, that set the assistant's name, tone, rules and tools. Users normally cannot see it. System prompt extraction is persuading the model to repeat it anyway. Requests can be as simple as asking the model to print everything above the conversation, or as elaborate as role-play, translation tricks or asking for the text in pieces.

The attack was named early. In November 2022 Fábio Perez and Ian Ribeiro published Ignore Previous Prompt, which studied two attacks on GPT-3: goal hijacking and prompt leaking. The best-known real case came in February 2023, when Kevin Liu used a prompt injection to get Microsoft's new Bing chatbot to reveal its instructions, including its internal codename, Sydney, and a rule not to disclose that name. Microsoft confirmed the text was genuine.

The extraction works because a language model has no secure compartment for its instructions. The system prompt is just text in the same context as everything else, and a rule saying "do not reveal this" is only another instruction the model may be talked out of.

How much a leak matters depends on what the prompt contains. The OWASP Top 10 for LLM Applications lists system prompt leakage as risk LLM07 in its 2025 edition and argues that the prompt should not be treated as a secret or used as a security control. The real damage comes when developers put credentials, internal business rules or permission logic in the prompt, since a leak then exposes them, or tells attackers which filters to work around. For a well-built app, a leaked prompt is embarrassing, or a gift to competitors, rather than a breach.

The practical advice follows: keep keys and sensitive data out of prompts, enforce access rules in ordinary code outside the model, and assume that anyone determined enough will read the instructions.

Common questions

What is prompt leaking?

Prompt leaking is getting an AI system to disclose its hidden system prompt, the developer's instructions that shape its behaviour. The term was used in a 2022 paper by Fábio Perez and Ian Ribeiro on attacks against GPT-3.

Can you stop a chatbot from revealing its system prompt?

Not reliably. Developers can train or instruct a model to refuse, and add filters that check outputs, but determined users often find a way around them. Security guidance therefore says to assume the prompt will become public and not to put anything secret in it.

Is extracting a system prompt illegal?

Asking a public chatbot questions is not in itself a crime, but a service's terms of use may forbid attempts to extract its instructions, and using extracted secrets such as credentials to access systems could break computer misuse laws. The legal position depends on the jurisdiction and what is done with the material.

What is the difference between prompt injection and prompt leaking?

Prompt injection is the broader category of inputs that override a model's intended instructions. Prompt leaking is one goal of such an attack: making the model reveal its instructions rather than, say, take a harmful action.

Finding more

Search for "system prompt leakage", "prompt leaking" or "OWASP LLM07". The OWASP GenAI Security Project's guidance and AI developers' own documentation on prompt design are the best starting points for defences. Collections of leaked prompts circulate online, but they are unofficial and may be out of date or altered, so treat them as claims until a developer confirms them.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.