🔍 CVE-2026-33938

8.1
CVSS Score
HIGH
2026-03-27
2026-10-26 22:10
✅ 완료

🇰🇷 한글 설명

Handlebars 4.0.0부터 4.7.8 버전에는 템플릿 데이터 컨텍스트의 @partial-block 특수 변수를 헬퍼가 임의로 덮어쓸 수 있어, 조작된 AST가 {{> @partial-block}}을 통해 컴파일·실행되어 서버에서 임의의 JavaScript가 실행될 수 있습니다. 해당 문제는 4.7.9 버전에서 수정되었습니다. 임시 완화책으로 런타임 전용 빌드 사용, 컨텍스트에 값을 쓰는 헬퍼 점검, 신뢰되지 않은 패키지의 헬퍼 등록 회피가 제시되어 있습니다.

💡 쉬운 설명

템플릿 엔진 Handlebars의 취약점으로, 악의적인 사용자가 입력값을 조작하면 서버에서 임의의 코드를 실행할 수 있습니다. 4.7.9 이상 버전으로 업데이트하면 해결됩니다.

🇺🇸 원문 (English)

Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, the `@partial-block` special variable is stored in the template data context and is reachable and mutable from within a template via helpers that accept arbitrary objects. When a helper overwrites `@partial-block` with a crafted Handlebars AST, a subsequent invocation of `{{> @partial-block}}` compiles and executes that AST, enabling arbitrary JavaScript execution on the server. Version 4.7.9 fixes the issue. Some workarounds are available. First, use the runtime-only build (`require('handlebars/runtime')`). The `compile()` method is absent, eliminating the vulnerable fallback path. Second, audit registered helpers for any that write arbitrary values to context objects. Helpers should treat context data as read-only. Third, avoid registering helpers from third-party packages (such as `handlebars-helpers`) in contexts where templates or context data can be influenced by untrusted input.

📍 영향받는 시스템

Handlebars 4.0.0 ~ 4.7.8을 사용하는 Node.js 기반 서버 및 애플리케이션 (수정 버전: 4.7.9)

⚔️ 공격 벡터

헬퍼가 임의 객체에 값을 쓸 수 있는 환경에서 조작된 AST를 @partial-block에 주입하여 {{> @partial-block}} 호출 시 원격 코드를 실행

🛡️ 대응 방법

handlebars 패키지를 4.7.9 이상으로 업그레이드하고, 가능하면 런타임 전용 빌드(require('handlebars/runtime')) 사용

🔧 검증 코드

출력된 버전이 4.0.0~4.7.8 범위이면 취약하며, 4.7.9 이상이면 패치된 상태입니다.

Shell / Script
npm ls handlebars 2>/dev/null | grep handlebars

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

💻 영향받는 소프트웨어

Oracle Java SE