arXiv:2604.12232cs.CRcs.AI2026-04

通过细粒度模板模糊测试,高效发现大模型聊天模板漏洞。

TEMPLATEFUZZ: Fine-Grained Chat Template Fuzzing for Jailbreaking and Red Teaming LLMs

  • 设计元素级变异规则生成多样模板变体。
  • 实现98.2%攻击成功率,仅损失1.1%模型准确率。
  • 适合安全研究者与红队测试人员使用。

大型语言模型(LLMs)在多个领域广泛应用,但其易受越狱攻击——恶意输入绕过安全机制生成有害内容——带来严重安全风险。现有方法多聚焦于提示注入,常需大量人工设计且忽视聊天模板这一关键攻击面。本文提出TEMPLATEFUZZ,一种细粒度模糊测试框架,系统暴露聊天模板中的漏洞。该框架(1)设计一系列元素级变异规则生成多样化模板变体;(2)提出启发式搜索策略,引导模板生成以提升攻击成功率(ASR)同时保持模型准确率;(3)集成基于主动学习的轻量规则化评估器,实现高效精准的越狱检测。在十二个开源LLM上测试,平均ASR达98.2%,仅1.1%准确率下降,优于当前最优方法9.1%-47.9%(ASR)和8.4%(准确率下降)。即使在五款主流商业模型上(无法自定义模板),仍通过模板驱动的提示注入实现90%平均ASR。

原文摘要 · Abstract (English)

Large Language Models (LLMs) are increasingly deployed across diverse domains, yet their vulnerability to jailbreak attacks, where adversarial inputs bypass safety mechanisms to elicit harmful outputs, poses significant security risks. While prior work has primarily focused on prompt injection attacks, these approaches often require resource-intensive prompt engineering and overlook other critical components, such as chat templates. This paper introduces TEMPLATEFUZZ, a fine-grained fuzzing framework that systematically exposes vulnerabilities in chat templates, a critical yet underexplored attack surface in LLMs. Specifically, TEMPLATEFUZZ (1) designs a series of element-level mutation rules to generate diverse chat template variants, (2) proposes a heuristic search strategy to guide the chat template generation toward the direction of amplifying the attack success rate (ASR) while preserving model accuracy, and (3) integrates an active learning-based strategy to derive a lightweight rule-based oracle for accurate and efficient jailbreak evaluation. Evaluated on twelve open-source LLMs across multiple attack scenarios, TEMPLATEFUZZ achieves an average ASR of 98.2% with only 1.1% accuracy degradation, outperforming state-of-the-art methods by 9.1%-47.9% in ASR and 8.4% in accuracy degradation. Moreover, even on five industry-leading commercial LLMs where chat templates cannot be specified, TEMPLATEFUZZ attains a 90% average ASR via chat template-based prompt injection attacks.

越狱攻击模板模糊LLM安全红队测试

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。