🇰🇷 한글 설명
stream-json 라이브러리 3.5.0 미만 버전에서 경로 필터링 시 중첩 깊이에 따라 연산량이 기하급수적으로 증가하는 성능 문제가 존재합니다. 공격자가 깊게 중첩된 JSON 문서를 전송할 경우 Node.js 이벤트 루프를 차단하여 서비스 거부(DoS) 상태를 유발할 수 있습니다.
💡 쉬운 설명
JSON 데이터의 구조가 너무 복잡하게 겹쳐 있으면, 이를 처리하는 과정에서 컴퓨터가 과도한 계산을 하느라 멈춰버리는 문제입니다. 아주 작은 크기의 파일이라도 구조만 복잡하면 서버를 마비시킬 수 있습니다.
🇺🇸 원문 (English)
stream-json is a micro-library of stream components for processing JSON and JSONC with a minimal memory footprint. Prior to 3.5.0, the path filters pick, ignore, filter, and replace in src/core/filters/filter-base.js recompute the full path string from the nesting stack for every checkable token. Because the stack length equals the current nesting depth and a checkable token is emitted at every level, a depth D document costs O(D²) rather than O(D) to process. The issue is triggered by nesting depth rather than byte volume, including the documented pick({filter: 'data'}) traversal-until-match path, so an application that sends untrusted JSON through a string or RegExp filter can block the Node.js event loop and cause denial of service with a small deeply nested document. The streamArray, streamObject, and streamValues streamers are not affected because they use the constant-time asm.depth getter. This issue is fixed in version 3.5.0.
📍 영향받는 시스템
stream-json version < 3.5.0
⚔️ 공격 벡터
깊게 중첩된(deeply nested) JSON 문서를 전송하여 CPU 자원을 고갈시키는 방식
🛡️ 대응 방법
stream-json 라이브러리를 3.5.0 이상의 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 결과에서 stream-json의 버전이 3.5.0 미만인지 확인하십시오.