Cloudanix VulnDB

GHSA-q42p-pg8m-cqh6

High · 7.3

CVSS

7.3

EPSS

—

Published

Jun 5, 2019

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A commonly used website templating component can be tricked with specially crafted input into changing how the application handles data, potentially causing errors or unsafe behavior.

Chainable
Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Moderate
Impact
Data Tampering
Component
Library
Class
Improper Input Validation
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

This vulnerability is a prototype pollution flaw in the Handlebars npm package. When vulnerable versions process attacker-controlled template data or helper inputs, specially crafted object keys such as prototype-related properties may modify JavaScript object prototypes. At a technical level, that can corrupt application object behavior, bypass logic that relies on inherited properties, cause unexpected template rendering behavior, and in some application patterns contribute to denial of service or further exploitation if polluted properties influence security-sensitive code paths.

Why it matters to the business

Applications that use vulnerable Handlebars versions may behave unpredictably when rendering templates or handling user-controlled data. The most likely business impacts are application errors, degraded availability, incorrect content generation, and possible security-control bypasses in applications that make authorization, validation, or rendering decisions based on polluted object properties. Although this issue is not listed in CISA KEV and no mature exploit is indicated in the provided data, Handlebars is a widely used templating library, so exposure can exist indirectly through transitive npm dependencies and older application builds.

How an attack unfolds

An attacker first identifies an application or service that uses a vulnerable Handlebars version and accepts data that is later passed into Handlebars rendering or helper logic. The attacker submits crafted JSON, form data, query parameters, or template-related input containing prototype pollution keys such as __proto__, constructor, or prototype. If the vulnerable code path merges or evaluates that input insecurely through Handlebars behavior, properties can be written onto a shared JavaScript prototype. Subsequent application logic may then read polluted inherited properties as if they were legitimate object fields, causing altered rendering behavior, crashes, validation bypasses, or other application-specific consequences. Successful impact depends heavily on how the application uses Handlebars and whether polluted properties influence security-sensitive decisions.

How to fix it

Upgrade Handlebars to a fixed version. For the 3.x line, upgrade to handlebars 3.0.7 or later. For affected 4.x releases, upgrade to handlebars 4.0.14 or later, or preferably 4.1.2 or later where compatible. Regenerate lockfiles after upgrading and ensure transitive dependencies do not continue to install a vulnerable Handlebars version. If immediate upgrade is not possible, reduce exposure by rejecting or sanitizing object keys commonly used for prototype pollution, including __proto__, prototype, and constructor; avoid merging untrusted objects into rendering contexts; freeze or create null-prototype objects for sensitive data structures where feasible; and restrict user control over templates, helpers, and rendering context objects.

How to confirm the fix worked

Confirm the installed Handlebars version using package manager metadata, lockfiles, and runtime dependency inspection. For npm-based projects, check package.json, package-lock.json, npm-shrinkwrap.json, yarn.lock, or pnpm-lock.yaml for handlebars versions and verify they resolve to 3.0.7, 4.0.14, 4.1.2, or later fixed releases as appropriate. Run npm audit, yarn audit, pnpm audit, or software composition analysis tooling to confirm the advisory no longer appears. Validate deployed artifacts as well as source repositories, because bundled JavaScript or container images may still include an old copy. Where possible, add regression tests that submit __proto__, constructor, and prototype keys into template-rendering inputs and verify Object.prototype is not modified and application output remains unchanged.

Typical attack path

  1. Identify a web application, API, build pipeline, or server-side rendering component that uses the vulnerable Handlebars npm package.
  2. Find an input path that reaches Handlebars template rendering, template compilation, helpers, or object-merging logic associated with rendering context data.
  3. Submit crafted input containing prototype pollution keys such as __proto__, constructor, or prototype with attacker-chosen property values.
  4. Trigger template rendering or application logic that causes the malicious property to be added to a JavaScript object prototype.
  5. Abuse the polluted prototype to alter application behavior, cause errors, influence rendered output, or bypass application-specific checks.
  6. Repeat or chain the condition with other weaknesses if polluted properties affect authorization, validation, command construction, or other sensitive logic.

How to detect it

