arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.08422cs.CRcs.AIcs.SE
收藏

大语言模型(LLMs)+ 安全 = 麻烦

LLMs + Security = Trouble

Imperial College London(伦敦帝国学院)

Benjamin Livshits

AI总结:

该研究指出当前用概率AI保障AI生成代码安全的方法存在长尾漏洞缺陷,神经符号方法也难适配LLM辅助开发流程,提出在代码生成阶段通过约束解码等方式强制安全约束的方案,尤其适配扩散式代码模型以实现构建即安全。

摘要:

我们认为,在利用AI生成安全代码方面,当前主流的“以火攻火”方法——即使用基于概率的AI检查器或攻击方来保障概率生成代码的安全性——无法解决安全漏洞的长尾问题。因此,系统可能仍会暴露在零日漏洞之下,资源更充足或更具持续性的攻击者能够发现这些漏洞。\n 从理论上讲,将大语言模型(LLMs)与形式化方法相结合的神经符号方法颇具吸引力,但我们认为这类方法难以与LLM辅助开发中常见的“氛围编码”工作流相适配:除非端到端验证流水线实现完全自动化,否则开发者会被反复要求验证规范、解决歧义并判定故障,这使得人在回路成为潜在的薄弱环节,进而损害“构建即安全”的保障。\n 在本文中我们提出,通过在代码生成过程中(例如借助约束解码)强制执行安全约束,而非仅依赖事后检测与修复,能够获得更强的安全保障。这一方向对扩散式代码模型尤其具有前景,这类模型的方法为模块化、分层化的安全执行提供了自然且巧妙的契机,让我们能够将低延迟生成技术与生成“构建即安全”的代码相结合。

英文摘要:

We argue that when it comes to producing secure code with AI, the prevailing "fighting fire with fire" approach -- using probabilistic AI-based checkers or attackers to secure probabilistically generated code -- fails to address the long tail of security bugs. As a result, systems may remain exposed to zero-day vulnerabilities that can be discovered by better-resourced or more persistent adversaries. While neurosymbolic approaches that combine LLMs with formal methods are attractive in principle, we argue that they are difficult to reconcile with the "vibe coding" workflow common in LLM-assisted development: unless the end-to-end verification pipeline is fully automated, developers are repeatedly asked to validate specifications, resolve ambiguities, and adjudicate failures, making the human-in-the-loop a likely point of weakness, compromising secure-by-construction guarantees. In this paper we argue that stronger security guarantees can be obtained by enforcing security constraints during code generation (e.g., via constrained decoding), rather than relying solely on post-hoc detection and repair. This direction is particularly promising for diffusion-style code models, whose approach provides a natural elegant opportunity for modular, hierarchical security enforcement, allowing us to combine lower-latency generation techniques with generating secure-by-construction code.

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

↑