[Paper Review] Security Smells in Ansible and Chef Scripts: A Replication Study
This replication study identifies security smells—recurring insecure coding patterns—in Ansible and Chef infrastructure-as-code scripts using qualitative analysis and a custom static analysis tool, SLAC. It discovers two novel smells (missing default in case statement and no integrity check), detects 46,600 security smell instances (including 7,849 hard-coded passwords) across 50,323 scripts, and confirms practitioner relevance through 65/94 confirmed bug reports.
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.
Motivation & Objective
- To identify and validate security smells in Ansible and Chef infrastructure-as-code scripts, extending prior work on Puppet.
- To assess the prevalence and real-world relevance of security smells in widely used IaC languages beyond Puppet.
- To develop and evaluate a static analysis tool (SLAC) for automated detection of security smells in Ansible and Chef scripts.
- To investigate whether security smells in IaC scripts correlate with known security weaknesses (CWEs) and are recognized by practitioners.
- To support DevSecOps practices by enabling early detection of insecure configurations through code review and static analysis.
Proposed method
- Conducted a qualitative replication study on 1,956 Ansible and Chef scripts using open coding to identify recurring insecure patterns.
- Constructed a static analysis tool, SLAC (Security Linter for Ansible and Chef), using hand-crafted rules based on identified security smells.
- Applied SLAC to analyze 50,323 scripts collected from 813 open-source repositories to detect security smells at scale.
- Generated 1,000 random bug reports for detected smell instances and evaluated practitioner feedback to validate relevance.
- Used dual raters and a volunteer rater to reduce bias in oracle dataset construction and improve detection accuracy.
- Mapped detected smells to Common Weakness Enumerations (CWEs) to validate their security relevance (e.g., CWE-494 for integrity checks).
Experimental results
Research questions
- RQ1What are the recurring security smells present in Ansible and Chef infrastructure-as-code scripts?
- RQ2How do the identified security smells in Ansible and Chef compare to those previously found in Puppet scripts?
- RQ3To what extent do security smells in IaC scripts correspond to known security weaknesses (CWEs)?
- RQ4How effective is the SLAC static analysis tool in detecting security smells across a large corpus of real-world scripts?
- RQ5Do practitioners recognize and agree with the security smell reports, indicating real-world relevance?
Key findings
- Two novel security smells were discovered: 'missing default in case statement' and 'no integrity check', not previously reported in prior work.
- SLAC detected 46,600 security smell occurrences across 50,323 Ansible and Chef scripts, with 'hard-coded secret' being the most prevalent smell.
- Among the detected smells, 7,849 instances involved hard-coded passwords, highlighting a critical security risk in IaC practices.
- Of 94 submitted bug reports, 65 were confirmed by practitioners, indicating strong relevance and real-world applicability of the identified smells.
- The study confirms that security smells are prevalent in Ansible and Chef scripts, similar to their prevalence in Puppet scripts.
- The findings support the use of both code review and automated static analysis tools like SLAC to proactively detect and mitigate insecure configurations in IaC pipelines.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.