CVE-2015-8371
📋 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
- Composer
📦 What is this software?
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
Composer by Getcomposer
⚠️ 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.
🎯 Exploit Status
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
allSet 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
allPrevent 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
- https://flyingmana.de/blog_en/2016/02/14/composer_cache_injection_vulnerability_cve_2015_8371.html
- https://github.com/FriendsOfPHP/security-advisories/blob/e26be423c5bcfdb38478d2f92d1f928c15afb561/composer/composer/CVE-2015-8371.yaml
- https://github.com/composer/composer
- https://gitlab.com/gitlab-org/advisories-community/-/blob/main/packagist/composer/composer/CVE-2015-8371.yml
- https://flyingmana.de/blog_en/2016/02/14/composer_cache_injection_vulnerability_cve_2015_8371.html
- https://github.com/FriendsOfPHP/security-advisories/blob/e26be423c5bcfdb38478d2f92d1f928c15afb561/composer/composer/CVE-2015-8371.yaml
- https://github.com/composer/composer
- https://gitlab.com/gitlab-org/advisories-community/-/blob/main/packagist/composer/composer/CVE-2015-8371.yml