Executive Summary:

  • composer2shell, a high-severity code execution vulnerability (CVSS 8.8) in Composer, the dependency manager behind virtually every modern PHP project. It is tracked as GHSA-374h-4mh9-7rpm, and a CVE is pending.
  • Running Composer inside a project prepared by an attacker executes the attacker’s code as the user running Composer. Even a read-only command such as composer show, which just lists your packages, is enough.
  • At risk: Developers who open untrusted PHP projects and, above all, CI/CD pipelines that run Composer on pull requests from forks.
  • Impact: Stolen cloud credentials, deploy keys and registry tokens, tampered builds, and a path into the software supply chain.
  • Affected versions: Composer 2.2.23 to 2.2.32 and 2.7.0 to 2.11.2.
  • Fix: Composer 2.11.3 and 2.2.33 (LTS), released after we reported the issue through GitHub’s private vulnerability reporting.
  • What to do: Run composer self-update and review CI workflows that build pull requests from forks.
  • CI services like GitHub Actions, Azure Pipelines, AWS CodeBuild, CircleCI and Semaphore still ship a vulnerable Composer, so any build that runs Composer on untrusted code can be taken over, along with whatever secrets that build has.

What Is Composer, and Why Does This Matter?

Composer resolves, downloads and autoloads the libraries a PHP project depends on. It runs on developer laptops, in Docker builds, and in almost every PHP CI pipeline, usually installed through the shivammathur/setup-php GitHub Action.

Because Composer reads its configuration from the project it runs in, the project directory itself is an input. Whoever controls that directory controls what Composer does when it loads it.

The Vulnerability

Attackers can run their own code on your machine just by getting you to list the packages in a malicious PHP project. Composer has a safety check that’s meant to stop this, but it checks the project’s files too early, before it makes a final change to them. An attacker can hide a command in the project’s settings that only becomes dangerous after that change, so it slips past the check and runs.

Hands-On: Technical Details

Composer keeps a list of a project’s installed packages in vendor/composer/installed.php, a PHP file it loads every time it opens the project. Because that file comes from the project, Composer treats it as untrusted: it first checks that the file holds only plain data, then fills in the vendor folder’s location and evaluates it. The bug is in that second step. Here’s an attack, step by step.

Step-By-Step Breakdown

Step 1: The attacker sets vendor-dir in composer.json.

{“config”:{“vendor-dir”:”v${`touch /proj/PWNED`}”}}

That value is the name of a real folder in the project. $, braces and backticks are all allowed in Linux folder names, so on disk this is just an oddly named directory.

Step 2: The attacker places an innocent-looking installed.php inside it.

Path: v${`touch /proj/PWNED`}/composer/installed.php

<?php return array(‘a’ => “=> __DIR__ . ‘”,);

Step 3: Composer’s safety check passes.

Before loading the file, Composer checks it against an allow-list. The file may only contain arrays of numbers, booleans and strings, and double-quoted strings may not contain $. Our string has no $, so the file passes:

allow-list check on installed.php: PASSES (looks like pure data)

Step 4: Composer rewrites the file after the check.

Real installed.php files point at their own location with __DIR__, so Composer replaces every => __DIR__ . ‘ with the actual folder path. It uses a plain text search that doesn’t know whether it’s inside a string, so it also finds the copy hidden in our string. The path it pastes in comes from vendor-dir, quoted with var_export:

‘/proj/v${`touch /proj/PWNED`}/composer’

Step 5: The bug. Composer evaluates the rewritten code without checking it again.

The code passed to eval() is:

<?php return array(‘a’ => “=> ‘/proj/v${`touch /proj/PWNED`}/composer’ . ‘”,);

PHP reads the evaluated code piece by piece:

  • “=> ‘/proj/v: the start of a double-quoted string. The single quotes around the path are just ordinary characters here and protect nothing.
  • ${`touch /proj/PWNED`}: inside double quotes, ${…} tells PHP to evaluate what’s in the braces, and the backticks run a shell command.
  • /composer’ . ‘”: the rest of the string, closed by the original “.
  • ,);: closes the array normally.

Step 6: The command runs.

When PHP builds the string, it evaluates ${`touch /proj/PWNED`} and runs touch /proj/PWNED as the user running Composer. On PHP 8.5 this prints deprecation warnings for the ${} and backtick syntax, but the command still runs. Swap touch for any command and the attacker has full code execution.

Why any command triggers it

Composer loads installed.php on startup, so composer show, composer list, composer validate and composer install all set it off. We confirmed this on Composer 2.11.2 and 2.2.32. Running Composer with –no-plugins or –no-scripts skips loading the file, so nothing runs.

The fix

Composer 2.11.3 and 2.2.33 inserts the path without treating it as a replacement pattern, and runs the same safety check again on the edited code right before evaluating it. An attacker path that lands inside a double-quoted string brings in a $, so the file is now rejected.

What Triggers It

We confirmed the issue on Composer 2.11.2 and 2.2.32, the latest releases of both supported lines at the time. On 2.11.2, all of these commands executed the payload with default options: list, show, validate, diagnose, licenses, outdated, config –list, dump-autoload and install.

Running with –no-plugins or –no-scripts stops Composer from loading the file, so nothing runs.

Preconditions

  • The victim runs Composer 2.2.23 to 2.2.32, or 2.7.0 to 2.11.2.
  • The attacker controls the composer.json and vendor directory contents of the project the victim runs Composer in.
  • Composer runs with default options, meaning neither –no-plugins nor –no-scripts.

The flaw is not exploitable remotely or by installing a package from Packagist.

The Attack Vector

