Skip to content
StrikeCyberStrikeCyber
Field Manual · Attack technique

System Prompt Leakage

Reviewed November 13, 2026Attack technique 2 min read

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
01

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 summarize 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.

02

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.

03

How to Test for It

  1. 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.
  2. Review the actual system prompt for credentials, internal hostnames, personal data and business rules that would harm the organization if published.
  3. List every rule the prompt enforces and check whether the same rule is enforced in code; try to break the ones that are not.
  4. Plant a unique canary string in the prompt and check whether monitoring detects it in outputs.
  5. Test whether tool and agent descriptions leak the same information as the prompt.
04

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 authorization 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.

05

Regulatory and Framework Context

In the US, the NIST AI RMF and its Generative AI Profile (NIST AI 600-1) call for testing generative AI systems against adversarial use, and CISA's AI guidance stresses that security controls must not depend on the model following instructions.

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

  1. November 13, 2026First published.
(877) 657-8496