CVE-2016-8628: Ansible - Command Execution Vulnerability

ansible Updated 02 Oct 2025

Summary

31/07/2018
Yes i
Critical
9.1

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

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.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

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 →

Share this vulnerability

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.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback