Skip to content
Heist/ feed
Back to feed
High

Code execution and possible privilege escalation via compromised InstalledVersions.php or installed.php in Composer

Type: advisorySources: OSV

Composer is a dependency Manager for the PHP language. In affected versions several files within the local working directory are included during the invocation of Composer and in the context of the executing user. As such, under certain conditions arbitrary code execution may lead to local privilege escalation, provide lateral user movement or malicious code execution when Composer is invoked within a directory with tampered files. All Composer CLI commands are affected, including composer.phar's self-update. The following scenarios are of high risk: Composer being run with sudo, Pipelines which may execute Composer on untrusted projects, Shared environments with developers who run Composer individually on the same project. This vulnerability has been addressed in versions 2.7.0 and 2.2.23. It is advised that the patched versions are applied at the earliest convenience. Where not possible, the following should be addressed: Remove all sudo composer privileges for all users to mitigate root privilege escalation, and avoid running Composer within an untrusted directory, or if needed, verify that the contents of `vendor/composer/InstalledVersions.php` and `vendor/composer/installed.php` do not include untrusted code. A reset can also be done on these files by the following:```sh rm vendor/composer/installed.php vendor/composer/InstalledVersions.php composer install --no-scripts --no-plugins ```

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2024-24821
Confirmed fixed CVEs
Not specified
Updated in this feed
2 Nov 2026, 17:12 UTC · Revision 1

Source evidence

Code execution and possible privilege escalation via compromised InstalledVersions.php or installed.php in Composer

core-osv · Original source

Published 8 Feb 2024, 23:54 UTC

Composer is a dependency Manager for the PHP language. In affected versions several files within the local working directory are included during the invocation of Composer and in the context of the executing user. As such, under certain conditions arbitrary code execution may lead to local privilege escalation, provide lateral user movement or malicious code execution when Composer is invoked within a directory with tampered files. All Composer CLI commands are affected, including composer.phar's self-update. The following scenarios are of high risk: Composer being run with sudo, Pipelines which may execute Composer on untrusted projects, Shared environments with developers who run Composer individually on the same project. This vulnerability has been addressed in versions 2.7.0 and 2.2.23. It is advised that the patched versions are applied at the earliest convenience. Where not possible, the following should be addressed: Remove all sudo composer privileges for all users to mitigate root privilege escalation, and avoid running Composer within an untrusted directory, or if needed, verify that the contents of `vendor/composer/InstalledVersions.php` and `vendor/composer/installed.php` do not include untrusted code. A reset can also be done on these files by the following:```sh rm vendor/composer/installed.php vendor/composer/InstalledVersions.php composer install --no-scripts --no-plugins ```

osv:CVE-2024-24821
Complete source record
{
  "id": "68181ec7a0e1dbdff307215414e69ac80adfa8c00ce068717358e984fdc16786",
  "url": "https://osv.dev/vulnerability/CVE-2024-24821",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Code execution and possible privilege escalation via compromised InstalledVersions.php or installed.php in Composer",
    "summary": "Composer is a dependency Manager for the PHP language. In affected versions several files within the local working directory are included during the invocation of Composer and in the context of the executing user. As such, under certain conditions arbitrary code execution may lead to local privilege escalation, provide lateral user movement or malicious code execution when Composer is invoked within a directory with tampered files. All Composer CLI commands are affected, including composer.phar's self-update. The following scenarios are of high risk: Composer being run with sudo, Pipelines which may execute Composer on untrusted projects, Shared environments with developers who run Composer individually on the same project. This vulnerability has been addressed in versions 2.7.0 and 2.2.23. It is advised that the patched versions are applied at the earliest convenience. Where not possible, the following should be addressed: Remove all sudo composer privileges for all users to mitigate root privilege escalation, and avoid running Composer within an untrusted directory, or if needed, verify that the contents of `vendor/composer/InstalledVersions.php` and `vendor/composer/installed.php` do not include untrusted code. A reset can also be done on these files by the following:```sh rm vendor/composer/installed.php vendor/composer/InstalledVersions.php composer install --no-scripts --no-plugins ```",
    "evidence": "osv:CVE-2024-24821",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2024-24821",
      "aliases": [
        "BIT-composer-2024-24821",
        "CVE-2024-24821",
        "GHSA-7c6p-848j-wh5h"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/composer/composer",
              "type": "GIT",
              "events": [
                {
                  "introduced": "378b34c5e33c71d194f33e1b73a62ba22148ff13"
                },
                {
                  "fixed": "d1542e89636abf422fde328cb28d53752efb69e5"
                },
                {
                  "introduced": "934ee6eed3c3ffd0aeccef7c1d255adcf0752b24"
                },
                {
                  "fixed": "96d107e2bfe61bb9eafe55a9d45bd7faed1dd461"
                },
                {
                  "fixed": "64e4eb356b159a30c766cd1ea83450a38dc23bf5"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:getcomposer:composer:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.0.0"
                      },
                      {
                        "fixed": "2.2.23"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:getcomposer:composer:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.3.0"
                      },
                      {
                        "fixed": "2.7.0"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "64e4eb356b159a30c766cd1ea83450a38dc23bf5"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "2.6.5",
            "2.6.4",
            "2.6.3",
            "2.6.2",
            "2.6.1",
            "2.6.0",
            "2.5.2",
            "2.5.1",
            "2.5.0",
            "2.4.1",
            "2.4.0",
            "2.4.0-RC1",
            "2.3.5",
            "2.3.4",
            "2.3.3",
            "2.3.2",
            "2.3.1",
            "2.3.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-24821.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:21.458888742Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/24xxx/CVE-2024-24821.json",
        "https://github.com/composer/composer/security/advisories/GHSA-7c6p-848j-wh5h",
        "https://nvd.nist.gov/vuln/detail/CVE-2024-24821",
        "https://github.com/composer/composer/commit/64e4eb356b159a30c766cd1ea83450a38dc23bf5"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-829"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/24xxx/CVE-2024-24821.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2024-24821",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 487583,
  "published_at": "2024-02-08T23:54:04.058+00:00"
}