CVE-2022-25866: Czproject/git php Command Injection Vulnerability

HIGH
Advisory Identifier: GHSA-3xpw-vhmv-cw7h
CVSS 8.1
CWE-74 CWE-77
Published
Advisory Summary

CVE-2022-25866 is a HIGH (CVSS 8.1) command injection vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Czproject/git php libraries in the Packagist ecosystem. The issue involves command injection in czproject/git-php. Remediation is available by upgrading affected packages to version 4.0.3.

CVE-2022-25866 at a Glance

CVE Identifier CVE-2022-25866
GHSA Identifier GHSA-3xpw-vhmv-cw7h
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Czproject/git php
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

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

How to Fix CVE-2022-25866

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

czproject/git-php fixed: 4.0.3
Upgrade czproject/git-php to 4.0.3
Verify Direct and Transitive Dependencies

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

inspect dependencies for czproject/git-php

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-25866, inspect your project dependencies for Czproject/git php:

inspect dependencies for czproject/git-php

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Czproject/git php, 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

The package czproject/git-php before 4.0.3 are vulnerable to Command Injection via git argument injection. When calling the isRemoteUrlReadable($url, array $refs = NULL) function, both the url and refs parameters are passed to the git ls-remote subcommand in a way that additional flags can be set. The additional flags can be used to perform a command injection.

CVE-2022-25866 Affected Czproject/git php Versions

1 component(s)
Fixed Versions:
4.0.3
Product / Package Ecosystem Affected Versions Fixed Version
czproject/git-php
Packagist
< 4.0.3
4.0.3

References

Frequently Asked Questions

What is CVE-2022-25866?
CVE-2022-25866 is a security vulnerability in Czproject/git php involving Command injection in czproject/git-php under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Czproject/git php versions are affected?
Affected versions include releases prior to 4.0.3 across affected packages: czproject/git-php.
What version fixes CVE-2022-25866?
Upgrading to 4.0.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is czproject/git-php affected?
Yes, czproject/git-php is affected in releases prior to 4.0.3. Upgrade your dependency to 4.0.3 or later.
What is the CVSS score of CVE-2022-25866?
CVE-2022-25866 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-25866?
CVE-2022-25866 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check Packagist dependencies for CVE-2022-25866?
Run the dependency tree command: 'inspect dependencies for czproject/git-php'. 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-3xpw-vhmv-cw7h",
  "modified" : "2022-04-27T14:35:56Z",
  "published" : "2022-04-26T00:00:35Z",
  "aliases" : [ "CVE-2022-25866" ],
  "summary" : "Command injection in czproject/git-php",
  "details" : "The package czproject/git-php before 4.0.3 are vulnerable to Command Injection via git argument injection. When calling the isRemoteUrlReadable($url, array $refs = NULL) function, both the url and refs parameters are passed to the git ls-remote subcommand in a way that additional flags can be set. The additional flags can be used to perform a command injection.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "czproject/git-php"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-25866"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/czproject/git-php/commit/5e82d5479da5f16d37a915de4ec55e1ac78de733"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/czproject/git-php"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/czproject/git-php/releases/tag/v4.0.3"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-PHP-CZPROJECTGITPHP-2421349"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74", "CWE-77" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-27T14:35:56Z",
    "nvd_published_at" : "2022-04-25T17:15:00Z"
  }
}