Skip to content

Commit a055a51

Browse files
authored
Merge pull request #640 from OmarV1/patch-12
Update LLM07_SystemPromptLeakage.md
2 parents 373b412 + 61b0c16 commit a055a51

File tree

1 file changed

+59
-38
lines changed

1 file changed

+59
-38
lines changed
Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,80 @@
1-
## LLM07:2025 System Prompt Leakage
1+
## LLM07:2025 تسريب التعليمات النظامية (System Prompt Leakage)
22

3-
### Description
3+
### الوصف
4+
تشير ثغرة تسريب التعليمات النظامية (System Prompt Leakage) في نماذج اللغة الكبيرة (LLMs) إلى الخطر المتمثل في أن التعليمات النظامية أو التوجيهات (System Prompts) المستخدمة لتوجيه سلوك النموذج قد تحتوي أيضًا على معلومات حساسة لم يكن من المفترض كشفها.
5+
تُصمم التعليمات النظامية لتوجيه مخرجات النموذج بناءً على متطلبات التطبيق، لكنها قد تحتوي عن غير قصد على أسرار.
6+
عند اكتشاف هذه المعلومات، يمكن استغلالها لتسهيل تنفيذ هجمات أخرى.
47

5-
The system prompt leakage vulnerability in LLMs refers to the risk that the system prompts or instructions used to steer the behavior of the model can also contain sensitive information that was not intended to be discovered. System prompts are designed to guide the model's output based on the requirements of the application, but may inadvertently contain secrets. When discovered, this information can be used to facilitate other attacks.
8+
من المهم أن نفهم أن التعليمات النظامية لا يجب اعتبارها سرًا، ولا يجب استخدامها كوسيلة للتحكم الأمني (Security Control).
9+
وبالتالي، يجب ألا تحتوي لغة التعليمات النظامية على بيانات حساسة مثل بيانات الاعتماد (Credentials)، أو سلاسل الاتصال (Connection Strings)، أو ما شابه.
610

7-
It's important to understand that the system prompt should not be considered a secret, nor should it be used as a security control. Accordingly, sensitive data such as credentials, connection strings, etc. should not be contained within the system prompt language.
11+
وبالمثل، إذا احتوت التعليمات النظامية على معلومات تصف أدوار وصلاحيات مختلفة، أو بيانات حساسة مثل سلاسل الاتصال أو كلمات المرور، فإنه رغم أن كشف هذه المعلومات قد يكون مفيدًا، إلا أن الخطر الأمني الأساسي لا يكمن في مجرد كشفها، بل يكمن في أن التطبيق يسمح بتجاوز إدارة الجلسات الصارمة وفحوصات التفويض (Authorization Checks) عبر تفويض هذه المهام إلى نموذج اللغة الكبير (LLM)، وأيضًا في أن البيانات الحساسة يتم تخزينها في مكان لا ينبغي تخزينها فيه.
812

9-
Similarly, if a system prompt contains information describing different roles and permissions, or sensitive data like connection strings or passwords, while the disclosure of such information may be helpful, the fundamental security risk is not that these have been disclosed, it is that the application allows bypassing strong session management and authorization checks by delegating these to the LLM, and that sensitive data is being stored in a place that it should not be.
13+
بإيجاز: كشف التعليمات النظامية بحد ذاته لا يمثل الخطر الحقيقي — الخطر الأمني يكمن في العناصر الأساسية المرتبطة، سواء كان ذلك كشف معلومات حساسة (Sensitive Information Disclosure)، أو تجاوز حواجز الحماية للنظام (System Guardrails Bypass)، أو الفصل غير السليم للصلاحيات (Improper Separation of Privileges)، وغيرها.
14+
حتى لو لم يتم الكشف عن الصياغة الدقيقة للتعليمات النظامية، سيتمكن المهاجمون الذين يتفاعلون مع النظام، تقريبًا بشكل مؤكد، من استنتاج العديد من حواجز الحماية (Guardrails) والقيود على التنسيق (Formatting Restrictions) الموجودة ضمن لغة التعليمات النظامية، من خلال استخدام التطبيق، وإرسال مدخلات للنموذج، وملاحظة النتائج.
1015

