Composer2Shell: Even 'composer show' Can Run Attacker Code

By 12 min read
Composer2Shell vulnerability where a crafted PHP project runs code during a read-only Composer command

A pull request that never gets merged can still run code on your build server if your pipeline types composer validate on it. That is the core of Composer2Shell, a Composer vulnerability published on 24 November 2026 and named by Orca Security six days later.

In short: Composer2Shell (GHSA-374h-4mh9-7rpm) lets a PHP project prepared by an attacker execute commands as whoever runs Composer inside it, through read-only commands such as composer show, list or validate. It affects Composer 2.7.0 to 2.11.2 and 2.2.23 to 2.2.32, and Composer 2.11.3 and 2.2.33 fix it.

What is Composer2Shell?

Composer2Shell is a code execution flaw in Composer, the standard dependency manager for PHP. The Composer maintainers describe it as a bypass of the fix for CVE-2024-24821, a 2024 bug with the same preconditions and the same impact. GitHub rates it high, CVSS 3.1 score 8.8, and files it under CWE-95, the weakness class for code that gets evaluated after untrusted input slips into it.

The advisory credits a researcher at Orca Security as reporter. Orca’s write-up, published on 30 November 2026 and attributed in its page data to Roi Nisimi, gave the bug its name. There is no CVE ID yet; Orca says one is pending.

The impact is plain: the attacker’s code runs with the rights of the person or CI job running Composer. On a developer laptop that means SSH keys and cloud credentials. On a build runner it means pipeline secrets.

Six-step flow showing how a crafted vendor path slips past Composer's installed.php safety check
The safety check runs before the vendor path is inserted, so it never sees the code that is finally evaluated. Data: Composer advisory, Orca Security.

Background: why Composer reads files from your project

Composer is not a niche tool. On 1 December 2026, Packagist, the main Composer package registry, reported 484,862 packages and about 219.4 billion total installs. The Composer repository on GitHub has 29,601 stars and is MIT licensed.

When you run Composer in a project, it reads metadata the project carries, including files Composer itself generates under vendor/composer/. One of these, installed.php, records which packages are installed. It is PHP code, and Composer loads it.

That design is the root of a whole family of bugs. If the project folder came from someone else, those generated files came from someone else too.

What CVE-2024-24821 fixed

The original advisory, GHSA-7c6p-848j-wh5h, was published on 8 February 2024. It said several files in the working directory are included when Composer runs, so tampered copies of InstalledVersions.php or installed.php lead to code execution. All CLI commands were affected, including self-update. The maintainers listed three high-risk cases: Composer run with sudo, pipelines that run Composer on untrusted projects, and shared environments.

The fix arrived in Composer 2.7.0 and 2.2.23. According to Orca, it treats installed.php as untrusted and only loads it after an allow-list check confirms it contains nothing but plain data: arrays, numbers, booleans and strings.

How does Composer2Shell work?

Composer2Shell defeats that check by changing the file after it was checked. Here is the mechanism at the level Orca describes it, without the proof-of-concept.

The check runs too early

Orca explains that after the allow-list check passes, Composer substitutes a directory path into the file’s contents. That path is derived from the vendor-dir setting in composer.json, a value the project controls.

The substitution is plain text search-and-replace. It does not know it is writing inside a quoted string, so a crafted path can carry syntax that breaks out of the string. The edited code is then evaluated, and the allow-list check is never run on the final version.

Why read-only commands trigger it

The file is loaded whenever Composer initialises a project, before it does anything the user asked for. The advisory names list, validate, show and outdated. Orca also confirmed diagnose, licenses, config --list, dump-autoload and install on Composer 2.11.2.

That is what makes the bug sharp. Most people treat composer show or composer validate as harmless inspection, the kind of command you run before deciding whether to trust a project.

How was it fixed?

Per Orca, the patched versions insert the path without treating it as a replacement pattern and re-run the safety check on the edited code before evaluating it. Composer 2.11.3 also fixed two smaller issues: package metadata being rendered as console markup, and credentials embedded in repository URLs appearing in download error messages.

