System Instructions in Large Language Models (LLMs) are commonly used to enforce safety policies, define agent behavior, and protect sensitive operational context in agentic AI applications. These instructions may contain sensitive information such as API credentials, internal policies, and privileged workflow definitions, making system instruction leakage a critical security risk highlighted in the OWASP Top 10 for LLM Applications. Without incurring the overhead costs of reasoning models, many LLM applications rely on refusal-based instructions that block direct requests for system instructions, implicitly assuming that prohibited information can only be extracted through explicit queries. We introduce an automated evaluation framework that tests whether system instructions remain confidential when extraction requests are re-framed as encoding or structured output tasks. Across seven common models and 46 verified system instructions, we observe high attack success rates (>0.7) for structured serialization where models refuse direct extraction requests but disclose protected content in the requested serialization formats. We further demonstrate a mitigation strategy based on one-shot instruction reshaping using a Chain-of-Thought reasoning model, indicating that even subtle changes in wording and structure of system instructions can significantly reduce attack success rate without requiring model retraining.
Figures & tables
Fig. 1: Overall architecture of the evaluation framework
Model
Pig Latin
Base64
Rot13
Leetspeak
Toml
Yaml
JSON Wrapper
Morse Code
Emoji
HTTP Header
Cron Comment
Git Ignore
Syslog
GPT-4.1-mini
0.0870
0.0870
0.3043
0.3478
0.9130
0.9565
0.2391
0.0652
0.0870
0.1304
0.7826
0.9130
0.1522
GPT-3.5-turbo
0.5870
0.0435
0.0435
0.1957
0.8696
0.8478
0.5870
0.1957
0.1304
0.1304
0.6304
0.7174
0.0652
Gemini-2.5-flash
0.0870
0.0435
0.1739
0.1304
0.6304
0.6087
0.3696
0.0870
0.0217
0.1957
0.4565
0.5435
0.1957
LLaMA-3-8B
0.4348
0.0870
0.2391
0.6087
0.8696
0.8913
0.6739
0.1522
0.1957
0.3261
0.6087
0.8261
0.6304
Mistral-Small-4-119B
0.2414
0.2069
0.1724
0.7241
0.7586
0.6552
0.6897
0.0690
0.2069
0.7241
0.7586
0.5862
0.4828
Microsoft-Phi-3.5-MoE Instruct
0.6667
0.1667
0.6333
0.5667
0.8000
0.7667
0.5333
0.2000
0.0000
0.5333
0.6667
0.8333
0.5667
TABLE I: ASR Before System Instruction Hardening Across Encoding Techniques
Model
Pig Latin
Base64
Rot13
Leetspeak
Toml
Yaml
JSON Wrapper
Morse Code
Emoji
HTTP Header
Cron Comment
Git Ignore
Syslog
GPT-4.1-mini
0.0000
0.0000
0.0435
0.0652
0.4130
0.6304
0.0435
0.0217
0.0217
0.0217
0.1739
0.2826
0.2117
GPT-3.5-turbo
0.2391
0.0000
0.0435
0.1087
0.2826
0.3478
0.1087
0.0000
0.0435
0.0000
0.1739
0.2826
0.0435
Gemini-2.5-flash
0.0000
0.0217
0.0000
0.0000
0.0652
0.0435
0.0652
0.0000
0.0000
0.0000
0.1304
0.0435
0.0217
LLaMA-3-8B
0.4783
0.0435
0.2609
0.6522
0.6087
0.5435
0.5652
0.1304
0.0870
0.1957
0.5435
0.6304
0.5435
Mistral-Small-4-119B
0.0345
0.0000
0.0000
0.0000
0.1034
0.2414
0.1379
0.0000
0.0000
0.0000
0.0345
0.0000
0.0690
Microsoft-Phi-3.5-MoE Instruct
0.0333
0.0000
0.1333
0.0000
0.5667
0.5000
0.0667
0.0000
0.0000
0.0000
0.0000
0.4000
0.0667
TABLE II: ASR After System Instruction Hardening Across Encoding Techniques
Model
Metric
Character-Level Obfuscation
Structure-Embedding Wrappers
Symbolic Encodings
Logs & Protocol Embedding
GPT-4.1-mini
Before
0.4130
0.9783
0.1087
0.9130
After
0.0652
0.6739
0.0217
0.3261
Reduction(%)
84.200
31.100
80.000
64.300
GPT-3.5-turbo
Before
0.6522
0.9565
0.2609
0.8261
After
0.2826
0.4348
0.0435
0.3696
Reduction(%)
56.700
54.500
83.300
55.300
TABLE III: ASR by model across encoding categories (Before vs. After System Instruction Hardening). Reduction (%) is computed as 100×(Before−After)/Before .
Fig. 2: Evaluation framework with system instruction hardening via CoT-guided instruction reshaping.
School of Informatics, Computing, and Cyber Systems, Northern Arizona University, Flagstaff, USA · Department of Software Science, Tallinn University of Technology, Tallinn, Estonia