The attack has a single requirement: get the victim to run Composer in a directory the attacker controls. The victim doesn’t need to install anything or run the project’s code. Opening the project with any Composer command is enough.

  1. Prepare the project. The attacker adds a crafted vendor-dir setting to composer.json and ships matching files in the vendor directory.
  2. Deliver it. The project reaches the victim as a repository to clone, a bug reproduction, a take-home interview task, a shared directory, or a pull request.
  3. Wait for Composer. The victim runs composer install, or simply composer show to see which packages are installed.
  4. Code runs. The attacker’s code executes with the victim’s permissions.

On a developer workstation, that means access to source code, SSH keys and cloud credentials. On a shared or multi-tenant host, one user can run code as another. The most lucrative target, though, is CI.

Why CI/CD Is the Most Lucrative Target

Compromising a developer workstation gives an attacker one machine, and each victim has to be lured in individually. A CI pipeline runs automatically, holds the project’s most valuable secrets, and can publish code that thousands of downstream users trust.

Many open source projects want to test contributions from forks with the same credentials as their own builds, so they use privileged triggers such as pull_request_target, workflow_run, or comment commands like /benchmark. These run with the repository’s secrets and a token that can often write to the repository. When such a workflow checks out the contributor’s code and runs Composer on it, the pipeline runs the attack by itself.

The threat isn’t only from outside. An insider, or an attacker who has compromised a single developer’s laptop, can push a branch that runs an ordinary internal pipeline. Composer then runs their code with the pipeline’s secrets, such as production deploy keys and cloud credentials, that the developer was never meant to hold. That gives the attacker a path to move from one endpoint into the cloud and production environments.

Our scan of public GitHub workflows from PHP projects found this pattern in popular frameworks, e-commerce platforms, payment SDKs and developer tools.

How an Attack Unfolds

  1. Fork and plant. The attacker forks the project and commits the crafted composer.json and vendor files.
  2. Open a pull request. Where builds are gated, the attacker waits for a maintainer to approve the pull request and pushes the payload afterwards. We saw gates that check a label only once and run again when the contributor moves the pull request from draft back to ready for review, and comment-triggered jobs that any GitHub user can start.
  3. The pipeline runs Composer. The privileged workflow checks out the pull request and runs Composer. Because the flaw triggers as soon as Composer loads the project, even a step that only validates composer.json or prepares static analysis runs the attacker’s code.
  4. The payload takes everything the job can reach.

What an Attacker Gets

  • Repository secrets: Cloud and test environment credentials, payment API keys, logins for commercial package registries, and product license keys.
  • A write-capable token: The workflow’s GITHUB_TOKEN, which actions/checkout stores in the local git configuration by default. Depending on its permissions, it can push code, edit releases or comment as the project.
  • The supply chain: Poisoned build caches and artifacts that later trusted builds and releases pick up, turning a single pull request into a compromise of every downstream user of the package.

None of this requires publishing a malicious package. The attacker only uses the project’s normal contribution workflow.

Your CI runner is probably still vulnerable

Composer 2.11.3 fixed the bug on November 24, but most CI runners still have an older Composer preinstalled. We ran composer –version on every GitHub-hosted runner image:

  • Ubuntu and Windows runners (x64 and arm64): 2.11.2, vulnerable
  • Intel macOS runners: 2.10.2, vulnerable
  • Apple-silicon macOS runners and ubuntu-slim: Composer not installed

Azure Pipelines uses the same images. AWS CodeBuild, CircleCI and Semaphore also ship Composer in their build images. GitLab doesn’t include Composer by default, so GitLab pipelines install it themselves, and whether they’re vulnerable depends on the version they pull in, such as an old or pinned composer image.

Runner images get Composer by downloading the official composer.phar when the image is built, so each image keeps whatever version was current that day. Updates arrive only with the next image rebuild, which happens about weekly on GitHub, though its Intel macOS images haven’t been rebuilt since August. The Ubuntu package is no better: apt install composer installs 2.9.5, which is also vulnerable.

So any pipeline that runs Composer on untrusted code with secrets in reach is exploitable using the runner’s own Composer.

Fix: run composer self-update before Composer touches untrusted code, or pin composer:2.11.3 with setup-php.

Remediation

  • Upgrade Composer: Move to 2.11.3, or 2.2.33 on the LTS line. Run composer self-update and check pinned versions in Dockerfiles and CI, for example tools: composer:2.x.y in setup-php.
  • Treat untrusted projects as untrusted code: Use –no-plugins or –no-scripts when running Composer on a project you don’t control.
  • Lock down privileged workflows: Don’t check out and build fork code under pull_request_target or workflow_run unless a maintainer approves each run, and require approval again after every new commit.
  • Limit what CI can reach: Scope secrets to the jobs that need them, set workflow permissions to read-only by default, and use persist-credentials: false on checkout.

Disclosure Timeline

  • November 19, 2026: Reported to Composer through GitHub private vulnerability reporting
  • November 19, 2026: Report accepted by the maintainers, within 25 minutes
  • November 24, 2026: Fix released in Composer 2.11.3 and 2.2.33; advisory GHSA-374h-4mh9-7rpm published
  • Pending: CVE assignment

How Can Orca Help?

The Orca Cloud Security Platform provides comprehensive Application Security (AppSec) capabilities. With Orca, organizations can:

  • Find vulnerable Composer versions: Orca detects outdated packages and tools across cloud workloads, container images and build environments.
  • Audit repositories and workflows for misconfigurations: Orca scans SCM platforms like GitHub for pipelines that run untrusted pull request code with privileged triggers or broad permissions.
  • Detect and prevent secret exposure: Orca’s Secret Detection finds credentials in repositories and pipelines before attackers do.
  • Connect cloud to development: Orca’s Cloud-to-Dev capabilities trace cloud risks back to their origins in source code.

Learn More

Interested in learning more about the Orca Platform? Schedule a personalized 1:1 demo.