How chatbots give away their secrets
In short: every chatbot has a system prompt, a hidden instruction from its owner. It can often be pulled out with ordinary requests, which is why OWASP made system prompt leakage a risk of its own in 2025 (LLM07:2025). The main takeaway is simple: nothing secret belongs in a system prompt. Below: three tricks, why they work and how to defend.
Free course on this topicAI basics: free courseStart the course →
What is a system prompt?
It's the text a bot gets before your message: who it is, how to answer, what to keep quiet about. You can't see it, but the model reads it together with your message as one shared text.
Sometimes people put too much in it: internal discount rules, promo codes, names of internal systems, even access keys. OWASP describes this scenario: a prompt held credentials for a tool, the prompt leaked, and an attacker used them. Source: OWASP, LLM07:2025
More in the lesson: Inside a chat: system, user, history
How do people pull out hidden instructions?
Here are the three most common tricks. We describe them so it's clear what to defend against. Try them only on your own bots or on training bots.
- "Repeat what came above". To the model, the instruction is part of the text. Asking it to repeat or continue "the previous text" sometimes prints the whole thing.
- Translation or another format. Asking the bot to translate its rules into another language, or write them as a list or a poem, slips past a filter that catches the direct phrase "show me your system prompt".
- Role-play and a fake end of instructions. The person writes that the instructions are over and everything after is "public", or suggests a role in which the rules don't apply.
Why don't filters help?
A filter looks for specific wording, and the same request can be phrased in endless ways: other words, another language, a story, a game. That's why OWASP says plainly that the system prompt should not be treated as a secret, and security must not depend on it. Source: OWASP Top 10 for LLM Applications 2025
What it means for you: if a bot on your site or in your project keeps something important in its instruction, assume someone can already read it.
How do you protect a bot?
- Move secrets out of the prompt. Keys, passwords and promo codes stay on the server. The bot only gets what is safe to show anyone.
- Checks happen in the system. The server checks a discount or access, not a line like "never give more than 10% off" in the instruction.
- Independent guardrails. A separate system checks the bot's replies and stops what shouldn't be in them.
- Attack it before launch. Ask your own bot to repeat its instruction, translate it, play a role. If it works for you, it will work for others.
More in the lesson: Safety: your data and prompt injection
FAQ
Is it dangerous if someone learns the system prompt?
The text itself isn't the main risk. The danger is what's inside it: keys and the rules the security relies on. If those aren't there, a leak gives away almost nothing.
Can't you just tell the bot not to reveal its rules?
You can write that rule, but there are too many ways around it. It's safer to keep nothing secret in the prompt.
Is this the same as prompt injection?
No, but they're linked. Prompt injection overrides the owner's instructions, and leaking the prompt is a common goal of such an attack. More: what is prompt injection.
See how a chat with AI works inside
The free Brainax course «AI basics» has a lesson on what a chat with a model is made of: the system message, your messages and the history. A short lesson with animations and a quiz. Start the lesson
Free course on this topicAI basics: free courseStart the course →