{"id":5473,"date":"2026-08-28T14:34:51","date_gmt":"2026-08-28T14:34:51","guid":{"rendered":"https:\/\/www.hackmosphere.fr\/system-prompt-leakage-risks-and-security-of-ai-chatbots\/"},"modified":"2026-09-03T12:35:48","modified_gmt":"2026-09-03T12:35:48","slug":"system-prompt-leakage","status":"publish","type":"post","link":"https:\/\/www.hackmosphere.fr\/en\/system-prompt-leakage\/","title":{"rendered":"System Prompt Leakage: Risks and Security of AI Chatbots"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_row _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.27.8&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; sticky_enabled=&#8221;0&#8243;]<!-- divi:paragraph -->A developer might be tempted to temporarily embed an API key in the system prompt of a customer service chatbot, with the intention of removing it later. If the model then discloses its instructions in response to a user request, that key may be exposed. This scenario illustrates the risk described by OWASP in the category <a href=\"https:\/\/genai.owasp.org\/llmrisk\/llm072025-system-prompt-leakage\/\"><u><strong>LLM07:2025 \u2013 System Prompt Leakage<\/strong><\/u><\/a> : a system prompt should never be treated as a secret or used as a security mechanism. API keys, credentials, and connection strings must be kept outside the prompt and protected by access controls independent of the model   <\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:heading --><\/p>\n<h2 class=\"wp-block-heading\">Prompt Leak, Prompt Injection, and Jailbreak: What Are the Differences?<\/h2>\n<p><!-- \/divi:heading --><\/p>\n<p><!-- divi:paragraph --><em>System prompt leakage<\/em> is technically related to prompt injection and jailbreaking\u2014which were already discussed in previous articles\u2014but serves a different purpose. Whereas prompt injection hijacks a system\u2019s behavior and jailbreaking bypasses its content safeguards, system prompt leakage specifically aims to make the system reveal the instructions that define its own operation: business logic, authorization rules, integration details, and safeguard configurations. Once these instructions are extracted, an attacker has an exact blueprint of how the system works, which then allows them to craft much more targeted attacks to bypass the defenses they have just uncovered.  <\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:heading --><\/p>\n<h2 class=\"wp-block-heading\">Prompt Extraction Techniques: How Attackers Trick Large Language Models<\/h2>\n<p><!-- \/divi:heading --><\/p>\n<p><!-- divi:paragraph -->Extraction methods range from the most trivial direct query\u2014such as asking the model to repeat previous sentences or instructions\u2014to obfuscation techniques designed to bypass text filters, such as Base64 or hexadecimal encoding. <a href=\"https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/LLM_Prompt_Injection_Prevention_Cheat_Sheet.html\"><u>OWASP classifies encoding as one of the obfuscation techniques<\/u><\/a> used in prompt injection attacks and recommends not limiting defenses to a simple keyword search.<\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:paragraph -->Academic research has also shown that it is possible to automate the generation of extraction queries. The <a href=\"https:\/\/arxiv.org\/pdf\/2405.06823\"><u>PLeak framework<\/u><\/a> gradually optimizes an adversarial query to reconstruct the system\u2019s prompt, while targeting an application accessible only through its query-response interface. The attacker therefore does not need direct access to the target system\u2019s internal parameters. This approach was evaluated on real-world LLM applications hosted on Poe.   <\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:paragraph -->In January 2026, the <a href=\"https:\/\/www.praetorian.com\/blog\/exploiting-llm-write-primitives-system-prompt-extraction-when-chat-output-is-locked-down\/\"><u>researchers at Praetorian<\/u><\/a> demonstrated that an LLM assistant could disclose its system prompt through editable fields in the interface, even though its chat responses were limited to predefined messages. In their scenario, the model entered fragments of the prompt into form fields and encoded them in Base64 to make them usable and bypass any filters. This example shows that a restriction limited solely to the text displayed in the chat is not enough: every field, action, log, or output controlled by the model can become a channel for data exfiltration.  <\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:heading --><\/p>\n<h2 class=\"wp-block-heading\">Examples and Real-World Cases of System Prompt Leaks (Bing Chat, ChatGPT)<\/h2>\n<p><!-- \/divi:heading --><\/p>\n<p><!-- divi:paragraph -->One of the first widely publicized cases was the leak of Bing Chat\u2019s system prompt in February 2023. This Microsoft conversational assistant, integrated into the Bing search engine and based on an OpenAI language model, quickly became the target of attempts to uncover its internal instructions. Through simple injection queries, users obtained initial instructions revealing, among other things, the internal codename \u201cSydney,\u201d behavioral constraints, and operational rules. <\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:paragraph -->The episode demonstrated that a prompt hidden within the model&#8217;s context does not, on its own, constitute a reliable privacy boundary.<\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:paragraph -->Since 2025, several public repositories have archived system prompts assigned to major chatbots such as ChatGPT, Claude, Gemini, Grok, and Perplexity. These collections document the existence of extraction techniques and provide access to numerous examples obtained through injection or reverse engineering. <\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:paragraph --><a href=\"https:\/\/genai.owasp.org\/llmrisk\/llm072025-system-prompt-leakage\/\"><u>OWASP illustrates the risk using the example of a banking application<\/u><\/a> whose system prompt reveals a specific operational rule: a transaction limit set at $5,000 per day per user, as well as an overall loan limit. Disclosing this information could help an attacker bypass the associated controls, for example, by tailoring their transactions or credit requests to the known thresholds. This is a direct example of how a simple instruction leak can lead to exploitable financial fraud, without any technical vulnerabilities being required elsewhere in the system.  <\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:heading --><\/p>\n<h2 class=\"wp-block-heading\">Best practices for system prompt security.<\/h2>\n<p><!-- \/divi:heading --><\/p>\n<p><!-- divi:list --><\/p>\n<ul class=\"wp-block-list\"><!-- divi:list-item --><\/p>\n<li><strong>Design with the assumption that the prompt will be disclosed.<\/strong>  A system prompt can guide the model&#8217;s behavior, but it should not be considered either a secret or a security boundary. API keys, authentication tokens, and other sensitive information must be kept outside the prompt, in dedicated components. <\/li>\n<p><!-- \/divi:list-item --><\/p>\n<p><!-- divi:list-item --><\/p>\n<li><strong>Enforce the rules on the backend.<\/strong>  The model can interpret a request or propose an action, but authorizations, limits, privilege separations, and critical business controls must be verified and enforced in a deterministic manner by the surrounding system.<\/li>\n<p><!-- \/divi:list-item --><\/p>\n<p><!-- divi:list-item --><\/p>\n<li><strong>Test the extraction before going live.<\/strong>  Security campaigns must cover direct requests, multi-round attacks, obfuscation, structured outputs, interface fields, and tool calls. The results must be documented and periodically reevaluated. <\/li>\n<p><!-- \/divi:list-item --><\/p>\n<p><!-- divi:list-item --><\/p>\n<li><strong>Minimize the impact of a leak.<\/strong>  The system must be designed according to the principle of least privilege so that even if the prompt is fully disclosed, no further harmful actions are possible. Security must be based on controls that are independent of the model: server-side validation, authorization, quotas, logging, monitoring, and human intervention for sensitive operations. <\/li>\n<p><!-- \/divi:list-item --><\/ul>\n<p><!-- \/divi:list --><\/p>\n<p><!-- divi:paragraph -->\u2192 See our <a href=\"https:\/\/www.hackmosphere.fr\/en\/ai-architectures-risk-factors-which-component-which-risk\/\" data-type=\"post\" data-id=\"4746\">guide to AI architectures and risk vectors<\/a> to understand where this risk vector fits among the other risks targeting LLMs.<\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:heading --><\/p>\n<h2 class=\"wp-block-heading\">Frequently Asked Questions About the Prompt Leak<\/h2>\n<p><!-- \/divi:heading -->[\/et_pb_text][et_pb_accordion _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;][et_pb_accordion_item _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; title=&#8221;What scope should be analyzed for an AI system?&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]The analysis must cover the model, data, prompts, RAG components, APIs, connected tools, infrastructure, and user access. The scope must be tailored to the system\u2019s intended uses and criticality.[\/et_pb_accordion_item][et_pb_accordion_item _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; title=&#8221;What deliverables can you expect from an AI risk analysis?&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]The analysis should result in a map of the area, a prioritization of risks, priority threat scenarios, and an action plan specifying the measures to be implemented, the individuals responsible, and the deadlines.[\/et_pb_accordion_item][et_pb_accordion_item _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; title=&#8221;When should the risks of an AI system be reassessed?&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]A new assessment is recommended in the event of a change in model, data, or provider; when connecting to a new tool; or when transforming an assistant into an autonomous agent. It should also be considered following an incident or a significant change in usage patterns.[\/et_pb_accordion_item][\/et_pb_accordion][et_pb_text _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]<!-- divi:heading --><\/p>\n<h2 class=\"wp-block-heading\"><strong>Check how well your systems handle prompt extraction<\/strong><\/h2>\n<p><!-- \/divi:heading --><\/p>\n<p><!-- divi:paragraph -->Our offensive security experts test how well your models hold up against attacks involving data extraction, injection, and bypassing safeguards.<\/p>\n<p><!-- \/divi:paragraph --><\/p>\n<p><!-- divi:paragraph -->Would you like to discuss your project or assess your needs?  <a href=\"https:\/\/www.hackmosphere.fr\/en\/contact\/\">Contact our experts.<\/a><\/p>\n<p><!-- \/divi:paragraph -->[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A developer might be tempted to temporarily embed an API key in the system prompt of a customer service chatbot, with the intention of removing it later. If the model then discloses its instructions in response to a user request, that key may be exposed. This scenario illustrates the risk described by OWASP in the [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5470,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_titles_title":"System Prompt Leak: Risks and Security of AI Chatbots","_seopress_titles_desc":"Understand the risk of system prompt leaks and learn how to secure your AI chatbots against the extraction of instructions and API keys.","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_robots_imageindex":"","_seopress_robots_snippet":"","_seopress_robots_primary_cat":"","_seopress_robots_breadcrumbs":"","_seopress_robots_freeze_modified_date":"","_seopress_robots_custom_modified_date":"","_seopress_robots_canonical":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_fb_img":"","_seopress_social_fb_img_attachment_id":0,"_seopress_social_fb_img_width":0,"_seopress_social_fb_img_height":0,"_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_seopress_social_twitter_img":"","_seopress_social_twitter_img_attachment_id":0,"_seopress_social_twitter_img_width":0,"_seopress_social_twitter_img_height":0,"_seopress_redirections_value":"","_seopress_redirections_enabled":"","_seopress_redirections_enabled_regex":"","_seopress_redirections_logged_status":"","_seopress_redirections_param":"","_seopress_redirections_type":0,"_seopress_analysis_target_kw":"","_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[46],"tags":[],"class_list":["post-5473","post","type-post","status-publish","format-standard","has-post-thumbnail","category-other"],"_links":{"self":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/comments?post=5473"}],"version-history":[{"count":5,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5473\/revisions"}],"predecessor-version":[{"id":5702,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5473\/revisions\/5702"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/media\/5470"}],"wp:attachment":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/media?parent=5473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/categories?post=5473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/tags?post=5473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}