Secrets and access rules hidden in your AI system prompt (system prompt leakage)

Last updated November 16, 2026
Steps
- Find every system prompt in your app (code, environment variables, your AI provider’s dashboard, agent or assistant settings) and read each one as if a stranger will see it.
- Remove credentials and connection details: API keys, tokens, passwords, database names and internal URLs. Keep them in server-side environment variables used by your code, never in text the model sees.
- Rotate any key or password that has ever been in a prompt, since you can’t know who already got the model to print it.
- Remove security rules from the prompt as the only line of defense: “only show the user their own orders,” “admins can edit records,” spending or transaction limits. Enforce these in your server code or database (for example row-level security) before data ever reaches the model.
- Keep business-sensitive details (unreleased prices, internal discount codes, staff-only notes) out of the prompt unless you’re fine with every user reading them.
- If certain content must never appear in answers, check the model’s output with separate code before showing it, rather than relying on “don’t reveal this” in the prompt.
- Retest: ask your own app to repeat, summarize or translate its instructions, and confirm nothing in the reply would hurt you if posted publicly.
Why it matters
OWASP’s examples include a system prompt containing credentials for a tool, which an attacker extracts and reuses, and a prompt listing rules like daily transaction limits that tells an attacker exactly what to try to bypass. OWASP’s guidance is that disclosure of the prompt isn’t the core problem; storing secrets there and handing authorization to the model are. Its fixes: keep sensitive data out of system prompts, enforce guardrails outside the model, and keep privilege separation and authorization checks in deterministic code. This page is for checking and fixing your own app.
Sources
OWASP Gen AI Security Project: LLM07:2025 System Prompt Leakage — https://genai.owasp.org/llmrisk/llm072025-system-prompt-leakage/
OWASP Cheat Sheet Series: LLM Prompt Injection Prevention (system prompt leakage as an impact; least privilege) — https://cheatsheetseries.owasp.org/cheatsheets/LLM_Prompt_Injection_Prevention_Cheat_Sheet.html
Checked at the source on November 14, 2026.
Related patterns
- Prompt injection in your app's AI chatbot or AI features
- AI features that can take actions you never meant to allow (excessive agency)
- Third-party secret keys (OpenAI, Stripe, Resend) in client JS
- Hard-coded credentials left in vibe-coded apps
- RLS or auth present, but no ownership check (IDOR)
- AI document search that shows one customer’s files to another (RAG and vector store leaks)
- MCP servers in vibe-coded apps: no auth, token passthrough and tools you never vetted
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.