Review application, web access, API gateway, WAF, and error logs for requests containing prototype pollution payloads, especially parameters or JSON bodies with __proto__, constructor.prototype, prototype, or nested variants encoded in URL, JSON, or form data. Focus on endpoints that accept template data, rendering context data, JSON bodies, profile/settings objects, document generation inputs, email template inputs, or content-management fields. Investigate spikes in 500 errors, template rendering exceptions, unexpected output changes, or crashes following such requests. In application telemetry, look for object merge or template rendering errors occurring after suspicious requests. For forensic review, inspect deployed dependency manifests and historical build artifacts to determine whether vulnerable Handlebars versions were present at the time of suspicious traffic. Because exploitation effects are application-specific and may not leave a unique artifact, detection should combine payload hunting with timeline correlation to rendering errors, anomalous behavior, and any downstream security-control bypass indicators.

  • __proto__
  • constructor.prototype
  • prototype[
  • __proto__[
  • __proto__.
  • %5F%5Fproto%5F%5F
  • %5f%5fproto%5f%5f
  • constructor%5Bprototype%5D
  • constructor.prototype.
  • "__proto__"
  • "constructor"
  • "prototype"
  • Cannot read property
  • Cannot set property
  • TypeError:
  • handlebars
  • Handlebars

What your security team should do

  • Inventory all applications and packages that directly or transitively include the handlebars npm package.
  • Prioritize upgrades for internet-facing services, server-side rendering components, administrative portals, CI/CD tooling, and applications that render user-controlled content.
  • Upgrade to the applicable fixed versions: 3.0.7 or later for the 3.x branch, 4.0.14 or later for affected 4.x use, and preferably 4.1.2 or later where compatible.
  • Regenerate and redeploy lockfiles, containers, and build artifacts so vulnerable bundled copies are not left in production.
  • Add dependency-scanning gates in CI to prevent reintroduction of vulnerable Handlebars versions.
  • Review template rendering paths for unsafe merging of untrusted objects and block prototype pollution keys at input boundaries.
  • Search historical logs for suspicious prototype pollution payloads and investigate related application errors or anomalous rendering behavior.

The record

Prototype Pollution in handlebars

Affected packages

Ecosystem Package Introduced Fixed
npm handlebars 0 3.0.7
npm handlebars 4.0.0 4.0.14
npm handlebars 4.1.0 4.1.2
Chainguard code-server 0 0
Chainguard code-server-compat 0 0
Chainguard gitlab-rails-ce-18.1 0 0
Chainguard gitlab-rails-ce-18.2 0 0
Chainguard gitlab-rails-ce-18.3 0 0
Chainguard gitlab-rails-ce-18.4 0 0
Chainguard gitlab-rails-ce-18.5 0 0
Chainguard gitlab-rails-ce-18.6 0 0
Chainguard gitlab-rails-ce-18.7 0 0
Chainguard gitlab-rails-ce-assets-18.1 0 0
Chainguard gitlab-rails-ce-assets-18.2 0 0
Chainguard gitlab-rails-ce-assets-18.3 0 0
Chainguard gitlab-rails-ce-assets-18.4 0 0
Chainguard gitlab-rails-ce-assets-18.5 0 0
Chainguard gitlab-rails-ce-assets-18.6 0 0
Chainguard gitlab-rails-ce-assets-18.7 0 0
Chainguard gitlab-rails-ce-assets-18.8 0 0
Chainguard gitlab-rails-ce-assets-18.9 0 0
Chainguard gitlab-rails-ce-assets-fips-18.1 0 0
Chainguard gitlab-rails-ce-assets-fips-18.2 0 0
Chainguard gitlab-rails-ce-assets-fips-18.3 0 0
Chainguard gitlab-rails-ce-assets-fips-18.4 0 0
Chainguard gitlab-rails-ce-assets-fips-18.5 0 0
Chainguard gitlab-rails-ce-assets-fips-18.6 0 0
Chainguard gitlab-rails-ce-assets-fips-18.7 0 0
Chainguard gitlab-rails-ce-assets-fips-18.8 0 0
Chainguard gitlab-rails-ce-assets-fips-18.9 0 0
Chainguard gitlab-rails-ce-doc-18.1 0 0
Chainguard gitlab-rails-ce-doc-18.2 0 0
Chainguard gitlab-rails-ce-doc-18.3 0 0
Chainguard gitlab-rails-ce-doc-18.4 0 0
Chainguard gitlab-rails-ce-doc-18.5 0 0
Chainguard gitlab-rails-ce-doc-18.6 0 0
Chainguard gitlab-rails-ce-doc-18.7 0 0
Chainguard gitlab-rails-ce-doc-fips-18.1 0 0
Chainguard gitlab-rails-ce-doc-fips-18.2 0 0
Chainguard gitlab-rails-ce-doc-fips-18.3 0 0
Chainguard gitlab-rails-ce-doc-fips-18.4 0 0
Chainguard gitlab-rails-ce-doc-fips-18.5 0 0
Chainguard gitlab-rails-ce-doc-fips-18.6 0 0
Chainguard gitlab-rails-ce-doc-fips-18.7 0 0
Chainguard gitlab-rails-ce-fips-18.1 0 0
Chainguard gitlab-rails-ce-fips-18.2 0 0
Chainguard gitlab-rails-ce-fips-18.3 0 0
Chainguard gitlab-rails-ce-fips-18.4 0 0
Chainguard gitlab-rails-ce-fips-18.5 0 0
Chainguard gitlab-rails-ce-fips-18.6 0 0
Chainguard gitlab-rails-ce-fips-18.7 0 0
Chainguard gitlab-rails-ee-17.0 0 0
Chainguard gitlab-rails-ee-17.1 0 0
Chainguard gitlab-rails-ee-17.10 0 0
Chainguard gitlab-rails-ee-17.11 0 0
Chainguard gitlab-rails-ee-17.2 0 0
Chainguard gitlab-rails-ee-17.3 0 0
Chainguard gitlab-rails-ee-17.4 0 0
Chainguard gitlab-rails-ee-17.6 0 0
Chainguard gitlab-rails-ee-17.7 0 0
Chainguard gitlab-rails-ee-17.8 0 0
Chainguard gitlab-rails-ee-17.9 0 0
Chainguard gitlab-rails-ee-assets-17.10 0 0
Chainguard gitlab-rails-ee-assets-17.11 0 0
Chainguard gitlab-rails-ee-assets-17.2 0 0
Chainguard gitlab-rails-ee-assets-17.3 0 0
Chainguard gitlab-rails-ee-assets-17.4 0 0
Chainguard gitlab-rails-ee-assets-17.6 0 0
Chainguard gitlab-rails-ee-assets-17.7 0 0
Chainguard gitlab-rails-ee-assets-17.8 0 0
Chainguard gitlab-rails-ee-assets-17.9 0 0
Chainguard gitlab-rails-ee-assets-fips-17.10 0 0
Chainguard gitlab-rails-ee-assets-fips-17.11 0 0
Chainguard gitlab-rails-ee-assets-fips-17.2 0 0
Chainguard gitlab-rails-ee-assets-fips-17.3 0 0
Chainguard gitlab-rails-ee-assets-fips-17.4 0 0
Chainguard gitlab-rails-ee-assets-fips-17.6 0 0
Chainguard gitlab-rails-ee-assets-fips-17.7 0 0
Chainguard gitlab-rails-ee-assets-fips-17.8 0 0
Chainguard gitlab-rails-ee-assets-fips-17.9 0 0
Chainguard gitlab-rails-ee-doc-17.10 0 0
Chainguard gitlab-rails-ee-doc-17.11 0 0
Chainguard gitlab-rails-ee-doc-17.2 0 0
Chainguard gitlab-rails-ee-doc-17.3 0 0
Chainguard gitlab-rails-ee-doc-17.4 0 0
Chainguard gitlab-rails-ee-doc-17.6 0 0
Chainguard gitlab-rails-ee-doc-17.7 0 0
Chainguard gitlab-rails-ee-doc-17.8 0 0
Chainguard gitlab-rails-ee-doc-17.9 0 0
Chainguard gitlab-rails-ee-doc-fips-17.10 0 0
Chainguard gitlab-rails-ee-doc-fips-17.11 0 0
Chainguard gitlab-rails-ee-doc-fips-17.2 0 0
Chainguard gitlab-rails-ee-doc-fips-17.3 0 0
Chainguard gitlab-rails-ee-doc-fips-17.4 0 0
Chainguard gitlab-rails-ee-doc-fips-17.6 0 0
Chainguard gitlab-rails-ee-doc-fips-17.7 0 0
Chainguard gitlab-rails-ee-doc-fips-17.8 0 0
Chainguard gitlab-rails-ee-doc-fips-17.9 0 0
Chainguard gitlab-rails-ee-fips-17.0 0 0
Chainguard gitlab-rails-ee-fips-17.1 0 0
Chainguard gitlab-rails-ee-fips-17.10 0 0
Chainguard gitlab-rails-ee-fips-17.11 0 0
Chainguard gitlab-rails-ee-fips-17.2 0 0
Chainguard gitlab-rails-ee-fips-17.3 0 0
Chainguard gitlab-rails-ee-fips-17.4 0 0
Chainguard gitlab-rails-ee-fips-17.6 0 0
Chainguard gitlab-rails-ee-fips-17.7 0 0
Chainguard gitlab-rails-ee-fips-17.8 0 0
Chainguard gitlab-rails-ee-fips-17.9 0 0
Wolfi code-server 0 0
Wolfi code-server-compat 0 0

Related vulnerabilities