🇰🇷 한글 설명
PHP SOAP 확장의 객체 중복 제거 메커니즘에서 객체 참조 카운트를 증가시키지 않은 채 포인터를 전역 맵에 저장합니다. apache:Map 노드의 중복 키 처리 시 이전 PHP 객체가 해제되지만 stale 포인터가 맵에 남아있어, 이후 href 참조를 통해 해제된 메모리를 접근할 수 있습니다. PHP 문자열 할당이 해제된 메모리를 재사용할 수 있으므로, 공격자는 SOAP 요청 제어를 통해 Use-After-Free를 악용한 원격코드 실행을 달성할 수 있습니다.
💡 쉬운 설명
PHP의 SOAP 처리 기능에서 삭제된 메모리 영역을 여전히 접근할 수 있는 구멍이 있습니다. 공격자가 특별히 만든 SOAP 요청을 보내면 서버에서 임의의 코드를 실행할 수 있습니다.
🇺🇸 원문 (English)
In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the SOAP extension's object deduplication mechanism stores pointers to PHP objects in a global map without incrementing their reference counts. When an apache:Map node contains duplicate keys, processing the second entry overwrites the first in the temporary result map, freeing the original PHP object while its stale pointer remains in the map. A subsequent href reference to the freed node can copy the dangling pointer into the result. As PHP string allocations can reclaim the freed memory region, an attacker with control over the SOAP request body can exploit this use-after-free to achieve remote code execution.
📍 영향받는 시스템
PHP 8.2.0-8.2.30, 8.3.0-8.3.30, 8.4.0-8.4.20, 8.5.0-8.5.5 (SOAP 확장 활성화된 경우)
⚔️ 공격 벡터
SOAP 클라이언트 요청을 통한 원격 공격 (네트워크 접근 필수, 인증 불필요)
🛡️ 대응 방법
PHP를 8.2.31+, 8.3.31+, 8.4.21+, 8.5.6+ 이상으로 업데이트 또는 SOAP 확장 비활성화
🔧 검증 코드
첫 번째는 PHP 버전 확인, 두 번째는 SOAP 확장 활성화 여부 확인. 두 조건 모두 만족하면서 버전이 영향받는 범위에 있으면 취약함.
php -v | grep -oP 'PHP \K[0-9]+\.[0-9]+\.[0-9]+' && php -m | grep -i soap