Vulnerability
CVE-2026-33940
Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, a crafted object placed in the template context can bypass all conditional guards in `resolvePartial()` and cause `invokePartial()` to return `undefined`. The Handlebars runtime then treats the unresolved partial as a source that needs to be compiled, passing the crafted object to `env.compile()`. Because the object is a valid Handlebars AST containing injected code, the generated JavaScript executes arbitrary commands on the server. The attack requires the adversary to control a value that can be returned by a dynamic partial lookup. Version 4.7.9 fixes the issue. Some workarounds are available. First, use the runtime-only build (`require('handlebars/runtime')`). Without `compile()`, the fallback compilation path in `invokePartial` is unreachable. Second, sanitize context data before rendering: Ensure no value in the context is a non-primitive object that could be passed to a dynamic partial. Third, avoid dynamic partial lookups (`{{> (lookup ...)}}`) when context data is user-controlled.
125 advisories report this vulnerability, across 6 ecosystems.
Advisories
- CGA-222w-2pjw-87gx
- CGA-23x5-hx8r-6m9m
- CGA-26m4-pvjj-2fph
- CGA-26xm-v3fm-q6w3
- CGA-293g-9qp3-32hx
- CGA-2c8v-w2v3-h687
- CGA-2jf3-8m6h-pjph
- CGA-2r5c-vxvp-928v
- CGA-2vhv-pm94-677r
- CGA-35fm-gcr6-jgjp
- CGA-3pcf-qv9g-5crj
- CGA-3qwx-v5xc-vx8v
- CGA-3x98-9q2g-859v
- CGA-3xc3-qmm3-366w
- CGA-44gc-x7fr-m5vx
- CGA-45xm-9xq2-3xmc
- CGA-4chc-9xw2-m45v
- CGA-4mjg-ggpq-rq5p
- CGA-4wgg-6fhh-3c6c
- CGA-4wwx-r5qp-j2cm
- CGA-599p-rw35-qmq5
- CGA-5fg7-vf7x-6g5v
- CGA-5fgc-jf57-x7vh
- CGA-5v95-r634-2hcv
- CGA-5wh5-q98g-6fvf
- CGA-66vf-r6vm-2ffp
- CGA-68wf-548m-pc6x
- CGA-6hmj-cxjg-qpw4
- CGA-6m2m-h4cv-9m49
- CGA-6m96-4xh6-3x6r
- CGA-6r53-xwv2-qrm2
- CGA-6rrh-p23j-q856
- CGA-6wv7-q4pr-47r6
- CGA-72fg-gmjf-325f
- CGA-76ww-c969-733v
- CGA-794f-22c3-6gm5
- CGA-7pjm-jm52-rpjx
- CGA-7pm2-2jgh-qjhw
- CGA-7xwf-f84g-h94p
- CGA-83j3-q898-8r9h
- CGA-873m-7x9x-cw8r
- CGA-87x7-3739-h7jc
- CGA-8jr2-qqwf-8x6x
- CGA-8p36-prwj-gcjf
- CGA-929p-2rwh-2mg2
- CGA-9fp2-chpq-w6cr
- CGA-9rrf-5fqq-jpw7
- CGA-9v64-8x66-8qwm
- CGA-cp46-96pq-3qxw
- CGA-f2qm-f38f-xp9q
- CGA-f7qj-35wj-vjcp
- CGA-fxgp-cg2x-g39p
- CGA-g22c-r5px-8m2g
- CGA-g397-fgh9-wpqg
- CGA-g3q4-r7gw-29vg
- CGA-gfw3-9j2h-5975
- CGA-grqw-g4mg-p6cj
- CGA-gxjp-8gx6-r87v
- CGA-h288-7gfc-4g79
- CGA-h9pc-39x6-9cq3
- CGA-h9wm-mq24-448v
- CGA-hfrf-p8m8-7jr5
- CGA-hh5j-h42c-c9g3
- CGA-hhcp-crv2-vr6c
- CGA-hjvp-8c4m-253r
- CGA-hpjw-2h58-6j7j
- CGA-hq8x-qpq2-8r98
- CGA-j45m-xhw8-fqqq
- CGA-j77v-88wg-75m7
- CGA-j9j4-9m5f-x22j
- CGA-jg8c-5gp3-v848
- CGA-jm37-jc63-35rv
- CGA-jm67-v36f-cgjp
- CGA-jqcp-2fxw-35qv
- CGA-jw9j-4r9c-ff88
- CGA-jx6w-cmjx-q939
- CGA-m33c-hfwj-49pv
- CGA-m3f6-rhrf-7xvf
- CGA-m88h-rf46-pvg5
- CGA-mr4h-qr34-5m85
- CGA-p285-3x3r-pg28
- CGA-p7gr-w6qp-vpj6
- CGA-p9w2-j2xg-jc3p
- CGA-pc8m-v348-r3fq
- CGA-pmr5-m2v7-m6x2
- CGA-pprp-8m5q-29vq
- CGA-pqq7-3prg-m3hp
- CGA-pwx4-f64j-797w
- CGA-q28g-c8pg-47r2
- CGA-q5jj-cgj2-97vp
- CGA-q5xw-7wfv-9fcv
- CGA-q736-3wx2-2wp8
- CGA-q8vh-9jpw-8vp5
- CGA-qjq8-72cf-h845
- CGA-qqmg-j7m5-w5xq
- CGA-r362-2hcw-2hm5
- CGA-r3gq-fwxc-wfwg
- CGA-r83q-vr9q-3hhf
- CGA-r8gw-q8xh-7xqv
- CGA-r8xp-hf4v-9wv3
Showing the first 100. The API lists them all: /api/v1/vulnerabilities/CVE-2026-33940.
References
- https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2
- https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9
- https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xhpv-hc6g-r9c6
- https://access.redhat.com/errata/RHSA-2026:10175
- https://access.redhat.com/errata/RHSA-2026:34342
- https://access.redhat.com/security/cve/CVE-2026-33940
- https://bugzilla.redhat.com/show_bug.cgi?id=2452521
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-33940.json