11-
In short: disclosure of the system prompt itself does not present the real risk -- the security risk lies with the underlying elements, whether that be sensitive information disclosure, system guardrails bypass, improper separation of privileges, etc. Even if the exact wording is not disclosed, attackers interacting with the system will almost certainly be able to determine many of the guardrails and formatting restrictions that are present in system prompt language in the course of using the application, sending utterances to the model, and observing the results.
1216

13-
### Common Examples of Risk
17+
### أمثلة شائعة على المخاطر (Common Examples of Risk)
1418

15-
#### 1. Exposure of Sensitive Functionality
16-
The system prompt of the application may reveal sensitive information or functionality that is intended to be kept confidential, such as sensitive system architecture, API keys, database credentials, or user tokens. These can be extracted or used by attackers to gain unauthorized access into the application. For example, a system prompt that contains the type of database used for a tool could allow the attacker to target it for SQL injection attacks.
17-
#### 2. Exposure of Internal Rules
18-
The system prompt of the application reveals information on internal decision-making processes that should be kept confidential. This information allows attackers to gain insights into how the application works which could allow attackers to exploit weaknesses or bypass controls in the application. For example - There is a banking application that has a chatbot and its system prompt may reveal information like
19-
>"The Transaction limit is set to $5000 per day for a user. The Total Loan Amount for a user is $10,000".
20-
This information allows the attackers to bypass the security controls in the application like doing transactions more than the set limit or bypassing the total loan amount.
21-
#### 3. Revealing of Filtering Criteria
22-
A system prompt might ask the model to filter or reject sensitive content. For example, a model might have a system prompt like,
23-
>“If a user requests information about another user, always respond with ‘Sorry, I cannot assist with that request’”.
24-
#### 4. Disclosure of Permissions and User Roles
25-
The system prompt could reveal the internal role structures or permission levels of the application. For instance, a system prompt might reveal,
26-
>“Admin user role grants full access to modify user records.”
27-
If the attackers learn about these role-based permissions, they could look for a privilege escalation attack.
19+
#### 1. كشف الوظائف الحساسة (Exposure of Sensitive Functionality)
20+
قد تكشف التعليمة النظامية (System Prompt) للتطبيق عن معلومات أو وظائف حساسة كان من المفترض أن تبقى سرية، مثل بنية النظام الحساسة (Sensitive System Architecture)، مفاتيح واجهات البرمجة (API Keys)، بيانات اعتماد قواعد البيانات (Database Credentials)، أو رموز المستخدمين (User Tokens).
21+
يمكن استخراج هذه المعلومات أو استغلالها من قِبل المهاجمين للحصول على وصول غير مصرح به إلى التطبيق.
22+
على سبيل المثال، قد يؤدي وجود نوع قاعدة البيانات ضمن التعليم النظامي إلى استهدافها بهجمات الحقن (SQL Injection Attacks).
23+
#### 2. كشف القواعد الداخلية (Exposure of Internal Rules)
24+
قد تكشف التعليمة النظامية (System Prompt) للتطبيق عن معلومات تتعلق بعمليات اتخاذ القرار الداخلي والتي يجب أن تبقى سرية.
25+
تُمكّن هذه المعلومات المهاجمين من فهم كيفية عمل التطبيق، مما قد يسمح لهم باستغلال نقاط الضعف أو تجاوز الضوابط داخل التطبيق.
26+
على سبيل المثال — في تطبيق مصرفي يحتوي على روبوت دردشة (Chatbot)، قد يكشف التعليم النظامي معلومات مثل:
2827

