Manuscript Offprint

arXiv:2608.28021

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

Animesh Shaw

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Animesh Shaw

animesh15b@iimk.edu.in

Abstract—Large language models are increasingly used to author Infrastructure-as-Code (IaC), where a single insecure default is provisioned directly into a production cloud environment. Prior evaluations report absolute vulnerability counts for model-generated IaC, but without a human reference they cannot say whether models are actually worse than the engineers they assist. We present GenIaC-SecBench, a benchmark of 100 deployment scenarios stratified by architectural complexity, evaluated across 12 model configurations spanning four vendors and both open and closed weights, yielding 1,196 generated artifacts scanned by three independent policy engines (Checkov, Trivy, KICS) at complete coverage. Crucially, we scan a corpus of 634 human-authored IaC templates with the identical toolchain, providing the first size-matched human security baseline for this task. We find that vulnerability density is strongly inverse to artifact size (Spearman ρ=−0.55\rho = -0.55, p<10−77p < 10^{-77}), so unmatched comparisons measure artifact size rather than security. Matched on declared-resource count, every model configuration falls in a narrow band of 3.21×−3.87×3.21 \times -3.87 \times the human vulnerability density, and the gap widens as tasks get simpler ( 4.9×4.9 \times at one resource, 1.4×1.4 \times at twenty or more). We further decompose “reasoning” into three arms—standard generation, prompt-engineered chain-of-thought, and the vendor’s own extended-thinking API—and show that vendor extended thinking significantly outperforms prompted chain-of-thought ( −12.0%-12.0\%, p=0.0013p = 0.0013), while prompted chain-of-thought alone is indistinguishable from standard generation ( −1.3%-1.3\%, n.s.). Instrumenting token usage reveals why the effect is bounded: extended thinking consumes under 1% of the output budget on this task class. We also report two negative results: the intuitive hypothesis that more deployable models are more vulnerable is unsupported ( r=0.158r = 0.158, p=0.625p = 0.625), and classical complete-case Friedman testing is uncomputable on realistic benchmark designs, motivating the Skillings–Mack statistic. All code, data, and regeneration scripts are released.

Index Terms—infrastructure as code, large language models, software security, empirical software engineering, static analysis, cloud security

I. INTRODUCTION

Infrastructure-as-Code (IaC) tools such as Terraform, AWS CloudFormation, Azure Resource Manager, and Kubernetes manifests declare cloud infrastructure as version-controlled artifacts. A misconfiguration in an IaC template is not a latent code defect: it is provisioned, and the resulting storage bucket, security group, or IAM role is exposed exactly as written. Security smells in IaC are both common and consequential [1], [2].

Large language models now generate substantial volumes of such code. A body of work has established that LLM-generated application code contains vulnerabilities at non-trivial rates [3]–[5], and that developers using AI assistants may write less secure code while believing the opposite [6]. Evaluations specific to IaC are newer and thinner [7].

A recurring limitation unites these studies: they report absolute or normalized vulnerability counts for models only. Reporting that a model averages eight findings per declared resource invites the immediate question compared to what? Without a human reference measured through the same toolchain, such numbers cannot distinguish three very different worlds: models being genuinely careless, models simply emitting more infrastructure per file, or a scanner ruleset that flags any template heavily. This paper supplies the missing anchor.

References (36)

  • The seven sins: Security smells in infrastructure as code scripts
  • Exploring security practices in infrastructure as code: An empirical study
  • Asleep at the keyboard? assessing the security of GitHub Copilot’s code contributions
  • Lost at C: A user study on the security implications of large language model code assistants
  • How secure is AI-generated code: A large-scale comparison of large language models
  • Do users write more insecure code with AI assistants?
  • Security-first evaluation of text-to-Terraform generation (opens arXiv in a new tab)
  • On the use of a Friedman-type statistic in balanced and unbalanced block designs
  • SecurityEval dataset: Mining vulnerability examples to evaluate machine learning-based code generation techniques
  • Is your code generated by ChatGPT really correct? rigorous evaluation of large language models for code generation
  • GLITCH: Automated polyglot security smell detection in infrastructure as code
  • A systematic mapping study of infrastructure as code research
  • Checkov: Policy-as-code for infrastructure as code
  • Trivy: Comprehensive security scanner
  • KICS: Keeping infrastructure as code secure
  • CIS benchmarks
  • Chain-of-thought prompting elicits reasoning in large language models
  • Large language models are zero-shot reasoners
  • To CoT or not to CoT? chain-of-thought helps mainly on math and symbolic reasoning
  • Learning to reason with LLMs
  • DeepSeek-R1 incentivizes reasoning in LLMs through reinforcement learning
  • Extended thinking
  • Judging LLM-as-a-judge with MT-Bench and Chatbot Arena
  • A Survey on LLM-as-a-Judge
  • LLM evaluators recognize and favor their own generations
  • Empirical standards for software engineering research (opens arXiv in a new tab)
  • The use of ranks to avoid the assumption of normality implicit in the analysis of variance
  • Individual comparisons by ranking methods
  • A simple sequentially rejective multiple test procedure
  • Statistical comparisons of classifiers over multiple data sets
  • Longitudinal data analysis using generalized linear models
  • On a test of whether one of two random variables is stochastically larger than the other
  • The Kolmogorov-Smirnov test for goodness of fit
  • Measuring nominal scale agreement among many raters
  • The measurement of observer agreement for categorical data
  • A coefficient of agreement for nominal scales