arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2602.04653cs.CRcs.LG
收藏

通过聊天模板的推理时后门:从LLM供应链到代理系统妥协

Inference-Time Backdoors via Chat Templates: From LLM Supply Chains to Agentic System Compromise

Fujitsu Research of Europe(富士通欧洲研究)

Ariel Fogel, Omer Hofman, Eilon Cohen, Roman Vainshtein

AI总结:

提出一种通过恶意修改聊天模板实现推理时后门攻击的方法,无需修改模型权重或训练数据,在LLM、代理和多代理系统层面均能成功攻击,且能绕过现有防御。

摘要:

开源权重语言模型越来越多地用于生产环境,带来了新的安全挑战。一个突出的威胁是后门攻击,攻击者嵌入在特定条件下激活的隐藏行为。先前的工作假设攻击者能够访问训练流程或部署基础设施。我们提出了一种新颖的攻击面,不需要这些:即“聊天模板”。聊天模板是在每次推理调用时执行的可执行程序,通常用Jinja2实现,占据用户输入和模型处理之间的特权位置。我们表明,分发带有恶意修改模板的模型的攻击者可以在不修改模型权重、投毒训练数据或控制运行时基础设施的情况下植入推理时后门。我们在三个部署层级评估了这种攻击。在LLM层面,触发的后门将事实准确性从平均90%降低到15%,并诱导攻击者控制的URL发射,成功率超过80%,而良性输入没有可测量的退化;这些结果在十八个模型上成立。在代理层面,模板后门在两个基准测试(涵盖3868个回合)中劫持了工具使用,绕过了基准测试提供的所有测试过的注入防御,同时在缺乏触发条件时完全休眠。在多代理系统层面,我们展示了单个投毒工件如何损害真实世界的代理部署,并向下游传播供应链代码投毒。投毒工件在最大的开源模型分发平台上逃避了所有安全扫描;并且由于负载在用户输入处理之前由模板渲染,它在架构上无法被输入级防御(如提示注入护栏)触及。这些结果确立了聊天模板在开源权重AI供应链中作为一种可靠且未受防御的攻击方式。

英文摘要:

Open-weight language models are increasingly used in production settings, raising new security challenges. One prominent threat is backdoor attacks, in which adversaries embed hidden behaviors that activate under specific conditions. Previous work has assumed that adversaries have access to training pipelines or deployment infrastructure. We propose a novel attack surface requiring neither: the "chat template". Chat templates are executable programs invoked at every inference call, often implemented in Jinja2, that occupy a privileged position between user input and model processing. We show that an adversary who distributes a model with a maliciously modified template can implant an inference-time backdoor without modifying model weights, poisoning training data, or controlling runtime infrastructure. We evaluate this attack across three deployment tiers. At the LLM level, triggered backdoors reduce factual accuracy from 90% to 15% on average and induce attacker-controlled URL emission with success rates exceeding 80%, while benign inputs show no measurable degradation; these results hold across eighteen models. At the agent level, template backdoors hijack tool-use across two benchmarks spanning 3,868 episodes, bypassing every tested injection defense offered by the benchmarks while remaining fully dormant absent the trigger. At the multi-agent system level, we demonstrate how a single poisoned artifact compromises a real-world agentic deployment and propagates supply-chain code poisoning downstream. The poisoned artifacts evade all security scans on the largest open model distribution platform; and because the payload is rendered by the template before user input is processed, it is architecturally unreachable by input-level defenses such as prompt injection guardrails. These results establish chat templates as a reliable and undefended attack in the open-weight AI supply chain.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