Cognitive

Part 6 · LLM Application Security

LLM08: Hidden Context Exposure

Anything placed in a model's hidden context may be discovered, so it must never be what keeps a system secure.

3 min readBuilds on LLM01: Prompt Injection

OWASP LLM08. This material is for defense. Only test systems you own or are authorized to test.

Anything the model can read may eventually be exposed.

What it is

Hidden context exposure is the unauthorized extraction, inference, or reconstruction of system instructions and operational context. In 2026, this entry replaced and broadened System Prompt Leakage.

Hidden context includes the system prompt, developer instructions, retrieved policy text, and tool schemas. Exposure matters most when that context contains secrets or reveals rules an attacker can exploit.

How the attack unfolds

The leak is rarely the final harm. The danger is what the leaked context enables next.

Figure 37.1. The leak is rarely the final harm. The danger is what the leaked context enables next.

What can be exposed

  • Secrets: credentials or internal URLs placed in a prompt.
  • Decision rules: refund limits, escalation criteria, or filtering logic.
  • Tool schemas: names and parameters that map the attack surface.
  • Retrieved policy: internal guidance added to the context at runtime.

Real-world case

In February 2023, a student used prompt injection to make Bing Chat reveal its internal instructions and the codename "Sydney".

Defenses

Security should still hold if the prompt becomes public.
  1. Keep secrets out of context. Assume anything the model can read may be revealed.
  2. Enforce rules deterministically. Do not make the prompt the only control.
  3. Authorize independently. Apply access control outside the LLM.
  4. Design for publication. The system should remain safe if its prompt became public.
  5. Monitor extraction attempts. Treat repeated probing as a signal.

Common misconception

Common belief

"Telling the model to keep its prompt secret protects it."

In practice

That instruction can be bypassed. Security must not depend on the prompt staying hidden.

Key takeaways

  • Hidden context may be extracted or inferred.
  • Never place secrets in a prompt.
  • Critical rules must be enforced outside the model.