LLM-generated IaC has 3.2-3.9× higher vulnerability density than human-authored code
When matched on resource count, LLM-generated IaC exhibits 3.21x-3.87x the vulnerability density of human-authored IaC
AI/ML arXiv 28 Aug 2026 Benchmark Maturity unclear
Published as “Compared to What? A Human-Anchored Security Benchmark for LLM-Generated Infrastructure-as-Code”
Why it matters
Practitioners should treat LLM-generated IaC as substantially more vulnerable than human-written IaC and consider additional security review or mitigation when using AI assistants for infrastructure code.
Summary
LLM-generated IaC contains about 3.2×-3.9× more vulnerability findings per resource than a human-authored baseline when matched on artifact size. The study scans 1,196 generated templates and 634 human templates with three independent policy engines, showing the gap is largest on the simplest tasks and consistent across vendors and reasoning modes. Reasoning extensions (vendor extended thinking) modestly reduce findings (-13.2%, p=0.012) while prompted chain-of-thought shows no benefit. The evidence is strong for the overall density gap but qualified by non-significant differences on large templates and limited statistical power for some contrasts.
What they found 2
- LLM-generated IaC is consistently less secure than human-authored IaC, with every model configuration 3.21×-3.87× the human baseline.
“Aggregating per configuration over shared strata (Fig. 4) yields a strikingly narrow band: every configuration lies between 3.21× and 3.87× the human baseline.”
- Vendor extended-thinking reduces vulnerability density relative to standard generation.
“Vendor extended thinking reduces density relative to standard generation (-13.2%, p = 0.012)”
Caveats 7
- The density gap shrinks to 1.4× and is not statistically significant for templates with twenty or more resources (p = 0.058).
- Prompted chain-of-thought alone is statistically indistinguishable from standard generation (-1.3%, p = 0.238).
- Schema-validity pass rate and vulnerability density are uncorrelated (r = 0.158, p = 0.625), contradicting a hypothesised validity-security trade-off.
- The human corpus is not a matched control: those templates were not written against our scenarios, and many are curated examples rather than production infrastructure.
- Vendor reasoning mechanisms also differ (token budget versus effort level) and are not pooled.
- Statistical power for the paired reasoning contrasts is limited (n ≤60), and only two model families expose reasoning arms.
- Checkov does not emit severity tiers without a commercial subscription, so severity analysis reflects
What’s new here 4
- Provides a size-matched human security baseline for IaC, enabling meaningful comparisons.
- Separates and evaluates two reasoning mechanisms: prompt-engineered chain-of-thought and vendor-provided extended thinking.
- Applies the Skillings-Mack test to handle incomplete-block benchmark designs where traditional Friedman tests fail.
- Calibrates an LLM-based judge against three human security experts to assess automated evaluation reliability.