CVE-2016-8628: Ansible - Command Execution Vulnerability
Summary
CVE-2016-8628: Ansible before version 2.2.0 fails to properly sanitize fact variables sent from the Ansible controller. Affects ansible versions < 2.2.0.0. Fixed in 2.2.0.0. How to fix ↓
Also tracked for
- ansible · Debian:11
The same CVE-2016-8628 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Ansible is an open-source automation tool that allows users to automate tasks such as configuration management, application deployment, and orchestration. It operates by connecting to remote machines and executing tasks using SSH or PowerShell. Ansible uses a controller machine to manage the configuration and execution of tasks on the target machines. This vulnerability affects Ansible versions prior to 2.2.0.
Vulnerability Detail
The vulnerability in Ansible arises from the improper sanitization of fact variables sent from the Ansible controller. An attacker who can create special variables on the controller can exploit this issue to execute arbitrary commands on Ansible clients. The commands will be executed with the privileges of the user Ansible runs as. This vulnerability can lead to unauthorized access, data breaches, and potential compromise of the entire infrastructure managed by Ansible.
How To Fix
Latest published version: 14.5.0 as of 22 Oct 2026
pip install --upgrade "ansible==14.5.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
2.2.0.0
This is the first release that contains the fix.
pip install --upgrade "ansible==2.2.0.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to the latest version is not immediately feasible, a temporary workaround is to manually sanitize the fact variables before using them in Ansible. This can be done by carefully validating and filtering the input to ensure that no malicious commands or code can be injected. Here is an example of how to sanitize fact variables in an Ansible playbook:
- name: Sanitize fact variables set_fact: sanitized_var: "{{ fact_var | regex_replace('[^a-zA-Z0-9]','') }}"
This playbook task uses the regex_replace filter to remove any non-alphanumeric characters from the fact_var variable, ensuring that it cannot be used to execute arbitrary commands.
Conclusion
The Ansible command execution vulnerability (CVE-2016-8628) allows attackers to execute arbitrary commands on Ansible clients. To mitigate this vulnerability, it is crucial to upgrade to Ansible version 2.2.0 or later. If immediate upgrading is not possible, manually sanitizing the fact variables can serve as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for ansible →
FAQ
This vulnerability allows an attacker to execute arbitrary commands on Ansible clients, potentially leading to unauthorized access, data breaches, and compromise of the entire infrastructure managed by Ansible.
Users of Ansible versions prior to 2.2.0 are affected by this vulnerability. It is recommended for all Ansible users to upgrade to the latest stable release to mitigate this issue.
While specific exploits targeting this vulnerability have not been disclosed, it is important to promptly apply the recommended fixes to prevent potential exploitation.
No, this vulnerability requires the ability to create special variables on the Ansible controller. However, if an attacker gains control over the controller machine, they can exploit this vulnerability to execute arbitrary commands on Ansible clients.
The CVSS score for this vulnerability has not been provided in the available information. It is advisable to consult the official CVE entry or relevant security advisories for the most accurate and up-to-date information.
Related vulnerabilities
Recent vulnerabilities recorded for ansible.