Timeline from the CVE-2024-24821 fix in February 2024 to the Composer2Shell write-up in November 2026
The bypass came 33 months after the original fix and two weeks after another Composer security release. Data: Composer advisories and releases, Orca Security.

Timeline of the disclosure

Date Event
8 Feb 2024 GHSA-7c6p-848j-wh5h (CVE-2024-24821) published, fixed in 2.7.0 and 2.2.23
10 Nov 2026 Composer 2.11.2 and 2.2.32 ship several unrelated security fixes
19 Nov 2026 Orca reports the bypass through GitHub private vulnerability reporting
19 Nov 2026 Maintainers accept the report, within 25 minutes according to Orca
24 Nov 2026 Composer 2.11.3 and 2.2.33 released; GHSA-374h-4mh9-7rpm published
30 Nov 2026 Orca publishes its composer2shell write-up

Five days from report to fixed releases on both supported lines is a fast response by any standard.

Key Composer2Shell figures: CVSS 8.8, 25 minutes to triage, 5 days to fix, 2 release lines
A high-severity bug, handled quickly: both supported Composer lines were fixed five days after the report. Data: GitHub advisory, Orca Security.

Who is affected by the Composer vulnerability?

You are exposed, according to the advisory, when all three of these are true:

  • You run Composer 2.2.23 to 2.2.32, or 2.7.0 to 2.11.2.
  • You run it in a project whose composer.json and vendor directory someone else prepared or can write to: an untrusted checkout, a pull request built in CI, or a folder shared with other users.
  • You run it without --no-plugins and without --no-scripts.

The affected ranges start exactly where the CVE-2024-24821 fix landed. Reading the two advisories together, every Composer 2 release before 2.11.3 (or 2.2.33 on LTS) is exposed to one bug or the other in this scenario.

What it is not: the advisory states it cannot be exploited remotely or by installing a package. A malicious package on Packagist cannot trigger it. The attacker has to get you to run Composer inside their folder.

The situations Orca highlights

Orca lists realistic ways that happens:

  • cloning a repository to reproduce a bug, or running a take-home interview task
  • shared or multi-tenant hosts, where one user can run code as another
  • CI jobs that build fork code with privileged triggers such as pull_request_target, workflow_run, or comment commands any GitHub user can start
  • an insider or compromised laptop pushing a branch that runs a normal internal pipeline holding deploy keys

Fake job tasks are a proven lure. We covered a campaign where malicious NuGet packages were hidden inside take-home tests, and the same trick works with a PHP project.

How to check your exposure

Run composer --version on developer machines, build images and runners. Then check where Composer comes from in each pipeline, because it is often pinned:

  • Dockerfiles that copy composer.phar or pull a fixed Composer image tag
  • setup-php steps with a pinned tools: composer:2.x.y value, which Orca calls out
  • distribution packages: Orca says apt on Ubuntu installs Composer 2.9.5, which is in the affected range

What about GitHub-hosted runners?

Orca reported that Ubuntu and Windows runners shipped Composer 2.11.2, Intel macOS runners 2.10.2, and that the Intel macOS images had not been rebuilt since August. We checked the runner image readmes in the actions/runner-images repository on 1 December 2026:

Runner image readme Image version Composer listed Status
Ubuntu 24.04 20261122.23.1 2.11.2 Affected
Windows Server 2025 20261124.341.2 2.11.3 Fixed
macOS 15 20260824.0482.1 2.10.2 Affected

So the picture is already shifting. Windows Server 2025 moved to the fixed version, while the Ubuntu 24.04 and macOS 15 readmes still listed vulnerable versions. Do not rely on the runner image; run composer self-update in the job before Composer touches untrusted code.

Four-step CI scenario where a fork pull request leads to exposed runner secrets through Composer
The dangerous combination is old Composer plus fork code plus a privileged trigger that holds secrets. Scenario: Orca Security.

Why CI pipelines carry the most risk

