🇰🇷 한글 설명
JavaScript용 YAML 파서인 `yaml` 라이브러리의 특정 버전에서 재귀 호출 깊이 제한이 없어 스택 오버플로가 발생하는 취약점입니다. 공격자가 조작된 YAML 문서를 제공할 경우 `RangeError`를 유발하여 애플리케이션의 요청을 실패하게 하거나 Node.js 프로세스를 종료시킬 수 있습니다.
💡 쉬운 설명
YAML 파일을 읽어들이는 과정에서 너무 깊게 겹쳐진 구조를 만나면 프로그램이 감당하지 못하고 멈춰버리는 문제입니다. 아주 작은 크기의 파일만으로도 서버를 강제로 종료시킬 수 있습니다.
🇺🇸 원문 (English)
`yaml` is a YAML parser and serialiser for JavaScript. Parsing a YAML document with a version of `yaml` on the 1.x branch prior to 1.10.3 or on the 2.x branch prior to 2.8.3 may throw a RangeError due to a stack overflow. The node resolution/composition phase uses recursive function calls without a depth bound. An attacker who can supply YAML for parsing can trigger a `RangeError: Maximum call stack size exceeded` with a small payload (~2–10 KB). The `RangeError` is not a `YAMLParseError`, so applications that only catch YAML-specific errors will encounter an unexpected exception type. Depending on the host application's exception handling, this can fail requests or terminate the Node.js process. Flow sequences allow deep nesting with minimal bytes (2 bytes per level: one `[` and one `]`). On the default Node.js stack, approximately 1,000–5,000 levels of nesting (2–10 KB input) exhaust the call stack. The exact threshold is environment-dependent (Node.js version, stack size, call stack depth at invocation). Note: the library's `Parser` (CST phase) uses a stack-based iterative approach and is not affected. Only the compose/resolve phase uses actual call-stack recursion. All three public parsing APIs are affected: `YAML.parse()`, `YAML.parseDocument()`, and `YAML.parseAllDocuments()`. Versions 1.10.3 and 2.8.3 contain a patch.
📍 영향받는 시스템
yaml 1.x branch (1.10.3 미만), 2.x branch (2.8.3 미만)
⚔️ 공격 벡터
공격자가 깊은 중첩 구조(Deep Nesting)를 가진 소량의 YAML 데이터를 파싱 대상에 입력함
🛡️ 대응 방법
yaml 라이브러리를 1.10.3 또는 2.8.3 이상의 최신 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 yaml의 버전을 확인하여 1.10.3 미만 또는 2.8.3 미만인지 확인합니다.