# CVE-2026-33940: Handlebars.js has JavaScript Injection via AST Type Confusion when passing an object as dynamic partial

- Priority: **Prioritise**
- Reason: Public exploit (GitHub, Date unknown)
- Next step: Check applicability and the vendor advisory: no fix release is recorded here
- Status: published
- Published: 2026-03-27 · Modified: 2026-09-04
- Aliases: UBUNTU-CVE-2026-33940, DEBIAN-CVE-2026-33940, CGA-222w-2pjw-87gx, CGA-26xm-v3fm-q6w3, CGA-3qwx-v5xc-vx8v, CGA-3x98-9q2g-859v, CGA-5fg7-vf7x-6g5v, CGA-5fgc-jf57-x7vh, CGA-6m96-4xh6-3x6r, CGA-6rrh-p23j-q856, CGA-6wv7-q4pr-47r6, CGA-7pm2-2jgh-qjhw, CGA-8p36-prwj-gcjf, CGA-9rrf-5fqq-jpw7, CGA-g22c-r5px-8m2g, CGA-grqw-g4mg-p6cj, CGA-hhcp-crv2-vr6c, CGA-j9j4-9m5f-x22j, CGA-m88h-rf46-pvg5, CGA-qjq8-72cf-h845, CGA-qqmg-j7m5-w5xq, CGA-rjrh-224q-37fw, CGA-wrw8-2p6j-hx64, CGA-x8pp-qj6j-gq7r, GHSA-xhpv-hc6g-r9c6, CGA-23x5-hx8r-6m9m, CGA-26m4-pvjj-2fph, 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-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-5v95-r634-2hcv, CGA-5wh5-q98g-6fvf, CGA-66vf-r6vm-2ffp, CGA-68wf-548m-pc6x, CGA-6hmj-cxjg-qpw4, CGA-6m2m-h4cv-9m49, CGA-6r53-xwv2-qrm2, CGA-72fg-gmjf-325f, CGA-76ww-c969-733v, CGA-794f-22c3-6gm5, CGA-7pjm-jm52-rpjx, CGA-7xwf-f84g-h94p, CGA-83j3-q898-8r9h, CGA-873m-7x9x-cw8r, CGA-87x7-3739-h7jc, CGA-8jr2-qqwf-8x6x, CGA-929p-2rwh-2mg2, CGA-9fp2-chpq-w6cr, CGA-9v64-8x66-8qwm, CGA-cp46-96pq-3qxw, CGA-f2qm-f38f-xp9q, CGA-f7qj-35wj-vjcp, CGA-fxgp-cg2x-g39p, CGA-g397-fgh9-wpqg, CGA-g3q4-r7gw-29vg, CGA-gfw3-9j2h-5975, 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-hjvp-8c4m-253r, CGA-hpjw-2h58-6j7j, CGA-hq8x-qpq2-8r98, CGA-j45m-xhw8-fqqq, CGA-j77v-88wg-75m7, 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-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-r362-2hcw-2hm5, CGA-r3gq-fwxc-wfwg, CGA-r83q-vr9q-3hhf, CGA-r8gw-q8xh-7xqv, CGA-r8xp-hf4v-9wv3, CGA-rg4q-rppx-59r5, CGA-rgg8-5r3c-f575, CGA-rrw4-qjcc-78qc, CGA-rvc7-3h96-cphp, CGA-vj7f-rr8m-2v9p, CGA-vqm8-2wvr-j8wj, CGA-w27g-7h5c-2mjh, CGA-w2qh-h3g4-mx59, CGA-w8wv-226w-4wcg, CGA-wcpp-277j-838m, CGA-wq2x-jv3f-qhvr, CGA-wq37-vvh6-mhgc, CGA-wrjh-g83p-9mmm, CGA-wvxp-c79g-796f, CGA-x25w-chq7-rhxv, CGA-x5cq-fvcj-9p67, CGA-xc4v-m726-jw75, CGA-xcr6-mpm2-wjxx
- Record: https://cvemate.com/vulnerability/CVE-2026-33940 · JSON: https://cvemate.com/vulnerability/CVE-2026-33940/json

## Description

```text
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.
```

## Signals

- CVSS: 8.1 high (v3.1, CVE.org) CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- EPSS: 0.782%, percentile 57.336%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 1 (github)

## Affected (first 20 of 78)

- chainguard gitlab-rails-ce-18.1 (Chainguard): \< 18.1.6-r14
- chainguard gitlab-rails-ce-18.10 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-18.11 (Chainguard): \< 18.11.6-r2
- chainguard gitlab-rails-ce-18.5 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-18.6 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-18.7 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-18.8 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-18.9 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-19.0 (Chainguard): \< 19.0.3-r1
- chainguard gitlab-rails-ce-19.1 (Chainguard): \< 19.1.1-r6
- chainguard gitlab-rails-ce-assets-fips-19.4 (Chainguard): \< 19.4.0-r2
- chainguard gitlab-rails-ce-fips-18.1 (Chainguard): \< 18.1.6-r15
- chainguard gitlab-rails-ce-fips-18.10 (Chainguard): \< 18.10.8-r8
- chainguard gitlab-rails-ce-fips-18.11 (Chainguard): \< 18.11.6-r1
- chainguard gitlab-rails-ce-fips-18.5 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-fips-18.6 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-fips-18.7 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-fips-18.8 (Chainguard): All versions (No fix recorded)
- chainguard gitlab-rails-ce-fips-18.9 (Chainguard): \< 18.9.8-r8
- chainguard gitlab-rails-ce-fips-19.0 (Chainguard): \< 19.0.3-r1

## References

- <https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xhpv-hc6g-r9c6>
- <https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2>
- <https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9>
- <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>
- <https://access.redhat.com/errata/RHSA-2026:34342>
- <https://access.redhat.com/errata/RHSA-2026:10175>
- <https://ubuntu.com/security/CVE-2026-33940>
- <https://www.cve.org/CVERecord?id=CVE-2026-33940>
- <https://security-tracker.debian.org/tracker/CVE-2026-33940>
- <https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/33xxx/CVE-2026-33940.json>
- <https://nvd.nist.gov/vuln/detail/CVE-2026-33940>
- <https://github.com/handlebars-lang/handlebars.js>

---

Data as of 2026-12-05T08:24:26.207Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