A developer can choose not to run Composer on a stranger’s repository. A pipeline cannot choose. It runs whatever the trigger hands it.

Orca’s CI scenario is simple: an outsider opens a pull request containing a crafted composer.json and vendor folder, a privileged workflow checks it out, and any Composer step runs the payload. What is exposed is whatever the job can reach: repository secrets, the GITHUB_TOKEN that actions/checkout stores in the git config by default, and caches or build artifacts that later jobs trust.

Orca also notes that some approval gates are weaker than they look, for example when moving a pull request from draft to ready starts a job without fresh review. If your pipelines already worry you, our guide on how a dev branch can reach tier zero through GitHub attack paths shows how far a stolen workflow token can travel, and the wfx-loot GitHub Actions secret stealer shows attackers already farming CI secrets through pull requests at scale.

How does Composer2Shell compare with other Composer bugs?

November 2026 was a busy month for Composer security. The 10 November release, 2.11.2, fixed GHSA-jhfp-4ppm-crmm, a different 8.8-rated bug where a crafted composer.lock or installed.json could run a system command during install or update.

  CVE-2024-24821 GHSA-jhfp-4ppm-crmm Composer2Shell
Published 8 Feb 2024 10 Nov 2026 24 Nov 2026
CVSS 3.1 8.8 8.8 8.8
Attack vector Local Network, user interaction Local
Attacker controls Files in vendor/composer/ composer.lock or installed.json composer.json and vendor folder
Commands that trigger All, including self-update install, update Any that load the project
Affected versions 2.0 to 2.2.22, 2.3 to 2.6.x 2.10.0 to 2.11.1 2.2.23 to 2.2.32, 2.7.0 to 2.11.2
Stopped by --no-plugins / --no-scripts Not stated No Yes
Fixed in 2.7.0, 2.2.23 2.11.2 2.11.3, 2.2.33

The contrast in the last rows matters for defenders. The flags that protect against Composer2Shell do nothing against the lock-file bug, which the maintainers say can be triggered by a pull request that only edits composer.lock. Only updating covers both.

The pattern is familiar from other developer tools. Like the Vite dev server RCE, Composer2Shell turns a tool developers think of as local and safe into an execution path when the input comes from someone else.

How do you detect Composer2Shell abuse?

Neither the advisory nor Orca publishes indicators of compromise or ATT&CK mappings, and no exploitation has been reported. Detection therefore means finding exposure and watching for the behaviour the attack needs.

Where to look

  • Version inventory. Collect composer --version output from CI logs, container images and endpoint software inventories. Flag 2.7.0 to 2.11.2 and 2.2.23 to 2.2.32.
  • Pull request content. Most projects do not commit their vendor/ folder. A pull request from outside that adds or edits files under vendor/composer/, or changes vendor-dir in composer.json, deserves a human look before any job runs.
  • Workflow configuration. List workflows that combine pull_request_target, workflow_run or comment triggers with a checkout of the pull request head and a Composer step.
  • Process behaviour. On runners and developer machines with EDR, a PHP process started by Composer that spawns a shell, curl, wget or a network connection to an unknown host during a read-only command like validate or show is abnormal.
  • Secret use. Watch cloud and GitHub audit logs for tokens used from unexpected IP addresses shortly after a fork pull request built.

ATT&CK mapping

This mapping is ours, not the sources’: T1195.001 (Compromise Software Dependencies and Development Tools) for the delivery through a project, T1059 (Command and Scripting Interpreter) for the execution, and T1552 (Unsecured Credentials) for the secrets a CI job exposes.

How do you mitigate Composer2Shell?

