CVE-2019-20920: Arbitrary Code Execution in Handlebars

handlebars Updated 02 Oct 2025

Summary

10/02/2022
Yes i
High
8.1

CVE-2019-20920: Arbitrary Code Execution in Handlebars. Affects handlebars across 2 version ranges.

< 3.0.8 >= 4.0.0, < 4.5.3

Fixed in 3.0.8 or 4.5.3, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2019-20920 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Handlebars is a popular JavaScript templating engine used for rendering dynamic web pages. It provides a simple and intuitive syntax for generating HTML content. However, versions before 3.0.8 and 4.x before 4.5.3 are vulnerable to Arbitrary Code Execution. This vulnerability arises from the lookup helper's failure to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript. As a result, an attacker can run arbitrary code on a server processing Handlebars templates or in a victim's browser, effectively serving as a cross-site scripting (XSS) attack.

Vulnerability Detail

The vulnerability in Handlebars allows an attacker to inject and execute arbitrary JavaScript code. By exploiting the lookup helper's lack of template validation, an attacker can craft malicious templates that execute arbitrary code. This can lead to various consequences, such as remote code execution on the server, compromising user data, or performing actions on behalf of the victim. The vulnerability has a CVSS score of 8.1, indicating a high severity level.

How To Fix

Latest published version: 4.7.10 as of 22 Oct 2026

npm install handlebars@4.7.10

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 3.0.8 3.0.8
    npm install handlebars@3.0.8
  • >= 4.0.0, < 4.5.3 4.5.3
    npm install handlebars@4.5.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a workaround, if updating Handlebars is not immediately feasible, it is recommended to disable or remove the lookup helper from the codebase. By removing the lookup helper, the vulnerability can be mitigated. Here is an example of how to remove the lookup helper:

// Remove the lookup helper
Handlebars.unregisterHelper('lookup');

Conclusion

In conclusion, Handlebars versions before 3.0.8 and 4.x before 4.5.3 are vulnerable to Arbitrary Code Execution. It is crucial to update Handlebars to the fixed versions or remove the lookup helper to mitigate this vulnerability. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for handlebars →

Share this vulnerability

FAQ

Handlebars is a JavaScript templating engine used for generating dynamic HTML content.

Versions before 3.0.8 and 4.x before 4.5.3 are affected by this vulnerability.

This vulnerability allows an attacker to execute arbitrary JavaScript code, potentially leading to remote code execution, data compromise, or unauthorized actions on behalf of the victim.

To fix this vulnerability, update Handlebars to version 3.0.8 or later for versions before 4.x, and version 4.5.3 or later for versions 4.x.

Yes, you can remove or disable the lookup helper from your codebase as a temporary workaround.

Related vulnerabilities

Recent vulnerabilities recorded for handlebars.

How To Fix

Latest published version: 4.7.10 as of 22 Oct 2026

npm install handlebars@4.7.10

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 3.0.8 3.0.8
    npm install handlebars@3.0.8
  • >= 4.0.0, < 4.5.3 4.5.3
    npm install handlebars@4.5.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback