CVE-2022-42906: Powerline gitstatus Powerline Gitstatus Vulnerable To Arbitrary Vulnerability

HIGH
Advisory Identifier: GHSA-w67g-6gjv-c599
CVSS 7.8
CWE-94 CWE-77
Published
Advisory Summary

CVE-2022-42906 is a HIGH (CVSS 7.8) powerline gitstatus vulnerable to arbitrary vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Powerline gitstatus libraries in the PyPI ecosystem. The issue involves powerline gitstatus vulnerable to arbitrary code execution. Remediation is available by upgrading affected packages to version 1.3.2.

CVE-2022-42906 at a Glance

CVE Identifier CVE-2022-42906
GHSA Identifier GHSA-w67g-6gjv-c599
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Powerline gitstatus
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.1/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-2022-42906

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

powerline-gitstatus fixed: 1.3.2
pip install powerline-gitstatus>=1.3.2
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 powerline-gitstatus

How to Check if You Are Affected

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

pip show powerline-gitstatus

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

Note: The pip show powerline-gitstatus 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 Powerline gitstatus, 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

powerline-gitstatus (aka Powerline Gitstatus) before 1.3.2 allows arbitrary code execution. git repositories can contain per-repository configuration that changes the behavior of git, including running arbitrary commands. When using powerline-gitstatus, changing to a directory automatically runs git commands in order to display information about the current repository in the prompt. If an attacker can convince a user to change their current directory to one controlled by the attacker, such as in a shared filesystem or extracted archive, powerline-gitstatus will run arbitrary commands under the attacker's control. NOTE: this is similar to CVE-2022-20001.

CVE-2022-42906 Affected Powerline gitstatus Versions

1 component(s)
Fixed Versions:
1.3.2
Product / Package Ecosystem Affected Versions Fixed Version
powerline-gitstatus
PyPI
< 1.3.2
1.3.2

References

Frequently Asked Questions

What is CVE-2022-42906?
CVE-2022-42906 is a security vulnerability in Powerline gitstatus involving Powerline Gitstatus vulnerable to arbitrary code execution under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Powerline gitstatus versions are affected?
Affected versions include releases prior to 1.3.2 across affected packages: powerline-gitstatus.
What version fixes CVE-2022-42906?
Upgrading to 1.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is powerline-gitstatus affected?
Yes, powerline-gitstatus is affected in releases prior to 1.3.2. Upgrade your dependency to 1.3.2 or later.
What is the CVSS score of CVE-2022-42906?
CVE-2022-42906 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-42906?
CVE-2022-42906 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-2022-42906?
Run the dependency tree command: 'pip show powerline-gitstatus'. 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-w67g-6gjv-c599",
  "modified" : "2023-01-20T22:03:09Z",
  "published" : "2022-10-13T12:00:26Z",
  "aliases" : [ "CVE-2022-42906" ],
  "summary" : "Powerline Gitstatus vulnerable to arbitrary code execution",
  "details" : "powerline-gitstatus (aka Powerline Gitstatus) before 1.3.2 allows arbitrary code execution. git repositories can contain per-repository configuration that changes the behavior of git, including running arbitrary commands. When using powerline-gitstatus, changing to a directory automatically runs git commands in order to display information about the current repository in the prompt. If an attacker can convince a user to change their current directory to one controlled by the attacker, such as in a shared filesystem or extracted archive, powerline-gitstatus will run arbitrary commands under the attacker's control. NOTE: this is similar to CVE-2022-20001.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "powerline-gitstatus"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-42906"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jaspernbrouwer/powerline-gitstatus/issues/45"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jaspernbrouwer/powerline-gitstatus/commit/fe8e963b3489e4cceaa2c1f26f2bcc2ef405364c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jaspernbrouwer/powerline-gitstatus"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jaspernbrouwer/powerline-gitstatus/releases/tag/v1.3.2"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/01/msg00017.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77", "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-13T19:13:14Z",
    "nvd_published_at" : "2022-10-13T03:15:00Z"
  }
}