In priority order:

  1. Update Composer everywhere. Run composer self-update to reach 2.11.3, or 2.2.33 on the LTS line. Rebuild container images and update pinned versions in Dockerfiles and setup-php steps.
  2. Update inside CI jobs. Until you trust every runner image, run composer self-update (or pin 2.11.3 in setup-php) before Composer touches any checked-out code, as Orca recommends.
  3. Use the flags on untrusted code. Run Composer with --no-plugins or --no-scripts on any project you do not control. Remember they do not cover the lock-file bug fixed in 2.11.2.
  4. Stop building fork code with privileges. Do not check out and build fork code under pull_request_target or workflow_run unless each run is approved, and re-approve after every new commit.
  5. Shrink what a job can steal. Scope secrets to the jobs that need them, default workflow permissions to read-only, and set persist-credentials: false on checkout.
  6. Remove sudo Composer. The 2024 advisory already advised removing sudo rights to run Composer, so a bug like this cannot become root.
  7. Reset suspect files. For a project you are unsure about, the 2024 advisory suggests deleting vendor/composer/installed.php and InstalledVersions.php and reinstalling with --no-scripts --no-plugins.

What is still unknown?

  • CVE ID. None has been assigned yet, so scanners that match only CVE IDs may not flag affected versions. Search for the GHSA ID instead.
  • Runner rollout. Orca says GitHub rebuilds runner images about weekly but the Intel macOS images had gone months without a rebuild. When every image carries 2.11.3 is not stated anywhere we found.
  • Other distributions. Orca names Ubuntu’s apt package (2.9.5). We did not verify which Linux distributions or official Docker images have shipped fixed builds.
  • Exploitation. No source reports attacks. That is not proof there were none, especially in CI, where few teams log what Composer does.
  • More bypasses. This is the second time the same file has been the entry point. Whether the new re-check closes the class for good is something only time and researchers will show.

The bottom line

Composer2Shell turns composer show into code execution when the project folder belongs to an attacker. It is local, not wormable, and fixed in Composer 2.11.3 and 2.2.33. The exposure that matters is CI running Composer on pull request code, so update Composer inside the job, add --no-plugins for untrusted projects, and stop building fork code with secrets in reach.

Sources

This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.

Frequently asked questions

What is Composer2Shell?

Composer2Shell is the name Orca Security gave to GHSA-374h-4mh9-7rpm, a code execution flaw in the PHP package manager Composer. Running almost any Composer command inside a folder an attacker prepared can execute the attacker's code as your user.

Which Composer versions are affected by GHSA-374h-4mh9-7rpm?

Composer 2.2.23 to 2.2.32 on the 2.2 LTS line and 2.7.0 to 2.11.2 on the main line. Composer 2.11.3 and 2.2.33, both released on 24 November 2026, fix it.

Does Composer2Shell have a CVE?

Not yet. The GitHub advisory lists no CVE ID, and Orca Security wrote on 30 November 2026 that a CVE is pending. Track it by the advisory ID GHSA-374h-4mh9-7rpm.

Can Composer2Shell be exploited by installing a malicious package?

No. The Composer advisory says it is not exploitable remotely or through package installation. The attacker needs to control the composer.json file and the vendor directory of the project where you run Composer.

How do I check my Composer version?

Run composer --version. Anything from 2.7.0 to 2.11.2, or from 2.2.23 to 2.2.32, is affected. Run composer self-update to move to 2.11.3, or 2.2.33 if you stay on the LTS line.

Do --no-plugins or --no-scripts protect against Composer2Shell?

Yes. The advisory says you are only exposed when Composer runs without --no-plugins and without --no-scripts, and Orca says either flag stops the vulnerable file from being loaded. Updating is still the real fix.

Are GitHub Actions runners affected by Composer2Shell?

They were when it was disclosed. Orca said Ubuntu and Windows runner images shipped Composer 2.11.2 and Intel macOS images 2.10.2. On 1 December 2026 the Ubuntu 24.04 image readme still listed 2.11.2, while the Windows Server 2025 readme listed the fixed 2.11.3.

Is Composer2Shell being exploited in the wild?

Neither the Composer advisory nor Orca's write-up reports any exploitation in the wild. Orca describes lab confirmation only. That can change, so patch CI images and developer machines now.

Keep reading

Composer2ShellComposer vulnerabilityPHPGHSA-374h-4mh9-7rpmCI/CD securityGitHub Actionssupply chain security