System prompt leakage: why instruction secrecy is not a security control
Understand why hidden AI instructions are not a security boundary and why sensitive information and permissions need separate controls.
Many AI features start with a system prompt: hidden instructions that tell the model its role and rules. OWASP lists System Prompt Leakage as LLM07 in its Top 10 for LLM Applications (2025). We read the project's page in full on 15 November 2026 and not its references. This article summarises that one page.
The main point
OWASP says the system prompt should not be considered a secret, and should not be used as a security control. So credentials and connection strings do not belong in it. It also says the leak of the wording is not the real risk. The real risk is what the prompt reveals about the design: secrets stored in the wrong place, roles and permissions delegated to the model instead of enforced by the application, or guardrails that can be bypassed. Even without the exact text, the page says attackers using the app will almost certainly work out many of its guardrails and formatting rules by testing it.
Examples from the page
- Sensitive functionality: a prompt naming the database type could help an attacker aim at it with SQL injection; API keys or tokens in the prompt can be extracted and used.
- Internal rules: the page's banking example has a prompt stating a daily transaction limit and a total loan amount, which could help an attacker probe for weaknesses. Learning a limit should not let anyone bypass it if the application enforces it correctly.
- Filtering criteria: a prompt that says how requests about other users are refused.
- Roles and permissions: a prompt describing what an admin role can do.
OWASP's mitigations
- Keep sensitive data out of system prompts, and keep it in systems the model cannot reach directly.
- Do not rely on system prompts to control behaviour strictly, since prompt injection can alter them. Use systems outside the model.
- Put guardrails outside the model: an independent check of the output is preferable to a rule in the prompt, because training a model not to reveal its prompt is not a guarantee.
- Enforce privilege separation and authorisation checks independently of the model, deterministically and auditably. Where an agent needs different access levels for different tasks, the page suggests several agents, each with the least privilege its task needs.
Scenarios from the page
- Credentials sit in a system prompt, the prompt leaks, and the attacker reuses the credentials.
- A prompt forbids offensive content, links and code execution. An attacker extracts it, then uses prompt injection to get around those rules and reach remote code execution.
A quick review
- Read your system prompt as if a customer will see it. Is anything in it a secret, a limit or a permission?
- Where is each rule really enforced: in code, or only in the prompt?
- Do credentials for tools live in a secrets store? See our secrets management article.
Related: prompt injection explained, AI agent integration risks.
Limits
One OWASP page, read in full. References and the taxonomy links were not read. We make no claim about specific products or incidents, and give no statistics.
By Omnistu.