Extracting System Prompt of LLM Services in Complex (Agentic) Settings: Hierarchical Optimization and Reliable Evaluation Metrics
Shuaidong Li, Chenhao Lin, Xinshan Yang, Chao Shen, Yufei Chen, Zhengyu Zhao
Abstract
System prompt is a critical intellectual property of large language model (LLM) services. To analyze its leakage, prompt extraction attacks have been extensively studied. However, we validate that existing attacks substantially degrade on recent LLM services, whose complexity has evolved in both the prompt itself and system-level constraints. Specifically, (1) system prompts become longer and more structured to contain pre-defined tool schemas, execution logic, safety guardrails, etc., and (2) only the final post-processed outputs (e.g., agent's actions) but not the raw textual response can be observed. In this paper, we address the above increased complexity by proposing Extraction with Hierarchical Optimization (ExtraHerO), which (1) decomposes the prompt extraction into a hierarchical reconstruction process with a pre-defined structural prompt template, and (2) iteratively updates the adversarial query with guidance of feedback-template differences to observe diverse outputs. In particular, we monitor the information gain of attack optimization to early stop or reset it for a good trade-off between effectiveness and efficiency. We also find that existing evaluation metrics for prompt fidelity can be misleading because they do not account for structural information. Therefore, we rely on global textual similarity and prioritize structural keywords. Moreover, we introduce a system-level metric, adversarial utility, to measure the help of prompt extraction for real-world downstream attacks. Experimental results demonstrate the consistent superiority of ExtraHerO, with average improvements of 12.5\% (fidelity), 2.3\% (functionality), and 6.0\% (adversarial utility) on chatbots, and 12.2\%, 34.3\%, and 30.5\% on agents.
Create a lesson
Related papers
Leakage-Resilient Computation via Matrix Refreshing
Stefan Dziembowski, Sebastian Faust
BrainwashedLLM: Jailbreaking via Automated Adversarial Chain of Thoughts Discovery
Masoud Poorghaffar Aghdam, Göktuğ Serdar Yıldırım, Sinem Sav
Right Tool, Wrong Parameters: Defending LLM Agents Against Parameter Poisoning
Yao Wang, Zehua Ma, Weiming Zhang et al.
The Devil is in the Context: Nine Dimensions of Prompt Injection Attacks
Jiamin Chang, Kristina Nikolić, Rishi Sharma et al.
Perseus: A Full-Stack System for Homomorphic Model Inference
Alessandro Zirilli, Davide Marincione, Evgenios M. Kornaropoulos et al.
A Security Analysis of Verifiable Credential Verification Pipelines: Attack Surface Arising from JSON-LD/RDFC Canonicalization Compared with SD-JWT VC and mdoc
Naohiro Fujie, Shigeya Suzuki