arXiv:2503.24191cs.CRcs.AI2025-03被引 6

用语法约束诱导大模型生成有害内容,暴露控制平面漏洞。

When Grammar Guides the Attack: Uncovering Control-Plane Vulnerabilities in LLMs with Structured Output

  • 通过语法强制掩码在生成过程中注入恶意前缀
  • 针对主流模型攻击成功率高达94.3%~99.5%
  • 现有安全机制无法阻止此类跨平面攻击

大型语言模型(LLMs)通过结构化输出API日益成为工具平台,但其语法引导的解码机制带来了与传统数据平面漏洞无关的关键控制平面攻击面。本文提出约束解码攻击(CDA),一种新型越狱攻击,针对模型控制平面。CDA本质是控制到语义的流水线:(1) 通过模式强制的logit掩码将恶意前缀注入生成轨迹,(2) 模型自身完成有害意图生成。不同于依赖可见输入绕过对齐的数据平面越狱,CDA作用于解码过程本身,因此内部安全对齐无法防范。我们实现两种攻击:EnumAttack将恶意内容隐藏在枚举字段中,DictAttack则通过良性提示与字典语法解耦载荷。在13个专有/开源模型及5个标准基准上,DictAttack在gpt-5、gemini-2.5-pro、deepseek-r1和gpt-oss-120b等旗舰模型上取得94.3%~99.5%的攻击成功率达(ASR)。基础语法审计可缓解EnumAttack,但DictAttack仍保持75.8%的ASR,超越当前最先进越狱防护,暴露出需跨平面防御的“语义鸿沟”。项目页面与代码见https://ict-cda.github.io/。

原文摘要 · Abstract (English)

Content Warning: This paper may contain unsafe or harmful content generated by LLMs that may be offensive to readers. Large Language Models (LLMs) increasingly serve as tooling platforms through structured output APIs, but the grammar-guided decoding that powers this feature opens a critical control-plane attack surface orthogonal to traditional data-plane vulnerabilities. We introduce Constrained Decoding Attack (CDA), a new jailbreak class that targets the LLM control plane. CDA is best characterized as a control-to-semantic pipeline: (1) schema-enforced logit masking injects a malicious prefix into the generation trajectory, and (2) the model itself completes the harmful intent. Unlike data-plane jailbreaks that rely on bypassing alignment with visible inputs, CDA acts on the decoding process itself, so internal safety alignment alone cannot stop it. We instantiate CDA with EnumAttack, which hides malicious content in enum fields, and the more evasive DictAttack, which decouples the payload across a benign prompt and a dictionary-based grammar. Across 13 proprietary/open-weight models and five standard benchmarks, DictAttack achieves 94.3--99.5% Attack Success Rate (ASR) on flagship models including gpt-5, gemini-2.5-pro, deepseek-r1, and gpt-oss-120b. While basic grammar auditing mitigates EnumAttack, DictAttack still sustains 75.8% ASR against SOTA jailbreak guardrails, exposing a "semantic gap" that demands cross-plane defenses bridging the data and control planes. Project page and code are available at https://ict-cda.github.io/.

越狱攻击控制平面语法约束大模型安全

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