Handlebars.js
Handlebars.js has JavaScript Injection via AST Type Confusion
Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, `Handlebars.compile()` accepts a pre-parsed AST object in addition to a template string. The `value` field of a `NumberLiteral` AST node is emitted directly into the generated JavaScript without quoting or sanitization. An attacker who can supply a crafted AST to `compile()` can therefore inject and execute arbitrary JavaScript, leading to Remote Code Execution on the server. Version 4.7.9 fixes the issue. Some workarounds are available. Validate input type before calling `Handlebars.compile()`; ensure the argument is always a `string`, never a plain object or JSON-deserialized value. Use the Handlebars runtime-only build (`handlebars/runtime`) on the server if templates are pre-compiled at build time; `compile()` will be unavailable.
Affected versions and mitigation
From the CVE record and the vendor's references.Affected
- >= 4.0.0, < 4.7.9
Fixed in 4.7.9
Mitigation
Upgrade handlebars.js to 4.7.9 or later.
References
- Vendor advisory github.com/handlebars-lang/handlebars.js/secur…
- Patch github.com/handlebars-lang/handlebars.js/commi…
- Release notes github.com/handlebars-lang/handlebars.js/relea…
Timeline
Days relative to CVE publicationFirst public PoC 16 h after publication; not in CISA KEV. First PoC: dinhvaren/cve-2026-33937 (created 28 Mar 2026, found by us: backfilled).
PoC repositories
Found on GitHub.4 PoCs
PoCs 4
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| dinhvaren/cve-2026-33937 | 28 Mar 2026 +16 h | 1 | PoC |
| EQSTLab/CVE-2026-33937 | 22 Apr 2026 +25 d | 3 | PoC |
| garlic-wizard/CVE-2026-33937-for-DarkZeroReturns | 30 Jul 2026 +125 d | 0 | PoC |
| c0gnit00/CVE-2026-33937 | 3 Aug 2026 +128 d | 1 | PoC |
Only PoCs count toward the first-PoC date and the characteristics below. Do not run PoC code from unknown sources.
PoC characteristics
What to hunt for in your logs · from 4 PoC reposPOST /character
- Body markers
"_csrf""name""race":"Human""class":"Wizard""backstory":"pwn""campaign_id":"1""campaign_message"inapplication/json- Seen in
- 2 repos: c0gnit00/CVE-2026-33937, garlic-wizard/CVE-2026-33937-for-DarkZeroReturns
- Evidence
- c0gnit00/CVE-2026-33937/exploit.py:168 garlic-wizard/CVE-2026-33937-for-DarkZeroReturns/poc.py:265 garlic-wizard/CVE-2026-33937-for-DarkZeroReturns/poc.py:282
GET /campaign/1
- Seen in
- 1 repo: c0gnit00/CVE-2026-33937
- Evidence
- c0gnit00/CVE-2026-33937/exploit.py:137
GET /campaign/{var}
GET /character/new
POST /api/email/preview
- Body markers
"subject":"test""editorTemplateData"inapplication/json- Ports
- 8080, 12701
- Seen in
- 1 repo: EQSTLab/CVE-2026-33937
- Evidence
- EQSTLab/CVE-2026-33937/README.md:59 EQSTLab/CVE-2026-33937/exploit.py:68
POST /login
- Body markers
_csrf=email=password=inapplication/x-www-form-urlencoded- Seen in
- 1 repo: c0gnit00/CVE-2026-33937
- Evidence
- c0gnit00/CVE-2026-33937/exploit.py:46
Regex
Generated from PoC characteristics; not yet reviewed. Matches the request path and query.
(?i)^/character(?:[?#].*)?$
(?i)^/campaign/1(?:[?#].*)?$
(?i)^/campaign/[^/?#]*(?:[?#].*)?$
(?i)^/character/new(?:[?#].*)?$
(?i)^/api/email/preview(?:[?#].*)?$
Suricata
Template generated from PoC characteristics. Review before deploying.
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2026-33937 handlebars-lang handlebars.js exploit attempt"; flow:established,to_server; http.method; content:"POST"; http.uri; content:"/character"; http.request_body; content:"|22|_csrf|22|"; http.request_body; content:"|22|name|22|"; http.request_body; content:"|22|race|22|:|22|Human|22|"; http.request_body; content:"|22|class|22|:|22|Wizard|22|"; http.request_body; content:"|22|backstory|22|:|22|pwn|22|"; http.request_body; content:"|22|campaign_id|22|:|22|1|22|"; http.request_body; content:"|22|campaign_message|22|"; reference:url,poc.griffinguard.io/cve/CVE-2026-33937; classtype:web-application-attack; sid:9319252; rev:1;)
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2026-33937 handlebars-lang handlebars.js exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/campaign/1"; reference:url,poc.griffinguard.io/cve/CVE-2026-33937; classtype:web-application-attack; sid:9159113; rev:1;)
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2026-33937 handlebars-lang handlebars.js exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/campaign/"; reference:url,poc.griffinguard.io/cve/CVE-2026-33937; classtype:web-application-attack; sid:9463831; rev:1;)
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2026-33937 handlebars-lang handlebars.js exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/character/new"; reference:url,poc.griffinguard.io/cve/CVE-2026-33937; classtype:web-application-attack; sid:9123747; rev:1;)
alert http any any -> $HOME_NET [8080,12701] (msg:"GG PoC-Monitor CVE-2026-33937 handlebars-lang handlebars.js exploit attempt"; flow:established,to_server; http.method; content:"POST"; http.uri; content:"/api/email/preview"; http.request_body; content:"|22|subject|22|:|22|test|22|"; http.request_body; content:"|22|editorTemplateData|22|"; reference:url,poc.griffinguard.io/cve/CVE-2026-33937; classtype:web-application-attack; sid:9799003; rev:1;)
Sigma
Template generated from PoC characteristics. Review before deploying.
title: handlebars-lang handlebars.js exploit attempt (CVE-2026-33937)
id: gg-pocmon-cve-2026-33937-9319252
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-33937. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2026-33937
logsource:
category: webserver
detection:
selection:
cs-method: POST
cs-uri-stem|contains|all:
- '/character'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2026.33937
title: handlebars-lang handlebars.js exploit attempt (CVE-2026-33937)
id: gg-pocmon-cve-2026-33937-9159113
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-33937. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2026-33937
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/campaign/1'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2026.33937
title: handlebars-lang handlebars.js exploit attempt (CVE-2026-33937)
id: gg-pocmon-cve-2026-33937-9463831
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-33937. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2026-33937
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/campaign/'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2026.33937
title: handlebars-lang handlebars.js exploit attempt (CVE-2026-33937)
id: gg-pocmon-cve-2026-33937-9123747
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-33937. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2026-33937
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/character/new'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2026.33937
title: handlebars-lang handlebars.js exploit attempt (CVE-2026-33937)
id: gg-pocmon-cve-2026-33937-9799003
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-33937. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2026-33937
logsource:
category: webserver
detection:
selection:
cs-method: POST
cs-uri-stem|contains|all:
- '/api/email/preview'
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2026.33937