29-
### Prevention and Mitigation Strategies
28+
>"تم تحديد حد المعاملات اليومية للمستخدم بمبلغ 5000 دولار. وإجمالي مبلغ القرض المسموح به للمستخدم هو 10,000 دولار."
3029
31-
#### 1. Separate Sensitive Data from System Prompts
32-
Avoid embedding any sensitive information (e.g. API keys, auth keys, database names, user roles, permission structure of the application) directly in the system prompts. Instead, externalize such information to the systems that the model does not directly access.
33-
#### 2. Avoid Reliance on System Prompts for Strict Behavior Control
34-
Since LLMs are susceptible to other attacks like prompt injections which can alter the system prompt, it is recommended to avoid using system prompts to control the model behavior where possible. Instead, rely on systems outside of the LLM to ensure this behavior. For example, detecting and preventing harmful content should be done in external systems.
35-
#### 3. Implement Guardrails
36-
Implement a system of guardrails outside of the LLM itself. While training particular behavior into a model can be effective, such as training it not to reveal its system prompt, it is not a guarantee that the model will always adhere to this. An independent system that can inspect the output to determine if the model is in compliance with expectations is preferable to system prompt instructions.
37-
#### 4. Ensure that security controls are enforced independently from the LLM
38-
Critical controls such as privilege separation, authorization bounds checks, and similar must not be delegated to the LLM, either through the system prompt or otherwise. These controls need to occur in a deterministic, auditable manner, and LLMs are not (currently) conducive to this. In cases where an agent is performing tasks, if those tasks require different levels of access, then multiple agents should be used, each configured with the least privileges needed to perform the desired tasks.
30+
تسمح هذه المعلومات للمهاجمين بتجاوز ضوابط الأمان مثل إجراء معاملات تتجاوز الحد اليومي أو تجاوز إجمالي القرض المسموح به.
3931

40-
### Example Attack Scenarios
32+
#### 3. كشف معايير التصفية (Revealing of Filtering Criteria)
33+
قد تضمن التعليمة النظامية (System Prompt) طلبًا من النموذج بتصفية أو رفض محتوى حساس. على سبيل المثال، قد يحتوي التعليم النظامي للنموذج على:
34+
>"إذا طلب المستخدم معلومات عن مستخدم آخر، دائمًا رد بـ: 'عذرًا، لا يمكنني المساعدة في هذا الطلب'."
4135
42-
#### Scenario #1
43-
An LLM has a system prompt that contains a set of credentials used for a tool that it has been given access to. The system prompt is leaked to an attacker, who then is able to use these credentials for other purposes.
44-
#### Scenario #2
45-
An LLM has a system prompt prohibiting the generation of offensive content, external links, and code execution. An attacker extracts this system prompt and then uses a prompt injection attack to bypass these instructions, facilitating a remote code execution attack.
36+
#### 4. كشف الصلاحيات وأدوار المستخدمين (Disclosure of Permissions and User Roles)
37+
قد تكشف التعليمة النظامية (System Prompt) للتطبيق عن بنية الأدوار الداخلية (Internal Role Structures) أو مستويات الصلاحيات (Permission Levels) في التطبيق.
38+
على سبيل المثال، قد تكشف تعليمة نظامية (System Prompt) ما يلي:
4639

