跳转至

文章背景与核心概要

随着大语言模型(LLM)越来越多地用于自动化创建基础设施即代码(Infrastructure-as-Code, IaC),任何一个不安全的默认配置都可能将灾难性的漏洞直接引入生产环境中。此前的安全评估大多依赖于模型生成代码的原始漏洞数量,而没有建立人类基准(human baseline),这使得人们无法判断LLM的表现是否真的比人类工程师更差。

为了填补这一空白,本文推出了 GenIaC-SecBench,这是一个包含100个按架构复杂度分层的部署场景的综合评测基准。该基准评估了来自四个供应商的12种模型配置,分析了通过三个独立策略引擎(Checkov、Trivy和KICS)扫描的1,196个IaC构件。更为关键的是,该研究还使用完全相同的工具链扫描了634个由人类编写的IaC模板,从而提供了首个规模匹配的人类安全基准。


相比于谁?大语言模型生成基础设施即代码(IaC)的人类锚定安全基准

Compared to What? A Human-Anchored Security Benchmark for LLM-Generated Infrastructure-as-Code

  • 作者: Animesh Shaw
  • 提交时间: 2026年8月28日
  • 主要主题: 密码学与安全 (cs.CR)
  • 次要主题: 人工智能 (cs.AI)、多智能体系统 (cs.MA)、软件工程 (cs.SE)
  • arXiv ID: 2608.28021
  • DOI: 10.48550/arXiv.2608.28021

📌 摘要

📌 Summary

随着大语言模型(LLM)越来越多地用于自动化创建基础设施即代码(IaC),任何一个不安全的默认配置都可能将灾难性的漏洞直接引入生产环境中。此前的安全评估大多依赖于模型生成代码的原始漏洞数量,而没有建立人类基准,这使得人们无法判断LLM的表现是否真的比人类工程师更差。

As large language models (LLMs) increasingly automate the creation of Infrastructure-as-Code (IaC), a single insecure default can introduce catastrophic vulnerabilities directly into production environments. Prior security evaluations have largely relied on raw vulnerability counts for model-generated code without establishing a human baseline, making it impossible to determine whether LLMs actually perform worse than human engineers.

为了填补这一空白,本文推出了 GenIaC-SecBench,这是一个包含100个按架构复杂度分层的部署场景的综合评测基准。该基准评估了来自四个供应商的12种模型配置,分析了通过三个独立策略引擎(Checkov、Trivy和KICS)扫描的1,196个IaC构件。更为关键的是,该研究还使用完全相同的工具链扫描了634个由人类编写的IaC模板,从而提供了首个规模匹配的人类安全基准。

To address this gap, this paper introduces GenIaC-SecBench, a comprehensive benchmark comprising 100 deployment scenarios stratified by architectural complexity. The benchmark evaluates 12 model configurations across four vendors, analyzing 1,196 IaC artifacts scanned via three independent policy engines (Checkov, Trivy, and KICS). Crucially, the study also scans 634 human-authored IaC templates using the exact same toolchain, providing the first size-matched human security baseline.


🔑 核心发现

🔑 Key Findings

  1. 漏洞指标中的规模偏差: 漏洞密度与构件规模呈强反比(\(\rho = -0.55\), \(p < 10^{-77}\)),这意味着未匹配的比较实际上是在衡量代码规模,而非真正的安全性。当按声明的资源数量进行匹配时,所有模型配置的漏洞密度始终稳定在人类漏洞密度的 3.21倍至3.87倍 之间。有趣的是,对于较简单的任务,安全差距反而更大(对于单个资源为 4.9倍,而对于二十个或更多资源则为 1.4倍)。

    1. Size Bias in Vulnerability Metrics: Vulnerability density is strongly inverse to artifact size (\(\rho = -0.55\), \(p < 10^{-77}\)), meaning unmatched comparisons measure code size rather than true security. When matched on declared-resource count, all model configurations consistently fall within 3.21x to 3.87x the human vulnerability density. Interestingly, the security gap widens for simpler tasks (4.9x for a single resource versus 1.4x for twenty or more resources).
  2. 推理策略对比: 本研究将推理过程分解为标准生成、提示工程思维链(CoT)以及供应商扩展思考(extended-thinking)API。供应商的扩展思考显著优于提示词CoT(\(-12.0\%\), \(p = 0.0013\)),而提示词CoT的表现与标准生成无异(\(-1.3\%\),无统计学意义)。Token计量表明,扩展思考使用的输出预算不足1%,这解释了其效果受限的原因。

    1. Reasoning Strategies Compared: The study decomposes reasoning into standard generation, prompt-engineered Chain-of-Thought (CoT), and vendor extended-thinking APIs. Vendor extended thinking significantly outperforms prompted CoT (\(-12.0\%\), \(p = 0.0013\)), whereas prompted CoT performs indistinguishably from standard generation (\(-1.3\%\), not significant). Token instrumentation reveals that extended thinking uses under 1% of the output budget, explaining its bounded effect.
  3. 阴性结果(Negative Results):

  4. 可部署性与漏洞之间没有相关性(\(r = 0.158\), \(p = 0.625\))。
  5. 传统的完整案例弗里德曼测试(complete-case Friedman testing)对于现实世界的基准设计而言不可行,这促使研究采用了 Skillings-Mack 统计量
    1. Negative Results:
    2. Deployability does not correlate with vulnerability (\(r = 0.158\), \(p = 0.625\)).
    3. Classical complete-case Friedman testing is infeasible for realistic benchmark designs, motivating the adoption of the Skillings-Mack statistic.

📦 构件与资源

📦 Artifacts & Resources

所有代码、数据集和复现脚本均已公开: * 代码仓库: GitHub - AnimeshShaw/GenIaC-SecBench * 数据集: Hugging Face - GenIaC-SecBench Dataset

All code, datasets, and regeneration scripts are publicly available: * Code Repository: GitHub - AnimeshShaw/GenIaC-SecBench * Dataset: Hugging Face - GenIaC-SecBench Dataset


📄 全文链接与引用工具

license icon