🇰🇷 한글 설명
PHP 의존성 관리자 Composer의 Perforce 통합 기능에서 소스 참조와 URL 파라미터가 적절히 이스케이프되지 않아 명령 주입 취약점 발생. 악의적인 Composer 리포지토리의 패키지 메타데이터를 통해 Perforce가 설치되지 않은 상태에서도 공격 가능.
💡 쉬운 설명
PHP 라이브러리 설치 도구인 Composer에 보안 결함이 있어, 악의적인 패키지 정보를 통해 공격자가 컴퓨터에서 임의의 명령을 실행할 수 있습니다. 의존성 설치 시 자동으로 실행되므로 감지하기 어렵습니다.
🇺🇸 원문 (English)
Composer is a dependency manager for PHP. Versions 1.0 through 2.2.26 and 2.3 through 2.9.5 contain a command injection vulnerability in the Perforce::syncCodeBase() method, which appends the $sourceReference parameter to a shell command without proper escaping, and additionally in the Perforce::generateP4Command() method as in GHSA-wg36-wvj6-r67p / CVE-2026-40176, which interpolates user-supplied Perforce connection parameters (port, user, client) from the source url field without proper escaping. An attacker can inject arbitrary commands through crafted source reference or source url values containing shell metacharacters, even if Perforce is not installed. Unlike CVE-2026-40176, the source reference and url are provided as part of package metadata, meaning any compromised or malicious Composer repository can serve package metadata declaring perforce as a source type with malicious values. This vulnerability is exploitable when installing or updating dependencies from source, including the default behavior when installing dev-prefixed versions. This issue has been fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline). If developers are unable to immediately update, they can avoid installing dependencies from source by using --prefer-dist or the preferred-install: dist config setting, and only use trusted Composer repositories as a workaround.
📍 영향받는 시스템
Composer 1.0-2.2.26, 2.3-2.9.5
⚔️ 공격 벡터
악의적인 또는 침해된 Composer 리포지토리에서 제공하는 패키지 메타데이터의 Perforce 소스 URL/참조에 쉘 메타문자를 주입하여 설치/업데이트 시 임의 명령 실행
🛡️ 대응 방법
Composer를 2.2.27(LTS) 또는 2.9.6(mainline) 이상으로 업그레이드하거나, 임시 조치로 --prefer-dist 옵션 사용 및 신뢰 가능한 리포지토리만 사용
🔧 검증 코드
출력된 버전이 2.2.27 이상 또는 2.9.6 이상이면 패치됨; 그 이하면 즉시 업그레이드 필요
composer --version 2>/dev/null | grep -oP '\d+\.\d+\.\d+'