Vulnerabilities in pkg:pypi/ansible-vault

PACKAGE
Advisory Identifier: GHSA-c2w9-48qc-qpj4
Advisory Summary

CVE-2017-2809 is a HIGH (CVSS 7.8) code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Ansible vault libraries in the PyPI ecosystem. The issue involves code injection in ansible. Remediation is available by upgrading affected packages to version 1.0.5.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/ansible-vault

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/ansible-vault. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-c2w9-48qc-qpj4 CVE-2017-2809 HIGH Code injection in ansible

CVE-2017-2809 at a Glance

CVE Identifier CVE-2017-2809
GHSA Identifier GHSA-c2w9-48qc-qpj4
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Ansible vault
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.8

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

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

How to Fix CVE-2017-2809

To remediate this vulnerability, upgrade all affected Ansible vault 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-vault fixed: 1.0.5
pip install ansible-vault>=1.0.5
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-vault

How to Check if You Are Affected

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

pip show ansible-vault

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Ansible vault, 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

An exploitable vulnerability exists in the yaml loading functionality of ansible-vault before 1.0.5. A specially crafted vault can execute arbitrary python commands resulting in command execution. An attacker can insert python into the vault to trigger this vulnerability.

CVE-2017-2809 Affected Ansible vault Versions

1 component(s)
Fixed Versions:
1.0.5
Product / Package Ecosystem Affected Versions Fixed Version
ansible-vault
PyPI
< 1.0.5
1.0.5

References

Frequently Asked Questions

What is CVE-2017-2809?
CVE-2017-2809 is a security vulnerability in Ansible vault involving Code injection in ansible under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Ansible vault versions are affected?
Affected versions include releases prior to 1.0.5 across affected packages: ansible-vault.
What version fixes CVE-2017-2809?
Upgrading to 1.0.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ansible-vault affected?
Yes, ansible-vault is affected in releases prior to 1.0.5. Upgrade your dependency to 1.0.5 or later.
What is the CVSS score of CVE-2017-2809?
CVE-2017-2809 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2017-2809?
CVE-2017-2809 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check PyPI dependencies for CVE-2017-2809?
Run the dependency tree command: 'pip show ansible-vault'. 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-c2w9-48qc-qpj4",
  "modified" : "2024-09-03T21:23:13Z",
  "published" : "2018-07-13T15:16:54Z",
  "aliases" : [ "CVE-2017-2809" ],
  "summary" : "Code injection in ansible",
  "details" : "An exploitable vulnerability exists in the yaml loading functionality of ansible-vault before 1.0.5. A specially crafted vault can execute arbitrary python commands resulting in command execution. An attacker can insert python into the vault to trigger this vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ansible-vault"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-2809"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tomoh1r/ansible-vault/issues/4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tomoh1r/ansible-vault/commit/3f8f659ef443ab870bb19f95d43543470168ae04"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-c2w9-48qc-qpj4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/ansible-vault/PYSEC-2017-5.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tomoh1r/ansible-vault"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tomoh1r/ansible-vault/blob/v1.0.5/CHANGES.txt"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20171206173637/http://www.securityfocus.com/bid/100824"
  }, {
    "type" : "WEB",
    "url" : "https://www.talosintelligence.com/vulnerability_reports/TALOS-2017-0305"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:30:09Z",
    "nvd_published_at" : "2017-09-14T19:29:00Z"
  }
}