Skip to main content
QUICK REVIEW

[论文解读] Security Smells in Ansible and Chef Scripts: A Replication Study

Akond Rahman, Md Rayhanur Rahman|arXiv (Cornell University)|Jul 16, 2019
Software Engineering Research参考文献 45被引用 6
一句话总结

本复制研究通过定性分析和自研静态分析工具 SLAC,识别了 Ansible 和 Chef 基础设施即代码(IaC)脚本中的安全气味——重复出现的不安全编码模式。研究发现了两种新型气味(case 语句中缺少默认值、无完整性校验),在 50,323 个脚本中检测到 46,600 个安全气味实例(包括 7,849 个硬编码密码),并通过 65/94 个确认的漏洞报告验证了其在实践中的相关性。

ABSTRACT

Context: Security smells are recurring coding patterns that are indicative of security weakness, and require further inspection. As infrastructure as code (IaC) scripts, such as Ansible and Chef scripts, are used to provision cloud-based servers and systems at scale, security smells in IaC scripts could be used to enable malicious users to exploit vulnerabilities in the provisioned systems. Goal: The goal of this paper is to help practitioners avoid insecure coding practices while developing infrastructure as code scripts through an empirical study of security smells in Ansible and Chef scripts. Methodology: We conduct a replication study where we apply qualitative analysis with 1,956 IaC scripts to identify security smells for IaC scripts written in two languages: Ansible and Chef. We construct a static analysis tool called Security Linter for Ansible and Chef scripts (SLAC) to automatically identify security smells in 50,323 scripts collected from 813 open source software repositories. We also submit bug reports for 1,000 randomly-selected smell occurrences. Results: We identify two security smells not reported in prior work: missing default in case statement and no integrity check. By applying SLAC we identify 46,600 occurrences of security smells that include 7,849 hard-coded passwords. We observe agreement for 65 of the responded 94 bug reports, which suggests the relevance of security smells for Ansible and Chef scripts amongst practitioners. Conclusion: We observe security smells to be prevalent in Ansible and Chef scripts, similar to that of the Puppet scripts. We recommend practitioners to rigorously inspect the presence of the identified security smells in Ansible and Chef scripts using (i) code review, and (ii) static analysis tools.

研究动机与目标

  • 识别并验证 Ansible 和 Chef 基础设施即代码脚本中的安全气味,扩展先前针对 Puppet 的研究工作。
  • 评估在广泛使用的 IaC 语言中(超越 Puppet)安全气味的普遍性及其在现实世界中的相关性。
  • 开发并评估一个静态分析工具(SLAC),用于自动检测 Ansible 和 Chef 脚本中的安全气味。
  • 探究 IaC 脚本中的安全气味是否与已知的安全弱点(CWE)相关联,并被开发者所认知。
  • 通过代码审查和静态分析支持 DevSecOps 实践,实现在 IaC 流程中早期检测不安全配置。

提出的方法

  • 对 1,956 个 Ansible 和 Chef 脚本进行定性复制研究,使用开放式编码识别重复出现的不安全模式。
  • 基于识别出的安全气味,手工编写规则,构建静态分析工具 SLAC(Ansible 和 Chef 安全检查器)。
  • 将 SLAC 应用于从 813 个开源仓库收集的 50,323 个脚本,大规模检测安全气味。
  • 为检测到的气味实例生成 1,000 个随机漏洞报告,并通过开发者反馈评估其相关性。
  • 使用双评估者和一名志愿者评估者,以减少在基准数据集构建中的偏差并提高检测准确性。
  • 将检测到的气味映射到通用弱点枚举(CWE),以验证其安全相关性(例如,完整性检查对应 CWE-494)。

实验结果

研究问题

  • RQ1Ansible 和 Chef 基础设施即代码脚本中存在哪些重复出现的安全气味?
  • RQ2在 Ansible 和 Chef 中识别出的安全气味与先前在 Puppet 脚本中发现的气味有何异同?
  • RQ3IaC 脚本中的安全气味在多大程度上对应已知的安全弱点(CWE)?
  • RQ4SLAC 静态分析工具在大规模真实脚本中检测安全气味的有效性如何?
  • RQ5开发者是否认可并认同安全气味报告,表明其具有现实世界的相关性?

主要发现

  • 发现了两种新型安全气味:'case 语句中缺少默认值' 和 '无完整性校验',此前未在相关研究中报告过。
  • SLAC 在 50,323 个 Ansible 和 Chef 脚本中检测到 46,600 个安全气味实例,其中 '硬编码密钥' 是最普遍的气味。
  • 在检测到的气味中,有 7,849 个实例涉及硬编码密码,凸显了 IaC 实践中的重大安全风险。
  • 在提交的 94 个漏洞报告中,有 65 个被开发者确认,表明所识别的气味具有较强的现实相关性和实际适用性。
  • 研究证实,安全气味在 Ansible 和 Chef 脚本中普遍存在,与 Puppet 脚本中的情况相似。
  • 研究结果支持通过代码审查和自动化静态分析工具(如 SLAC)主动检测并缓解 IaC 流程中的不安全配置。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。