🇰🇷 한글 설명
stream-json 라이브러리의 JSONC 파서 및 검증기에서 주석 처리 과정 중 발생하는 성능 저하 취약점입니다. 대규모 주석이 여러 작은 청크로 나뉘어 입력될 경우, 주석 종료 지점을 찾기 위해 반복적인 스캔을 수행하여 CPU 사용량이 기하급수적으로 증가하고 Node.js 이벤트 루프를 중단시킬 수 있습니다.
💡 쉬운 설명
매우 긴 주석이 포함된 파일을 처리할 때 컴퓨터가 주석의 끝을 찾으려고 너무 많은 계산을 반복하여 시스템이 멈추는 현상입니다. 이로 인해 프로그램이 응답하지 않거나 매우 느려질 수 있습니다.
🇺🇸 원문 (English)
stream-json is a micro-library of stream components for processing JSON and JSONC with a minimal memory footprint. Prior to 3.6.0, the JSONC parser at stream-json/jsonc/parser.js and verifier at stream-json/jsonc/verifier.js restart comment-terminator scanning from the opening slash whenever a block or line comment spans an input chunk, while retaining the accumulated comment buffer. Delivering a large valid comment across many small chunks therefore causes quadratic CPU work and can stall the Node.js event loop. The maintainer characterizes the attack vector as local because the documented JSONC input is locally owned or user-controlled configuration, rather than input intended for the open internet. This JSONC-only scope does not include the plain JSON parser, which advances through and discards consumed string and number data. This issue is fixed in version 3.6.0.
📍 영향받는 시스템
stream-json 버전 3.6.0 미만
⚔️ 공격 벡터
사용자 제어 가능한 설정 파일이나 로컬 JSONC 입력값에 의도적으로 설계된 긴 주석을 포함시켜 전달
🛡️ 대응 방법
stream-json 라이브러리를 3.6.0 버전 이상으로 업데이트
🔧 검증 코드
출력된 결과에서 stream-json의 버전을 확인하여 3.6.0 미만인지 체크