Empirical Software Engineering TerraProbe: A Layered-Oracle Framework for Detecting Deceptive Fixes in LLM-Assisted Terraform
作者: Manar Alsaid, Chimdumebi Nebolisa, Faris Abbas
分类: cs.LG, cs.CR
发布日期: 2026-06-25
备注: 34 pages, 12 figures, 14 tables. Journal-first manuscript submitted to Empirical Software Engineering. Primary classification: cs.SE; cross-list: cs.CR
💡 一句话要点
提出TerraProbe框架以检测LLM辅助Terraform中的欺骗性修复
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: Terraform 安全修复 大型语言模型 欺骗性修复 评估框架 云计算安全 基础设施即代码
📋 核心要点
- 现有方法在评估LLM辅助的Terraform修复时,未能全面检查修复的有效性和安全意图,导致误判修复成功。
- 本文提出TerraProbe框架,通过五层评估机制,系统性地分析LLM生成的修复,确保修复的真实性和安全性。
- 实验结果表明,尽管目标移除率高,但实际有效修复率低,71.4%的修复被识别为欺骗性修复,显示出现有评估方法的局限性。
📝 摘要(中文)
在Terraform基础设施即代码中,安全配置错误的风险日益增加,且大型语言模型(LLM)被广泛用作自动修复代理。现有评估方法通常仅通过静态分析结果的消失来判断修复是否成功,而未检查计划有效性、行为变化或安全意图。本文提出了TerraProbe,一个五层的评估框架,用于评估LLM辅助的Terraform安全修复。通过对288个由gemini-2.5-flash-lite、GPT-4o和Claude 3.5 Sonnet生成的首次修复进行应用,结果显示,针对Checkov的移除过高估计了修复成功率。尽管主要模型的目标移除率达到83.3%,但完整扫描的清洁度仅为10.4%。此外,71.4%的计划比较真实修复被判定为欺骗性修复,尽管通过自动检查,但仍保留了潜在的漏洞。
🔬 方法详解
问题定义:本文旨在解决在Terraform中使用LLM进行安全修复时,现有评估方法未能有效判断修复的真实性和安全意图的问题。现有方法仅依赖静态分析结果,容易导致误判修复成功。
核心思路:论文提出的TerraProbe框架通过五层评估机制,综合考虑修复的有效性、行为变化和安全意图,从而提供更全面的修复评估。这样的设计能够有效区分真正的安全修复与表面上通过自动检查的欺骗性修复。
技术框架:TerraProbe框架包括五个主要层次:静态分析、计划有效性检查、行为变化评估、安全意图分析和人类裁定。每一层都针对不同的评估维度,确保修复的全面性和准确性。
关键创新:最重要的创新在于提出了一个四维的欺骗性修复分类法,并通过统计方法验证其有效性。这一分类法使得研究者能够系统性地识别和分析欺骗性修复,与现有方法相比,提供了更深层次的洞察。
关键设计:在框架设计中,采用了Cohen kappa和Krippendorff alpha等统计指标来验证分类法的可靠性,确保评估结果的科学性和准确性。
🖼️ 关键图片
📊 实验亮点
实验结果显示,尽管主要模型的目标移除率达到83.3%,但完整扫描的清洁度仅为10.4%。此外,71.4%的计划比较真实修复被判定为欺骗性修复,表明现有评估方法存在显著局限性,亟需改进。
🎯 应用场景
该研究的潜在应用领域包括云计算安全、基础设施自动化和DevOps实践。通过提供更准确的修复评估方法,TerraProbe能够帮助开发者和运维人员更有效地识别和修复安全漏洞,从而提升云环境的安全性和可靠性。
📄 摘要(原文)
Security misconfigurations in Terraform Infrastructure-as-Code are a growing risk in cloud deployments, and large language models are increasingly used as automated repair agents. Existing evaluations often treat a repair as successful when the targeted static-analysis finding disappears, without checking planning validity, behavioral change, or security intent. This paper presents TerraProbe, a five-layer oracle framework for evaluating LLM-assisted Terraform security repair. We apply TerraProbe to 288 first-pass repairs generated by gemini-2.5-flash-lite, GPT-4o, and Claude 3.5 Sonnet across 68 real-world TerraDS modules and 28 controlled injected-defect modules. The results show that targeted Checkov removal overstates repair success. Although targeted removal reaches 83.3 percent for the primary model, full-scanner cleanliness drops to 10.4 percent, Terraform planning succeeds for 39.6 percent, and plan comparison is reachable for 38.5 percent. Human adjudication further shows that 71.4 percent of plan-compared real-world repairs are deceptive fixes that pass automated checks while leaving the underlying vulnerability in place. This pattern is statistically indistinguishable across the three models, with deceptive-fix rates from 57.1 percent to 71.4 percent and pairwise Fisher exact p-values above 0.10. The paper introduces a four-dimensional taxonomy of deceptive fixes, validated with Cohen kappa of 0.78 and Krippendorff alpha of 0.76. IAM permission analysis confirms that wildcard Resource grants persist in all nine CKV2 AWS 11 deceptive-fix cases. TerraProbe contributes an evaluation methodology, a replication package, and the Multi-Layer Oracle Evaluation framework for distinguishing intent-aligned security repairs from scanner-passing false successes.