CVE-2019-14905: Ansible Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-frxj-5j27-f8rf
CVSS 5.6
CWE-668 CWE-20 CWE-610 CWE-73
Published
Advisory Summary

CVE-2019-14905 is a HIGH (CVSS 5.6) remote code execution vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Ansible libraries in the PyPI ecosystem. The issue involves externally controlled reference to a resource in another sphere, improper input validation, and external control of file name or path in ansible. Remediation is available by upgrading affected packages to version 2.7.16, 2.8.8, 2.9.3.

CVE-2019-14905 at a Glance

CVE Identifier CVE-2019-14905
GHSA Identifier GHSA-frxj-5j27-f8rf
Severity HIGH
CVSS v3.1 Base Score 5.6
CWE Classification CWE-668: Exposure of Resource to Wrong Sphere
Affected Product Ansible
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.6

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:U/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 Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2019-14905

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-14905, 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-668: Exposure of Resource to Wrong Sphere, where the product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource. 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 vulnerability was found in Ansible Engine versions 2.9.x before 2.9.3, 2.8.x before 2.8.8, 2.7.x before 2.7.16 and earlier, where in Ansible's nxos_file_copy module can be used to copy files to a flash or bootflash on NXOS devices. Malicious code could craft the filename parameter to perform OS command injections. This could result in a loss of confidentiality of the system among other issues.

CVE-2019-14905 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.0a1
< 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-14905?
CVE-2019-14905 is a security vulnerability in Ansible involving Externally Controlled Reference to a Resource in Another Sphere, Improper Input Validation, and External Control of File Name or Path in Ansible under CWE-668: Exposure of Resource to Wrong Sphere.
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-14905?
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-14905?
CVE-2019-14905 has a CVSS v3.1 base score of 5.6 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:L/A:L.
What CWE is associated with CVE-2019-14905?
CVE-2019-14905 is classified under CWE-668: Exposure of Resource to Wrong Sphere (The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.).
How can I check PyPI dependencies for CVE-2019-14905?
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-frxj-5j27-f8rf",
  "modified" : "2024-11-18T16:26:11Z",
  "published" : "2021-04-20T16:44:49Z",
  "aliases" : [ "CVE-2019-14905" ],
  "summary" : "Externally Controlled Reference to a Resource in Another Sphere, Improper Input Validation, and External Control of File Name or Path in Ansible",
  "details" : "A vulnerability was found in Ansible Engine versions 2.9.x before 2.9.3, 2.8.x before 2.8.8, 2.7.x before 2.7.16 and earlier, where in Ansible's nxos_file_copy module can be used to copy files to a flash or bootflash on NXOS devices. Malicious code could craft the filename parameter to perform OS command injections. This could result in a loss of confidentiality of the system among other issues.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:L/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ansible"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.7.0a1"
      }, {
        "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-14905"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2020:0216"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2020:0218"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-14905"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-frxj-5j27-f8rf"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ansible/ansible"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/ansible/PYSEC-2020-206.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5BNCYPQ4BY5QHBCJOAOPANB5FHATW2BR"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2020-04/msg00021.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2020-04/msg00026.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-610", "CWE-668", "CWE-73" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-05T14:41:23Z",
    "nvd_published_at" : "2020-03-31T17:15:00Z"
  }
}