Inclusion of Functionality from Untrusted Control Sphere Affecting composer/composer package, versions >=2.0.0, <2.2.23>=2.3.0, <2.7.0


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.04% (11th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PHP-COMPOSERCOMPOSER-6239526
  • published9 Feb 2024
  • disclosed9 Feb 2024
  • creditEd Cradock

Introduced: 9 Feb 2024

CVE-2024-24821  (opens in a new tab)
CWE-829  (opens in a new tab)

How to fix?

Upgrade composer/composer to version 2.2.23, 2.7.0 or higher.

Overview

composer/composer is a Dependency Manager for PHP. Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

Affected versions of this package are vulnerable to Inclusion of Functionality from Untrusted Control Sphere due to the inclusion of several files within the local working directory during the invocation of the package and in the context of the executing user. Under certain conditions, an attacker can escalate privileges locally, move laterally between users, or execute malicious code when the package is invoked within a directory containing tampered files.

Note:

The risk is increased if the package is run with sudo, in pipelines executing on untrusted projects, or in shared environments where developers run the package individually on the same project.

Workaround

This vulnerability can be mitigated by removing all sudo privileges for all users to prevent root privilege escalation, avoiding running the package within an untrusted directory, or, if necessary, verifying that the contents of vendor/composer/InstalledVersions.php and vendor/composer/installed.php do not include untrusted code. A reset on these files can also be performed by executing:

rm vendor/composer/installed.php vendor/composer/InstalledVersions.php
composer install --no-scripts --no-plugins

CVSS Scores

version 3.1