47-
### Reference Links
40+
>"دور المستخدم الإداري (Admin User Role) يمنح صلاحية كاملة لتعديل سجلات المستخدمين."
41+
42+
إذا علم المهاجمون بهذه الصلاحيات المعتمدة على الأدوار (Role-Based Permissions)، فقد يحاولون تنفيذ هجوم تصعيد الامتيازات (Privilege Escalation Attack).
43+
44+
### استراتيجيات الوقاية والتخفيف (Prevention and Mitigation Strategies)
45+
46+
#### 1. فصل البيانات الحساسة عن التعليمات النظامية (Separate Sensitive Data from System Prompts)
47+
تجنب تضمين أي معلومات حساسة (مثل مفاتيح واجهات البرمجة (API Keys)، مفاتيح المصادقة (Auth Keys)، أسماء قواعد البيانات (Database Names)، أدوار المستخدمين (User Roles)، أو بنية صلاحيات التطبيق (Permission Structure of the Application)) مباشرةً ضمن التعليمات النظامية (System Prompts). بدلاً من ذلك، قم بفصل هذه المعلومات إلى أنظمة لا يصل إليها النموذج بشكل مباشر.
48+
49+
#### 2. تجنب الاعتماد على التعليمات النظامية للتحكم الصارم في السلوك (Avoid Reliance on System Prompts for Strict Behavior Control)
50+
نظرًا لأن نماذج اللغة الكبيرة (LLMs) عرضة لهجمات أخرى مثل حقن التعليمات (Prompt Injections) التي يمكن أن تغير التعليمة النظامية (System Prompt)، يُوصى بتجنب استخدام التعليمات النظامية للتحكم في سلوك النموذج حيثما أمكن.
51+
بدلاً من ذلك، يجب الاعتماد على أنظمة خارجية عن نموذج اللغة الكبير (LLM) لضمان هذا السلوك. على سبيل المثال، يجب أن يتم اكتشاف المحتوى الضار ومنعه عبر أنظمة خارجية (External Systems).
52+
53+
#### 3. تطبيق حواجز الحماية (Implement Guardrails)
54+
قم بتنفيذ نظام لحواجز الحماية (Guardrails) خارج نموذج اللغة الكبير (LLM) نفسه. رغم أن تدريب النموذج على سلوك معين مثل عدم كشف التعليمات النظامية قد يكون فعالًا، إلا أنه لا يضمن دائمًا التزام النموذج بذلك. يُفضل وجود نظام مستقل قادر على فحص المخرجات للتأكد من التزام النموذج بالتوقعات بدلاً من الاعتماد فقط على التعليمات النظامية.
55+
56+
#### 4. التأكد من أن الضوابط الأمنية تُفرض بشكل مستقل عن LLM (Ensure that Security Controls are Enforced Independently from the LLM)
57+
يجب ألا يتم تفويض الضوابط الأساسية مثل فصل الصلاحيات (Privilege Separation)، وفحوصات حدود التفويض (Authorization Bounds Checks)، وما شابه، إلى نموذج اللغة الكبير (LLM)، سواء من خلال التعليمات النظامية أو بطرق أخرى.
58+
يجب تنفيذ هذه الضوابط بطريقة حتمية وقابلة للتدقيق، وهو ما لا تدعمه نماذج LLM حاليًا. وفي الحالات التي يقوم فيها وكيل (Agent) بتنفيذ مهام تتطلب مستويات وصول مختلفة، يجب استخدام عدة وكلاء، بحيث يتم تهيئة كل وكيل بأقل امتيازات لازمة لتنفيذ المهام المطلوبة.
59+
60+
### سيناريوهات هجوم توضيحية (Example Attack Scenarios)
61+
62+
#### السيناريو #1
63+
يمتلك نموذج اللغة الكبير (LLM) تعليمًا نظاميًا يحتوي على مجموعة من بيانات الاعتماد (Credentials) المستخدمة لأداة تم منح النموذج حق الوصول إليها. يتم تسريب التعليم النظامي إلى مهاجم، مما يمكنه من استخدام هذه البيانات لأغراض أخرى.
64+
65+
#### السيناريو #2
66+
يمتلك نموذج اللغة الكبير (LLM) تعليمًا نظاميًا يمنع توليد محتوى مسيء، أو الروابط الخارجية، أو تنفيذ الشيفرة البرمجية.
67+
يقوم مهاجم باستخراج هذا التعليم النظامي، ثم يستخدم هجوم حقن التعليمات (Prompt Injection) لتجاوز هذه التعليمات، مما يسهل تنفيذ هجوم تنفيذ تعليمات برمجية عن بُعد (Remote Code Execution Attack).
68+
69+
### روابط مرجعية
4870

4971
1. [SYSTEM PROMPT LEAK](https://x.com/elder_plinius/status/1801393358964994062): Pliny the prompter
5072
2. [Prompt Leak](https://www.prompt.security/vulnerabilities/prompt-leak): Prompt Security
5173
3. [chatgpt_system_prompt](https://github.com/LouisShark/chatgpt_system_prompt): LouisShark
5274
4. [leaked-system-prompts](https://github.com/jujumilk3/leaked-system-prompts): Jujumilk3
5375
5. [OpenAI Advanced Voice Mode System Prompt](https://x.com/Green_terminals/status/1839141326329360579): Green_Terminals
5476

55-
### Related Frameworks and Taxonomies
56-
57-
Refer to this section for comprehensive information, scenarios strategies relating to infrastructure deployment, applied environment controls and other best practices.
77+
### االأطر والتصنيفات ذات الصلة
78+
راجع هذا القسم للحصول على معلومات شاملة، استراتيجيات وسيناريوهات متعلقة بنشر البنية التحتية، ضوابط البيئة التطبيقية، وأفضل الممارسات الأخرى.
5879

5980
- [AML.T0051.000 - LLM Prompt Injection: Direct (Meta Prompt Extraction)](https://atlas.mitre.org/techniques/AML.T0051.000) **MITRE ATLAS**

0 commit comments

Comments
 (0)