Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

WeaknessASC-2026-0012Major weakness

System prompt and secret leakage

MediumWorkarounds only

Models reveal their instructions or secrets embedded in prompts when asked or tricked, exposing business logic and credentials.

How to detect it

  • Hijack tests get the model to repeat its system prompt or a planted canary
  • Secrets (API keys, tokens, private keys) appear in prompts or outputs

Workarounds

  • Never put secrets in prompts; fetch them server-side at tool execution time
  • Assume the system prompt is public and keep sensitive logic in code
  • Filter outputs for canary strings and secret patterns

Models can always be coaxed into repeating context; design as if they will.

How to investigate

  1. Search logs for canary strings and secret patterns in model outputs
  2. Rotate any secret that was ever present in a prompt

Sources

Open it in the Learning Center's vulnerability database