Skip to content

chore(deps): update dependency handlebars to v4.7.9 [security]#306

Open
renovate[bot] wants to merge 1 commit into
developfrom
renovate/npm-handlebars-vulnerability
Open

chore(deps): update dependency handlebars to v4.7.9 [security]#306
renovate[bot] wants to merge 1 commit into
developfrom
renovate/npm-handlebars-vulnerability

Conversation

@renovate

@renovate renovate Bot commented May 9, 2021

Copy link
Copy Markdown

This PR contains the following updates:

Package Change Age Confidence
handlebars (source) 4.6.04.7.9 age confidence

Remote code execution in handlebars when compiling templates

CVE-2021-23369 / GHSA-f2jv-r9rf-7988

More information

Details

The package handlebars before 4.7.7 are vulnerable to Remote Code Execution (RCE) when selecting certain compiling options to compile templates coming from an untrusted source.

Severity

  • CVSS Score: 9.8 / 10 (Critical)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Arbitrary Code Execution in Handlebars

CVE-2019-20920 / GHSA-3cqr-58rm-57f8

More information

Details

Handlebars before 3.0.8 and 4.x before 4.5.3 is vulnerable to Arbitrary Code Execution. The lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript. This can be used to run arbitrary code on a server processing Handlebars templates or in a victim's browser (effectively serving as XSS).

Severity

  • CVSS Score: 8.1 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Prototype Pollution in handlebars

CVE-2021-23383 / GHSA-765h-qjxv-5f44

More information

Details

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Severity

  • CVSS Score: 9.8 / 10 (Critical)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Prototype Pollution in handlebars

GHSA-q42p-pg8m-cqh6

More information

Details

Versions of handlebars prior to 4.0.14 are vulnerable to Prototype Pollution. Templates may alter an Objects' prototype, thus allowing an attacker to execute arbitrary code on the server.

Recommendation

For handlebars 4.1.x upgrade to 4.1.2 or later.
For handlebars 4.0.x upgrade to 4.0.14 or later.

Severity

  • CVSS Score: 7.3 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Arbitrary Code Execution in handlebars

GHSA-2cf5-4w76-r9qv

More information

Details

Versions of handlebars prior to 3.0.8 or 4.5.2 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

The following template can be used to demonstrate the vulnerability:

Recommendation

Upgrade to version 3.0.8, 4.5.2 or later.

Severity

  • CVSS Score: 7.3 / 10 (High)
  • Vector String: CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:H/A:L

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Prototype Pollution in handlebars

GHSA-g9r4-xpmj-mj65

More information

Details

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to prototype pollution. It is possible to add or modify properties to the Object prototype through a malicious template. This may allow attackers to crash the application or execute Arbitrary Code in specific conditions.

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Severity

High

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Arbitrary Code Execution in handlebars

GHSA-q2c6-c6pm-g3gh

More information

Details

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It is due to an incomplete fix for a previous issue. This vulnerability can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Severity

High

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Handlebars.js has Prototype Pollution Leading to XSS through Partial Template Injection

CVE-2026-33916 / GHSA-2qvq-rjwj-gvw9

More information

Details

Summary

resolvePartial() in the Handlebars runtime resolves partial names via a plain property lookup on options.partials without guarding against prototype-chain traversal. When Object.prototype has been polluted with a string value whose key matches a partial reference in a template, the polluted string is used as the partial body and rendered without HTML escaping, resulting in reflected or stored XSS.

Description

The root cause is in lib/handlebars/runtime.js inside resolvePartial() and invokePartial():

// Vulnerable: plain bracket access traverses Object.prototype
partial = options.partials[options.name];

hasOwnProperty is never checked, so if Object.prototype has been seeded with a key whose name matches a partial reference in the template (e.g. widget), the lookup succeeds and the polluted string is returned. The runtime emits a prototype-access warning, but the partial is still resolved and its content is inserted into the rendered output unescaped. This contradicts the documented security model and is distinct from CVE-2021-23369 and CVE-2021-23383, which addressed data property access rather than partial template resolution.

Prerequisites for exploitation:

  1. The target application must be vulnerable to prototype pollution (e.g. via qs, minimist, or
    any querystring/JSON merge sink).
  2. The attacker must know or guess the name of a partial reference used in a template.
Proof of Concept
const Handlebars = require('handlebars');

// Step 1: Prototype pollution (via qs, minimist, or another vector)
Object.prototype.widget = '<img src=x onerror="alert(document.domain)">';

// Step 2: Normal template that references a partial
const template = Handlebars.compile('<div>Welcome! {{> widget}}</div>');

// Step 3: Render — XSS payload injected unescaped
const output = template({});
// Output: <div>Welcome! <img src=x onerror="alert(document.domain)"></div>

The runtime prints a prototype access warning claiming "access has been denied," but the partial still resolves and returns the polluted value.

Workarounds
  • Apply Object.freeze(Object.prototype) early in application startup to prevent prototype pollution. Note: this may break other libraries.
  • Use the Handlebars runtime-only build (handlebars/runtime), which does not compile templates and reduces the attack surface.

