Quick answer
System prompt leakage is when an attacker gets an AI application to reveal its hidden instructions, the system prompt written by its developers. The real risk is not the wording itself but what prompts often contain: credentials, internal rules, user roles and filtering logic that should never rely on secrecy. It is ranked seventh in the OWASP Top 10 for LLM Applications (2025).
On this page
How It Works
The system prompt sits in the model's context alongside the user's messages, so the model can be persuaded to repeat it. Common extraction techniques include asking it to repeat everything above, to translate or summarise its instructions, to output them in a code block or another encoding, to continue a sentence that begins the prompt, or to reveal them a piece at a time across many turns. Role-play and debugging pretexts, such as claiming to be the developer, also work against many applications. Once extracted, the prompt shows an attacker exactly which rules to target.
Why It Matters
OWASP's point is that leakage becomes serious when the prompt is doing a job it should not. Teams embed API keys, database names and connection details, describe internal approval limits, or rely on instructions such as "only show admin features to administrators" as an access control. If any of those leak, the attacker learns secrets or how to bypass the controls. Even a clean prompt can expose competitive detail and make jailbreaking easier by revealing the guardrails.
How to Test for It
- Run a library of extraction techniques against the application, including multi-turn, encoding, translation and role-play variants, and repeat them because results vary between attempts.
- Review the actual system prompt for credentials, internal hostnames, personal data and business rules that would harm the organisation if published.
- List every rule the prompt enforces and check whether the same rule is enforced in code; try to break the ones that are not.
- Plant a unique canary string in the prompt and check whether monitoring detects it in outputs.
- Test whether tool and agent descriptions leak the same information as the prompt.
How to Reduce the Risk
Assume the system prompt will become public and write it accordingly. Move credentials into server-side configuration that the model never sees, enforce authorisation and business rules in application code rather than in instructions, and keep independent guardrails outside the model. Use canary strings and output monitoring to detect extraction, and review prompts with the same care as source code before release.
Regulatory and Framework Context
In Australia, keeping secrets out of system prompts aligns with ASD's guidance on engaging with artificial intelligence and the Information Security Manual's controls on protecting credentials. Prompt extraction testing supports ISO/IEC 42001 and the testing guardrail of the Voluntary AI Safety Standard.
Common questions
Is a leaked system prompt a vulnerability by itself?
Sometimes it is only a nuisance. It becomes a real finding when the prompt contains secrets or when it is the only thing enforcing a security rule.
Can you stop a model revealing its prompt?
You can make it harder with instructions and output filters, but not reliably. Design as if the prompt is public.
Is system prompt leakage a type of prompt injection?
It is usually achieved through prompt injection, but OWASP lists it separately because the fix is different: remove sensitive content from the prompt.
Change log
- 13 November 2026First published.