# CVE-2016-9587: Ansible is vulnerable to an improper input validation in Ansible's handling of data sent from client systems

> An attacker controlling a managed client can send malicious facts to the Ansible server, leading to arbitrary code execution with server privileges.

- **Severity:** Medium 6.6 (`CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 24 Apr 2018
- **Updated:** 6 Aug 2024
- **Also known as:** ALPINE-CVE-2016-9587, DEBIAN-CVE-2016-9587, GHSA-m956-frf4-m2wr, PYSEC-2018-39, RHSA-2017:0195, RHSA-2017:0260, RHSA-2017:0448, RHSA-2017:0515, UBUNTU-CVE-2016-9587

## What is CVE-2016-9587?

CVE-2016-9587 is a medium-severity code injection vulnerability in Redhat Openstack, published on 24 Apr 2018. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

Ansible before versions 2.1.4, 2.2.1 is vulnerable to an improper input validation in Ansible's handling of data sent from client systems. An attacker with control over a client system being managed by Ansible and the ability to send facts back to the Ansible server could use this flaw to execute arbitrary code on the Ansible server using the Ansible server privileges.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2016-9587?

5 open source packages ship an affected version, including ansible. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `ansible` | PyPI | All versions | 2.1.4.0, 2.2.1.0 |
| `ansible` | PyPI | All versions | 2.1.4.0 |
| `ansible` | PyPI | All versions | 2.1.4.0 |
| `ansible` | PyPI | From 2.2.0.0 | 2.2.1.0 |
| `ansible` | PyPI | From 2.2.0.0 | 2.2.1.0 |
| `ansible` | Red Hat:openshift:3.2::el7 | All versions | 0:2.2.1.0-2.el7 |
| `atomic-openshift-utils` | Red Hat:openshift:3.2::el7 | All versions | 0:3.2.53-1.git.0.2fefc17.el7 |
| `openshift-ansible` | Red Hat:openshift:3.2::el7 | All versions | 0:3.2.53-1.git.0.2fefc17.el7 |
| `openshift-ansible-docs` | Red Hat:openshift:3.2::el7 | All versions | 0:3.2.53-1.git.0.2fefc17.el7 |
| `openshift-ansible-filter-plugins` | Red Hat:openshift:3.2::el7 | All versions | 0:3.2.53-1.git.0.2fefc17.el7 |
| `openshift-ansible-lookup-plugins` | Red Hat:openshift:3.2::el7 | All versions | 0:3.2.53-1.git.0.2fefc17.el7 |
| `openshift-ansible-playbooks` | Red Hat:openshift:3.2::el7 | All versions | 0:3.2.53-1.git.0.2fefc17.el7 |
| `openshift-ansible-roles` | Red Hat:openshift:3.2::el7 | All versions | 0:3.2.53-1.git.0.2fefc17.el7 |
| `ansible` | Red Hat:openshift:3.3::el7 | All versions | 0:2.2.1.0-2.el7 |
| `atomic-openshift-utils` | Red Hat:openshift:3.3::el7 | All versions | 0:3.3.67-1.git.0.7c5da0c.el7 |
| `openshift-ansible` | Red Hat:openshift:3.3::el7 | All versions | 0:3.3.67-1.git.0.7c5da0c.el7 |
| `openshift-ansible-callback-plugins` | Red Hat:openshift:3.3::el7 | All versions | 0:3.3.67-1.git.0.7c5da0c.el7 |
| `openshift-ansible-docs` | Red Hat:openshift:3.3::el7 | All versions | 0:3.3.67-1.git.0.7c5da0c.el7 |
| `openshift-ansible-filter-plugins` | Red Hat:openshift:3.3::el7 | All versions | 0:3.3.67-1.git.0.7c5da0c.el7 |
| `openshift-ansible-lookup-plugins` | Red Hat:openshift:3.3::el7 | All versions | 0:3.3.67-1.git.0.7c5da0c.el7 |
| `openshift-ansible-playbooks` | Red Hat:openshift:3.3::el7 | All versions | 0:3.3.67-1.git.0.7c5da0c.el7 |
| `openshift-ansible-roles` | Red Hat:openshift:3.3::el7 | All versions | 0:3.3.67-1.git.0.7c5da0c.el7 |
| `ansible` | Red Hat:openshift:3.4::el7 | All versions | 0:2.2.1.0-2.el7 |
| `atomic-openshift-utils` | Red Hat:openshift:3.4::el7 | All versions | 0:3.4.67-1.git.0.14a0b4d.el7 |
| `openshift-ansible` | Red Hat:openshift:3.4::el7 | All versions | 0:3.4.67-1.git.0.14a0b4d.el7 |
| `openshift-ansible-callback-plugins` | Red Hat:openshift:3.4::el7 | All versions | 0:3.4.67-1.git.0.14a0b4d.el7 |
| `openshift-ansible-docs` | Red Hat:openshift:3.4::el7 | All versions | 0:3.4.67-1.git.0.14a0b4d.el7 |
| `openshift-ansible-filter-plugins` | Red Hat:openshift:3.4::el7 | All versions | 0:3.4.67-1.git.0.14a0b4d.el7 |
| `openshift-ansible-lookup-plugins` | Red Hat:openshift:3.4::el7 | All versions | 0:3.4.67-1.git.0.14a0b4d.el7 |
| `openshift-ansible-playbooks` | Red Hat:openshift:3.4::el7 | All versions | 0:3.4.67-1.git.0.14a0b4d.el7 |
| `openshift-ansible-roles` | Red Hat:openshift:3.4::el7 | All versions | 0:3.4.67-1.git.0.14a0b4d.el7 |
| `ansible` | Red Hat:openstack:10::el7 | All versions | 0:2.2.1.0-1.el7 |
| `ansible` | Red Hat:rhscon:2::el7 | All versions | 0:2.2.1.0-1.el7 |
| `ceph-ansible` | Red Hat:rhscon:2::el7 | All versions | 0:2.1.9-1.el7scon |
| `ceph-installer` | Red Hat:rhscon:2::el7 | All versions | 0:1.2.2-1.el7scon |
| `python-passlib` | Red Hat:rhscon:2::el7 | All versions | 0:1.6.5-1.1.el7 |
| `ansible` | Red Hat:storage:3.1:server:el7 | All versions | 0:2.2.1.0-2.el7 |
| `gdeploy` | Red Hat:storage:3.1:server:el7 | All versions | 0:2.0.1-8.el7rhgs |
| `python-passlib` | Red Hat:storage:3.1:server:el7 | All versions | 0:1.6.5-1.el7 |
| `python2-passlib` | Red Hat:storage:3.1:server:el7 | All versions | 0:1.6.5-1.el7 |

Products: Ansible Ansible, Redhat Ansible, Redhat Openstack.

## How do I fix CVE-2016-9587?

Upgrade ansible to a fixed version for your release line: 2.1.4.0 or 2.2.1.0.

## Is CVE-2016-9587 being exploited?

There is no known exploitation of CVE-2016-9587 in the wild and no public exploit code.

Public exploit code:

- Ansible 2.1.4/2.2.1 - Command Execution (exploitdb)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2016-9587 and fix it if it is affected.

What it is: CVE-2016-9587 is a medium-severity code injection vulnerability in Redhat Openstack, published on 24 Apr 2018. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2016-9587 in the wild and no public exploit code.

Affected packages and fixed versions:
- ansible (PyPI): affected all versions; fixed in 2.1.4.0, 2.2.1.0
- ansible (PyPI): affected all versions; fixed in 2.1.4.0
- ansible (PyPI): affected all versions; fixed in 2.1.4.0
- ansible (PyPI): affected from 2.2.0.0; fixed in 2.2.1.0
- ansible (PyPI): affected from 2.2.0.0; fixed in 2.2.1.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2016-9587/ (Markdown: https://insights.sbomify.com/CVE-2016-9587/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2016-9587
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2016-9587
- OSV: https://osv.dev/vulnerability/CVE-2016-9587

---
From sbomify Insights: https://insights.sbomify.com/CVE-2016-9587/
Summaries are generated and may contain mistakes; the official description above is the record.
