CVE-2023-43655: Composer/composer Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-jm6m-4632-36hf
CVSS 8.8
CWE-74
Published
Advisory Summary

CVE-2023-43655 is a HIGH (CVSS 8.8) remote code execution vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Composer/composer libraries in the Packagist ecosystem. The issue involves composer remote code execution vulnerability via web-accessible composer.phar. Remediation is available by upgrading affected packages to version 1.10.27, 2.2.22, 2.6.4.

CVE-2023-43655 at a Glance

CVE Identifier CVE-2023-43655
GHSA Identifier GHSA-jm6m-4632-36hf
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Composer/composer
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.8

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
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-2023-43655

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

composer/composer fixed: 1.10.27
Upgrade composer/composer to 1.10.27
composer/composer fixed: 2.2.22
Upgrade composer/composer to 2.2.22
composer/composer fixed: 2.6.4
Upgrade composer/composer to 2.6.4
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 composer/composer

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-43655, inspect your project dependencies for Composer/composer:

inspect dependencies for composer/composer

Analyze the terminal output to locate any version of Composer/composer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.10.27), 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 Composer/composer, 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

### Impact Users publishing a composer.phar to a public web-accessible server where the composer.phar can be executed as a php file may be impacted if PHP also has `register_argc_argv` enabled in php.ini. ### Patches 2.6.4, 2.2.22 and 1.10.27 patch this vulnerability. ### Workarounds Make sure `register_argc_argv` is disabled in php.ini, and avoid publishing composer.phar to the web as this really should not happen.

CVE-2023-43655 Affected Composer/composer Versions

3 component(s)
Fixed Versions:
1.10.272.2.222.6.4
Product / Package Ecosystem Affected Versions Fixed Version
composer/composer
Packagist
< 1.10.27
1.10.27
composer/composer
Packagist
≥ 2.0.0
< 2.2.22
2.2.22
composer/composer
Packagist
≥ 2.3.0
< 2.6.4
2.6.4

References

Frequently Asked Questions

What is CVE-2023-43655?
CVE-2023-43655 is a security vulnerability in Composer/composer involving Composer Remote Code Execution vulnerability via web-accessible composer.phar under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Composer/composer versions are affected?
Affected versions include releases prior to 1.10.27, 2.2.22, 2.6.4 across affected packages: composer/composer.
What version fixes CVE-2023-43655?
Upgrading to 1.10.27, 2.2.22, 2.6.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is composer/composer affected?
Yes, composer/composer is affected in releases prior to 1.10.27, 2.2.22, 2.6.4. Upgrade your dependency to 1.10.27, 2.2.22, 2.6.4 or later.
What is the CVSS score of CVE-2023-43655?
CVE-2023-43655 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-43655?
CVE-2023-43655 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-2023-43655?
Run the dependency tree command: 'inspect dependencies for composer/composer'. 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-jm6m-4632-36hf",
  "modified" : "2025-02-13T19:15:08Z",
  "published" : "2023-09-29T20:39:21Z",
  "aliases" : [ "CVE-2023-43655" ],
  "summary" : "Composer Remote Code Execution vulnerability via web-accessible composer.phar",
  "details" : "### Impact\n\nUsers publishing a composer.phar to a public web-accessible server where the composer.phar can be executed as a php file may be impacted if PHP also has `register_argc_argv` enabled in php.ini.\n\n### Patches\n\n2.6.4, 2.2.22 and 1.10.27 patch this vulnerability.\n\n### Workarounds\n\nMake sure `register_argc_argv` is disabled in php.ini, and avoid publishing composer.phar to the web as this really should not happen.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.10.27"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.2.22"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.3.0"
      }, {
        "fixed" : "2.6.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/security/advisories/GHSA-jm6m-4632-36hf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-43655"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/4fce14795aba98e40b6c4f5047305aba17a6120d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/955a48e6319c8962e5cd421b07c00ab3c728968c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/95e091c921037b7b6564942845e7b738f6b95c9c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/composer/composer"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2024/03/msg00030.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/66H2WKFUO255T3BZTL72TNYJYH2XM5FG"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7AWYAUZNH565NWPIKGEIYBWHYNM5JGAE"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KFOPGPW2KS37O3KJWBRGTUWHTXCQXBS2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-09-29T20:39:21Z",
    "nvd_published_at" : "2023-09-29T20:15:09Z"
  }
}