Compared to What? A Human-Anchored Security Benchmark for LLM-Generated Infrastructure-as-Code
作者: Animesh Shaw
分类: cs.CR, cs.AI, cs.MA, cs.SE
发布日期: 2026-08-28
备注: 12 pages, 11 figures, 9 tables. Code: https://github.com/AnimeshShaw/GenIaC-SecBench Data: https://huggingface.co/datasets/AnimeshShaw/GenIaC-SecBench
💡 一句话要点
提出GenIaC-SecBench以评估LLM生成的基础设施代码安全性
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 基础设施即代码 安全基准 大型语言模型 漏洞评估 自动化代码生成 机器学习 人工智能
📋 核心要点
- 现有方法缺乏人类基准,无法有效评估LLM生成的IaC安全性,导致对模型性能的误判。
- 提出GenIaC-SecBench基准,通过100个场景和634个人工模板,提供了全面的安全性评估。
- 实验结果显示,模型生成的IaC在简单任务中漏洞密度显著高于人类,且不同生成策略的效果差异明显。
📝 摘要(中文)
随着大型语言模型(LLM)在基础设施即代码(IaC)中的应用日益增加,单一的不安全默认配置可能直接部署到生产环境中。以往的评估仅报告模型生成的IaC的原始漏洞数量,但缺乏人类基准,无法判断模型是否真的比工程师更差。本文引入GenIaC-SecBench,这是一个包含100个部署场景的基准,涵盖12种模型配置,生成1196个IaC工件,并通过三种独立的策略引擎进行扫描。此外,本文还扫描了634个人工编写的IaC模板,提供了首个匹配规模的人类安全基准。研究发现,漏洞密度与工件大小呈强负相关,且在资源数量相同的情况下,所有模型配置的漏洞密度均在人工密度的3.21到3.87倍之间。
🔬 方法详解
问题定义:本文旨在解决现有评估方法缺乏人类基准的问题,无法判断LLM生成的IaC是否比人工编写的更差。
核心思路:通过引入GenIaC-SecBench基准,结合多种模型配置和人类模板,进行全面的安全性评估,确保比较的公正性。
技术框架:整体架构包括100个部署场景、12种模型配置、634个人工模板,以及三种独立的策略引擎(Checkov、Trivy、KICS)进行扫描。
关键创新:首次提供了匹配规模的人类安全基准,揭示了模型生成的IaC在不同复杂度任务中的漏洞密度差异。
关键设计:在实验中,采用了声明资源数量进行匹配,分析了标准生成、提示工程链式思维和供应商扩展思维API的效果,发现扩展思维显著优于提示链式思维。
🖼️ 关键图片
📊 实验亮点
实验结果表明,模型生成的IaC在简单任务中的漏洞密度高达人工的4.9倍,而在复杂任务中则缩小至1.4倍。此外,扩展思维API的表现优于提示链式思维,降低了12%的漏洞密度,显示出不同生成策略的显著差异。
🎯 应用场景
该研究为基础设施即代码的安全性评估提供了新的基准,能够帮助开发者和安全专家更好地理解和比较LLM生成代码的安全性。未来,这一基准可能推动更安全的自动化代码生成工具的发展,降低生产环境中的安全风险。
📄 摘要(原文)
Large language models are increasingly used to author Infrastructure-as-Code (IaC), where a single insecure default can be deployed directly into production. Prior evaluations report raw vulnerability counts for model-generated IaC, but without a human baseline they cannot determine whether models are actually worse than engineers. We introduce GenIaC-SecBench, a benchmark of 100 deployment scenarios stratified by architectural complexity, evaluated across 12 model configurations from four vendors, producing 1,196 IaC artifacts scanned by three independent policy engines (Checkov, Trivy, KICS). Critically, we also scan 634 human-authored IaC templates with the same toolchain, providing the first size-matched human security baseline. Vulnerability density is strongly inverse to artifact size (Spearman $ρ= -0.55$, $p < 10^{-77}$), meaning unmatched comparisons measure size rather than security. When matched on declared-resource count, all model configurations fall within 3.21x--3.87x the human vulnerability density, with the gap widening for simpler tasks (4.9x at one resource, 1.4x at twenty or more). We decompose reasoning into standard generation, prompt-engineered chain-of-thought, and vendor extended-thinking APIs. Vendor extended thinking significantly outperforms prompted chain-of-thought ($-12.0\%$, $p = 0.0013$), while prompted chain-of-thought is indistinguishable from standard generation ($-1.3\%$, n.s.). Token instrumentation shows extended thinking uses under 1\% of the output budget, explaining its bounded effect. Two negative results also emerge: deployability does not correlate with vulnerability ($r = 0.158$, $p = 0.625$), and classical complete-case Friedman testing is infeasible for realistic benchmark designs, motivating the Skillings-Mack statistic. All code, data, and regeneration scripts are released.