CVE-2015-8371

8.8 HIGH

📋 TL;DR

CVE-2015-8371 is a cache poisoning vulnerability in Composer that allows attackers to inject malicious code into server-side build processes. The vulnerability occurs because Composer uses predictable cache keys based on package metadata, enabling attackers to poison the cache with their own packages. This affects projects using Composer versions before 1.0.0 on shared hosting environments.

💻 Affected Systems

Products:
  • Composer
Versions: All versions before 1.0.0 (specifically through 1.0.0-alpha11)
Operating Systems: All operating systems running Composer
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects shared hosting environments where multiple projects use the same Composer cache directory.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution on build servers, allowing attackers to compromise production systems and steal sensitive data.

🟠

Likely Case

Malicious package injection leading to supply chain attacks and compromised application builds.

🟢

If Mitigated

Limited to isolated development environments with proper access controls and cache separation.

🌐 Internet-Facing: HIGH - Build servers accessible from the internet are directly vulnerable to cache poisoning attacks.
🏢 Internal Only: MEDIUM - Shared internal build environments remain vulnerable to insider threats or compromised internal systems.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires access to the same filesystem as the target Composer installation, making shared hosting environments particularly vulnerable.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.0.0

Vendor Advisory: https://github.com/composer/composer/security/advisories/GHSA-5g8f-3j6p-v2gj

Restart Required: No

Instructions:

1. Update Composer to version 1.0.0 or later using: composer self-update 2. Clear existing cache: composer clear-cache 3. Verify update with: composer --version

🔧 Temporary Workarounds

Isolate Composer cache per project

all

Set unique cache directories for each project to prevent cross-project cache poisoning

export COMPOSER_CACHE_DIR=/path/to/project-specific/cache

Disable dist package caching

all

Prevent caching of dist packages entirely

composer config --global cache-files-dir false

🧯 If You Can't Patch

  • Isolate build environments so each project has its own dedicated Composer installation
  • Implement strict filesystem permissions to prevent unauthorized access to Composer cache directories

🔍 How to Verify

Check if Vulnerable:

Check Composer version with: composer --version. If version is below 1.0.0, the system is vulnerable.

Check Version:

composer --version

Verify Fix Applied:

Verify Composer version is 1.0.0 or higher with: composer --version

📡 Detection & Monitoring

Log Indicators:

  • Unexpected package downloads from unusual sources
  • Cache directory modifications from unauthorized users

Network Indicators:

  • Unusual outbound connections from build servers during package resolution

SIEM Query:

Process execution logs showing composer commands with suspicious package names or sources

🔗 References

📤 Share & Export