CVE-2019-14904: Ansible OS Command Injection And Improper Vulnerability

HIGH
Advisory Identifier: GHSA-gwr8-5j83-483c
CVSS 7.3
CWE-78 CWE-20
Published
Advisory Summary

CVE-2019-14904 is a HIGH (CVSS 7.3) os command injection and improper vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Ansible libraries in the PyPI ecosystem. The issue involves os command injection and improper input validation in ansible. Remediation is available by upgrading affected packages to version 2.7.16, 2.8.8, 2.9.3.

CVE-2019-14904 at a Glance

CVE Identifier CVE-2019-14904
GHSA Identifier GHSA-gwr8-5j83-483c
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Ansible
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:L/A:L).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2019-14904

To remediate this vulnerability, upgrade all affected Ansible dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ansible fixed: 2.7.16
pip install ansible>=2.7.16
ansible fixed: 2.8.8
pip install ansible>=2.8.8
ansible fixed: 2.9.3
pip install ansible>=2.9.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show ansible

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2019-14904, inspect your installed packages using pip:

pip show ansible

Analyze the terminal output to locate any version of Ansible in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.16), your application is affected.

Note: The pip show ansible command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Ansible, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A flaw was found in the solaris_zone module from the Ansible Community modules. When setting the name for the zone on the Solaris host, the zone name is checked by listing the process with the 'ps' bare command on the remote machine. An attacker could take advantage of this flaw by crafting the name of the zone and executing arbitrary commands in the remote host. Ansible Engine 2.7.15, 2.8.7, and 2.9.2 as well as previous versions are affected.

CVE-2019-14904 Affected Ansible Versions

3 component(s)
Fixed Versions:
2.7.162.8.82.9.3
Product / Package Ecosystem Affected Versions Fixed Version
ansible
PyPI
< 2.7.16
2.7.16
ansible
PyPI
≥ 2.8.0a1
< 2.8.8
2.8.8
ansible
PyPI
≥ 2.9.0a1
< 2.9.3
2.9.3

References

Frequently Asked Questions

What is CVE-2019-14904?
CVE-2019-14904 is a security vulnerability in Ansible involving OS Command Injection and Improper Input Validation in ansible under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Ansible versions are affected?
Affected versions include releases prior to 2.7.16, 2.8.8, 2.9.3 across affected packages: ansible.
What version fixes CVE-2019-14904?
Upgrading to 2.7.16, 2.8.8, 2.9.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ansible affected?
Yes, ansible is affected in releases prior to 2.7.16, 2.8.8, 2.9.3. Upgrade your dependency to 2.7.16, 2.8.8, 2.9.3 or later.
What is the CVSS score of CVE-2019-14904?
CVE-2019-14904 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:L/A:L.
What CWE is associated with CVE-2019-14904?
CVE-2019-14904 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check PyPI dependencies for CVE-2019-14904?
Run the dependency tree command: 'pip show ansible'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gwr8-5j83-483c",
  "modified" : "2024-09-06T20:14:42Z",
  "published" : "2021-04-20T16:44:22Z",
  "aliases" : [ "CVE-2019-14904" ],
  "summary" : "OS Command Injection and Improper Input Validation in ansible",
  "details" : "A flaw was found in the solaris_zone module from the Ansible Community modules. When setting the name for the zone on the Solaris host, the zone name is checked by listing the process with the 'ps' bare command on the remote machine. An attacker could take advantage of this flaw by crafting the name of the zone and executing arbitrary commands in the remote host. Ansible Engine 2.7.15, 2.8.7, and 2.9.2 as well as previous versions are affected.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:H/UI:N/VC:H/VI:L/VA:L/SC:H/SI:L/SA:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ansible"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.7.16"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ansible"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.0a1"
      }, {
        "fixed" : "2.8.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ansible"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.9.0a1"
      }, {
        "fixed" : "2.9.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-14904"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ansible/ansible/pull/65686"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ansible/ansible/commit/589a415f887b6f2bb65cd07fe6b2e9d0a8156b69"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ansible/ansible/commit/6a86650109b8654f5898369e45d3857624edf907"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ansible/ansible/commit/a1b0f72c98b4b2afaab8aafa255e82c2075049c8"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1776944"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-gwr8-5j83-483c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ansible/ansible"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/ansible/PYSEC-2020-161.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2021/01/msg00023.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2021/dsa-4950"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-05T13:24:57Z",
    "nvd_published_at" : "2020-08-26T03:15:00Z"
  }
}