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.
LLM-powered applications routinely embed secrets in system prompts, yet models can be tricked into revealing them. We built an adaptive attacker that evolves its strategies over hundreds of rounds and tested it against nine defense configurations across more than 20,000 attacks. Every defense that relied on the model to protect itself eventually broke. The only defense that held was output filtering, which checks the model's responses via hardcoded rules in separate application code before they reach the user, achieving zero leaks across 15,000 attacks. These results demonstrate that security boundaries must be enforced in application code, not by the model being attacked. Until such defenses are verified by tools like Swept AI, AI systems handling sensitive operations should be restricted to internal, trusted personnel.
High-privilege LLM agents that autonomously process external documentation are increasingly trusted to automate tasks by reading and executing project instructions, yet they are granted terminal access, filesystem control, and outbound network connectivity with minimal security oversight. We identify and systematically measure a fundamental vulnerability in this trust model, which we term the Trusted Executor Dilemma: agents execute documentation-embedded instructions, including adversarial ones, at high rates because they cannot distinguish malicious directives from legitimate setup guidance. This vulnerability is a structural consequence of the instruction-following design paradigm, not an implementation bug. To structure our measurement, we formalize a three-dimensional taxonomy covering linguistic disguise, structural obfuscation, and semantic abstraction, and construct ReadSecBench, a benchmark of 500 real-world README files enabling reproducible evaluation. Experiments on the commercially deployed computer-use agent show end-to-end exfiltration success rates up to 85%, consistent across five programming languages and three injection positions. Cross-model evaluation on four LLM families in a simulation environment confirms that semantic compliance with injected instructions is consistent across model families. A 15-participant user study yields a 0% detection rate across all participants, and evaluation of 12 rule-based and 6 LLM-based defenses shows neither category achieves reliable detection without unacceptable false-positive rates. Together, these results quantify a persistent Semantic-Safety Gap between agents' functional compliance and their security awareness, establishing that documentation-embedded instruction injection is a persistent and currently unmitigated threat to high-privilege LLM agent deployments.
Large Language Models (LLMs) are increasingly integrated into safety-critical workflows, yet existing security analyses remain fragmented and often isolate model behavior from the broader system context. This work introduces a goal-driven risk assessment framework for LLM-powered systems that combines system modeling with Attack-Defense Trees (ADTrees) and Common Vulnerability Scoring System (CVSS)-based exploitability scoring to support structured, comparable analysis. We demonstrate the framework through a healthcare case study, modeling multi-step attack paths targeting intervention in medical procedures, leakage of electronic health record (EHR) data, and disruption of service availability. Our analysis indicates that threats spanning (i) conventional cyber, (ii) adversarial ML, and (iii) conversational attacks that manipulate prompts or context often consolidate into a small number of dominant paths and shared system choke points, enabling targeted defenses to yield meaningful reductions in path exploitability. By systematically comparing defense portfolios, we align these risks with established vulnerability management practices and provide a domain-agnostic workflow applicable to other LLM-enabled critical systems.
Neha Nagaraja, Hayretdin Bahsi
School of Informatics, Computing, and Cyber Systems, Northern Arizona University, Flagstaff, USA · Department of Software Science, Tallinn University of Technology, Tallinn, Estonia