CVE-2023-4237: Ansible core Ansible May Expose Private Key Vulnerability

MODERATE
Advisory Identifier: GHSA-ww3m-ffrm-qvqv
CVSS 6.5
CWE-497
Published
Advisory Summary

CVE-2023-4237 is a MODERATE (CVSS 6.5) ansible may expose private key vulnerability (CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere) affecting Ansible core libraries in the PyPI ecosystem. The issue involves ansible may expose private key. Remediation is available in the latest vendor maintenance releases.

CVE-2023-4237 at a Glance

CVE Identifier CVE-2023-4237
GHSA Identifier GHSA-ww3m-ffrm-qvqv
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere
Affected Product Ansible core
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

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:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
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-2023-4237

To remediate this vulnerability, upgrade all affected Ansible core 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-core fixed: Latest secure release
pip install ansible-core>=Latest secure release
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-core

How to Check if You Are Affected

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

pip show ansible-core

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere, where the product does not properly prevent sensitive system-level information from being accessed by unauthorized actors who do not have the same level of access to the underlying system as the product does. In Ansible core, 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 Ansible Automation Platform. When creating a new keypair, the ec2_key module prints out the private key directly to the standard output. This flaw allows an attacker to fetch those keys from the log files, compromising the system's confidentiality, integrity, and availability.

CVE-2023-4237 Affected Ansible core Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
ansible-core
PyPI
≥ 2.8.0
≤ 2.15.2

References

Frequently Asked Questions

What is CVE-2023-4237?
CVE-2023-4237 is a security vulnerability in Ansible core involving Ansible may expose private key under CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere.
Which Ansible core versions are affected?
Affected versions include releases prior to current release patches across affected packages: ansible-core.
What version fixes CVE-2023-4237?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is ansible-core affected?
Yes, ansible-core is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2023-4237?
CVE-2023-4237 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-4237?
CVE-2023-4237 is classified under CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere (The product does not properly prevent sensitive system-level information from being accessed by unauthorized actors who do not have the same level of access to the underlying system as the product does.).
How can I check PyPI dependencies for CVE-2023-4237?
Run the dependency tree command: 'pip show ansible-core'. 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-ww3m-ffrm-qvqv",
  "modified" : "2023-10-10T22:29:26Z",
  "published" : "2023-10-04T15:30:35Z",
  "aliases" : [ "CVE-2023-4237" ],
  "summary" : "Ansible may expose private key",
  "details" : "A flaw was found in the Ansible Automation Platform. When creating a new keypair, the ec2_key module prints out the private key directly to the standard output. This flaw allows an attacker to fetch those keys from the log files, compromising the system's confidentiality, integrity, and availability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ansible-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.0"
      }, {
        "last_affected" : "2.15.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-4237"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHBA-2023:5653"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHBA-2023:5666"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2023-4237"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2229979"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ansible/ansible"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-497" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-10-10T22:29:26Z",
    "nvd_published_at" : "2023-10-04T15:15:12Z"
  }
}