PromptKeeper: Safeguarding System Prompts for LLMs

Zhifeng Jiang, Zhihua Jin, Guoliang He


Abstract
System prompts are widely used to guide the outputs of large language models (LLMs). These prompts often contain business logic and sensitive information, making their protection essential. However, adversarial and even regular user queries can exploit LLM vulnerabilities to expose these hidden prompts. To address this issue, we propose PromptKeeper, a defense mechanism designed to safeguard system prompts by tackling two core challenges: reliably detecting leakage and mitigating side-channel vulnerabilities when leakage occurs. By framing detection as a hypothesis-testing problem, PromptKeeper effectively identifies both explicit and subtle leakage. Upon leakage detected, it regenerates responses using a dummy prompt, ensuring that outputs remain indistinguishable from typical interactions when no leakage is present. PromptKeeper ensures robust protection against prompt extraction attacks via either adversarial or regular queries, while preserving conversational capability and runtime efficiency during benign user interactions.
Anthology ID:
2025.findings-emnlp.147
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2025
Month:
November
Year:
2025
Address:
Suzhou, China
Editors:
Christos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, Violet Peng
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
2712–2728
Language:
URL:
https://preview.aclanthology.org/author-page-yu-wang-polytechnic/2025.findings-emnlp.147/
DOI:
10.18653/v1/2025.findings-emnlp.147
Bibkey:
Cite (ACL):
Zhifeng Jiang, Zhihua Jin, and Guoliang He. 2025. PromptKeeper: Safeguarding System Prompts for LLMs. In Findings of the Association for Computational Linguistics: EMNLP 2025, pages 2712–2728, Suzhou, China. Association for Computational Linguistics.
Cite (Informal):
PromptKeeper: Safeguarding System Prompts for LLMs (Jiang et al., Findings 2025)
Copy Citation:
PDF:
https://preview.aclanthology.org/author-page-yu-wang-polytechnic/2025.findings-emnlp.147.pdf
Checklist:
 2025.findings-emnlp.147.checklist.pdf