🇰🇷 한글 설명
PHP 8.4.21 이전 및 8.5.6 이전 버전에서 mb_convert_encoding() 등 mbstring 함수가 NUL 바이트를 포함한 인코딩 이름을 처리할 때, 문자열 길이를 잘못 판단하여 전역 메모리 범위를 벗어난 읽기(Out-of-bounds read)를 유발합니다. 이는 서비스 거부, 정보 유출, 또는 충돌을 초래할 수 있습니다.
💡 쉬운 설명
PHP의 문자 인코딩 변환 함수가 특수한 형태의 입력값을 안전하게 처리하지 못해 컴퓨터 메모리를 잘못 읽습니다. 공격자가 이를 악용하면 서버를 다운시키거나 민감한 정보를 유출할 수 있습니다.
🇺🇸 원문 (English)
In PHP versions 8.4.* before 8.4.21 and 8.5.* before 8.5.6, when an encoding name containing an embedded NUL byte is passed to mb_convert_encoding() or related mbstring functions, the code incorrectly assumes that when strncasecmp() returns 0 it means the strings have the same length. This can lead to out-of-bounds read of global memory, potentially causing a crash or information disclosure or crash. Affected functions include mb_convert_encoding(), mb_detect_encoding(), mb_convert_variables(), and mb_detect_order(), as well as the mbstring.detect_order and mbstring.http_output INI settings.
📍 영향받는 시스템
PHP 8.4.0~8.4.20, PHP 8.5.0~8.5.5
⚔️ 공격 벡터
mb_convert_encoding(), mb_detect_encoding(), mb_convert_variables(), mb_detect_order() 함수 또는 mbstring.detect_order, mbstring.http_output 설정에 NUL 바이트를 포함한 인코딩명 전달
🛡️ 대응 방법
PHP를 8.4.21 이상 또는 8.5.6 이상으로 업그레이드
🔧 검증 코드
VULNERABLE이 출력되면 영향받는 버전이며, 출력이 없으면 안전한 버전입니다.
php -v | grep -oP 'PHP \K[0-9.]+' | awk -F. '{if(($1==8 && $2==4 && $3<21) || ($1==8 && $2==5 && $3<6)) print "VULNERABLE"}'