Severity

  • CVSS Score: 4.7 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

handlebars-lang/handlebars.js (handlebars)

v4.7.9

Compare Source

Commits

v4.7.8

Compare Source

Commits

v4.7.7

Compare Source

  • fix weird error in integration tests - eb860c0
  • fix: check prototype property access in strict-mode (#​1736) - b6d3de7
  • fix: escape property names in compat mode (#​1736) - f058970
  • refactor: In spec tests, use expectTemplate over equals and shouldThrow (#​1683) - 77825f8
  • chore: start testing on Node.js 12 and 13 - 3789a30

(POSSIBLY) BREAKING CHANGES:

  • the changes from version 4.6.0 now also apply
    in when using the compile-option "strict: true". Access to prototype properties is forbidden completely by default, specific properties or methods
    can be allowed via runtime-options. See #​1633 for details. If you are using Handlebars as documented, you should not be accessing prototype properties
    from your template anyway, so the changes should not be a problem for you. Only the use of undocumented features can break your build.

That is why we only bump the patch version despite mentioning breaking changes.

Commits

v4.7.6

Compare Source

Chore/Housekeeping:

Compatibility notes:

  • Restored Node.js compatibility

Commits

v4.7.5

Compare Source

Chore/Housekeeping:

  • Node.js version support has been changed to v6+ Reverted in 4.7.6

Compatibility notes:

  • Node.js < v6 is no longer supported Reverted in 4.7.6

Commits

v4.7.4

Compare Source

Chore/Housekeeping:

Compatibility notes:

  • No incompatibilities are to be expected

Commits

v4.7.3

Compare Source

Chore/Housekeeping:

  • #​1644 - Download links to aws broken on handlebarsjs.com - access denied (@​Tea56)
  • Fix spelling and punctuation in changelog - d78cc73

Bugfixes:

  • Add Type Definition for Handlebars.VERSION, Fixes #​1647 - 4de51fe
  • Include Type Definition for runtime.js in Package - a32d05f

Compatibility notes:

  • No incompatibilities are to be expected

Commits

v4.7.2

Compare Source

Bugfixes:

Chore/Build:

  • chore: execute saucelabs-task only if access-key exists - a4fd391

Compatibility notes:

  • No breaking changes are to be expected

Commits

v4.7.1

Compare Source

Bugfixes:

  • fix: fix log output in case of illegal property access - f152dfc
  • fix: log error for illegal property access only once per property - 3c1e252

Compatibility notes:

  • no incompatibilities are to be expected.

Commits

v4.7.0

Compare Source

Features:

  • feat: default options for controlling proto access - 7af1c12, #​1635
    • This makes it possible to disable the prototype access restrictions added in 4.6.0
    • an error is logged in the console, if access to prototype properties is attempted and denied
      and no explicit configuration has taken place.

Compatibility notes:

  • no compatibilities are expected

Commits


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from 4c6c446 to 255df82 Compare March 26, 2022 12:37
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from 255df82 to dabea8c Compare June 18, 2022 22:19
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from dabea8c to fcbcb22 Compare November 20, 2022 14:02
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from fcbcb22 to 16a793e Compare March 16, 2023 06:34
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from 16a793e to 5c56758 Compare August 10, 2025 14:35
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from 5c56758 to f05ad13 Compare September 25, 2025 16:45
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from f05ad13 to 04ae96d Compare December 3, 2025 18:10
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from 04ae96d to 07f9000 Compare January 19, 2026 17:34
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from 07f9000 to 1e7486e Compare February 12, 2026 14:15
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from 1e7486e to 6116100 Compare March 5, 2026 15:51
@renovate renovate Bot changed the title chore(deps): update dependency handlebars to v4.7.7 [security] chore(deps): update dependency handlebars to v4.7.7 [security] - autoclosed Mar 27, 2026
@renovate renovate Bot closed this Mar 27, 2026
@renovate renovate Bot deleted the renovate/npm-handlebars-vulnerability branch March 27, 2026 01:52
@renovate renovate Bot changed the title chore(deps): update dependency handlebars to v4.7.7 [security] - autoclosed chore(deps): update dependency handlebars to v4.7.9 [security] Mar 27, 2026
@renovate renovate Bot reopened this Mar 27, 2026
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from 6116100 to 979a444 Compare March 27, 2026 09:00
@renovate renovate Bot changed the title chore(deps): update dependency handlebars to v4.7.9 [security] chore(deps): update dependency handlebars to v4.7.9 [security] - autoclosed Apr 27, 2026
@renovate renovate Bot closed this Apr 27, 2026
@renovate renovate Bot changed the title chore(deps): update dependency handlebars to v4.7.9 [security] - autoclosed chore(deps): update dependency handlebars to v4.7.9 [security] Apr 27, 2026
@renovate renovate Bot reopened this Apr 27, 2026
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch 2 times, most recently from 979a444 to f1807a9 Compare April 27, 2026 21:30
@renovate renovate Bot force-pushed the renovate/npm-handlebars-vulnerability branch from f1807a9 to 26134c1 Compare May 12, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants