System Prompt Extraction and Bypass
System prompt extraction and bypass is a core LLM attack. First, the system prompt holds the operator's hidden rules. So it makes a rich target. It often leaks real secrets too.
A system prompt can hold:
Private rules and business logic.
Internal URLs and API keys.
Persona rules and topic limits.
So extraction maps the full attack surface. Also, a bypass strips the guardrails. Then you reach the raw model. In short, both goals share the same tricks.
System Prompt Extraction and Bypass Techniques
First, always try direct disclosure. Many apps never block it. So just ask for the prompt. Here are three simple asks:
Encoding and Format Tricks
Next, when direct asks fail, change the format. For example, ask for the prompt in base64. The model obeys the transform. So it leaks the text anyway. Also, a table or code format works well.
Completion Attacks
Then frame it as a completion task. So the model fills in its own prompt. In short, you give the first words. Next, it just continues them.
Context Window Probing
However, full extraction often fails. So probe for single facts instead. For example, ask only about URLs or keys. These narrow asks slip past filters. Also, they still leak useful data.
Rebuild from Behavior
Finally, when every ask fails, infer the rules. So test one limit at a time. Then map each response. This path is slower. However, it still rebuilds the prompt.
Topics that always refuse reveal hidden limits. So document each one. Together, they form the extracted prompt profile.
Next, chain this with related attacks. First, read Prompt Injection against LLM Applications. Then try Jailbreaking and Safety Filter Bypass. Also, see Extracting System Prompts for post-exploitation.
Related
References
-
Azure/PyRIT on GitHubgithub.com/Azure/PyRIT (opens in new tab)
Python Risk Identification Toolkit with system prompt extraction attack orchestration
-
OWASP Top 10 for LLM Applicationsowasp.org/www-project-top-10-for-large-language-model-applications (opens in new tab)
LLM07: System Prompt Leakage attack techniques reference
Was this helpful?
Your feedback helps improve this page.