GHSA-q2c6-c6pm-g3gh: Handlebars Arbitrary Code Execution Vulnerability

HIGH
Published
Advisory Summary

GHSA-q2c6-c6pm-g3gh is a HIGH arbitrary code execution vulnerability (General Security Weakness) affecting Handlebars libraries in the npm ecosystem. The issue involves arbitrary code execution in handlebars. Remediation is available by upgrading affected packages to version 3.0.8, 4.5.3.

GHSA-q2c6-c6pm-g3gh at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-q2c6-c6pm-g3gh
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Handlebars
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-q2c6-c6pm-g3gh

To remediate this vulnerability, upgrade all affected Handlebars dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

handlebars fixed: 3.0.8
npm install handlebars@3.0.8
handlebars fixed: 4.5.3
npm install handlebars@4.5.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls handlebars

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-q2c6-c6pm-g3gh, inspect your project dependencies using npm:

npm ls handlebars

Analyze the terminal output to locate any version of Handlebars in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.8), your application is affected.

Note: The npm ls handlebars command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Handlebars, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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](https://www.npmjs.com/advisories/1316). 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.

GHSA-q2c6-c6pm-g3gh Affected Handlebars Versions

2 component(s)
Fixed Versions:
3.0.84.5.3
Product / Package Ecosystem Affected Versions Fixed Version
handlebars
npm
< 3.0.8
3.0.8
handlebars
npm
≥ 4.0.0
< 4.5.3
4.5.3

References

Frequently Asked Questions

What is GHSA-q2c6-c6pm-g3gh?
GHSA-q2c6-c6pm-g3gh is a security vulnerability in Handlebars involving Arbitrary Code Execution in handlebars under General Security Weakness.
Which Handlebars versions are affected?
Affected versions include releases prior to 3.0.8, 4.5.3 across affected packages: handlebars.
What version fixes GHSA-q2c6-c6pm-g3gh?
Upgrading to 3.0.8, 4.5.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is handlebars affected?
Yes, handlebars is affected in releases prior to 3.0.8, 4.5.3. Upgrade your dependency to 3.0.8, 4.5.3 or later.
What CWE is associated with GHSA-q2c6-c6pm-g3gh?
GHSA-q2c6-c6pm-g3gh is classified under General Security Weakness.
How can I check npm dependencies for GHSA-q2c6-c6pm-g3gh?
Run the dependency tree command: 'npm ls handlebars'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-q2c6-c6pm-g3gh",
  "modified" : "2020-08-31T18:55:11Z",
  "published" : "2020-09-04T15:07:38Z",
  "aliases" : [ ],
  "summary" : "Arbitrary Code Execution in handlebars",
  "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](https://www.npmjs.com/advisories/1316). 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).\n\n\n## Recommendation\n\nUpgrade to version 3.0.8, 4.5.3 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "handlebars"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.0.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "handlebars"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.5.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1324"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:55:11Z",
    "nvd_published_at" : null
  }
}