🇰🇷 한글 설명
Perl용 JavaScript::Minifier::XS 0.16 이전 버전에서 입력의 첫 유효 토큰이 슬래시(/)일 때 NULL 포인터 역참조로 프로세스가 충돌합니다. 정규식 리터럴과 나눗셈 연산자를 구분하는 로직이 앞선 토큰이 없는 경우를 처리하지 못해 발생합니다.
💡 쉬운 설명
자바스크립트 코드를 압축하는 Perl 모듈에 특정 입력을 넣으면 프로그램이 강제로 종료됩니다. 신뢰할 수 없는 코드를 처리하는 서비스는 외부 요청만으로 서비스 거부 상태에 빠질 수 있습니다.
🇺🇸 원문 (English)
JavaScript::Minifier::XS versions before 0.16 for Perl crash with a NULL pointer dereference when the first meaningful token of the input is a slash.
The regexp versus division disambiguator in JsTokenizeString (XS.xs) inspects the previous token's last byte to choose between a regexp literal and a division operator. When a slash is the first meaningful token, with the start of input or only whitespace and comments before it, there is no valid preceding token: the walk back over whitespace and comment nodes runs off the head of the node list to NULL, and the byte lookup reads through a NULL contents pointer at an underflowed length index. The following identifier check dereferences the same NULL pointer.
The crash is reachable through the public minify() API, so input as small as a single slash byte crashes the calling process. A service that minifies untrusted or third-party JavaScript can be crashed by a remote request, causing denial of service.
📍 영향받는 시스템
JavaScript::Minifier::XS 0.16 미만 버전을 사용하는 Perl 환경
⚔️ 공격 벡터
minify() API에 첫 토큰이 슬래시인 단 1바이트 입력을 전달하여 호출 프로세스를 충돌시키는 원격 서비스 거부 공격
🛡️ 대응 방법
JavaScript::Minifier::XS를 0.16 이상으로 업데이트
🔧 검증 코드
출력된 버전이 0.16 미만이면 취약하므로 업데이트가 필요하고, 0.16 이상이면 패치된 것입니다. 명령어 실패 시 모듈이 설치되지 않은 상태입니다.
perl -MJavaScript::Minifier::XS -e 'print $JavaScript::Minifier::XS::VERSION, "\n"' 2>/dev/null