CVE-2026-16231

hbs vulnerable to XSS via registerAsyncHelper output-escaping bypass

Published Aug 25, 2026 CVSS 3.1 · 8.1 High EPSS < 1% KEV · Not listed
Description
hbs is an Express view engine that wraps Handlebars. Its registerAsyncHelper API bypasses Handlebars' automatic HTML escaping: an async helper returns an opaque placeholder during the first render pass, so the double-brace expression escapes only the placeholder, and after rendering hbs substitutes the placeholder with the raw callback return value without escaping it, across the cached, uncached, and layout render paths. An application that passes attacker-influenced data, for example user-supplied content from a database, into an async helper callback can therefore have arbitrary HTML and JavaScript injected into the server-rendered page, resulting in stored or reflected cross-site scripting. Versions 2.1.0 through 4.2.1 are affected, and the issue is fixed in 4.3.0, which HTML-escapes async helper output. Applications that intentionally emit raw HTML from an async helper can opt in explicitly with hbs.SafeString. Users should upgrade to 4.3.0.

Analysis

AI-generated

Technical impact

The hbs view engine’s registerAsyncHelper API bypasses Handlebars’ automatic HTML escaping. When an async helper returns a placeholder during the first render pass, Handlebars escapes the placeholder but later replaces it with the raw return value without escaping, allowing attacker‑supplied data to inject arbitrary HTML or JavaScript. This is a classic input validation flaw (CWE‑79) that can lead to stored or reflected cross‑site scripting, compromising confidentiality, integrity, and availability of the web application.

Affected Systems

Versioned releases of the hbs Express view engine from 2.1.0 through 4.2.1 are affected. The issue is fixed in 4.3.0, which properly HTML‑escapes async helper output. Applications that deliberately need to render raw HTML in an async helper should use hbs.SafeString to opt‑in.

Risk and Exploitability

With a CVSS score of 8.1, the vulnerability poses a high risk. The EPSS score is not available, and the vulnerability is not listed in the CISA KEV catalog. The likely attack vector is an attacker–controlled input that is passed to an async helper callback, either directly or via a database. Based on the description, it is inferred that the attacker must supply data that reaches the async helper; once executed, the placeholder substitution mechanism injects unsanitized content into the rendered page, enabling session hijacking, defacement, or further attacks. Given that the flaw exists in all rendering paths and that no special privileges or network access are required beyond influencing data, exploitation is highly feasible in vulnerable installations.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade hbs to version 4.3.0 or later.
  • If raw HTML is intentionally required, use hbs.SafeString to opt‑in.
  • Validate and sanitize any user‑supplied data before passing it to async helper callbacks.

Generated by OpenCVE AI on August 25, 2026 at 11:21 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
First Time appeared Hbs Project
Hbs Project hbs
CPEs cpe:2.3:a:hbs_project:hbs:*:*:*:*:*:node.js:*:*
Vendors & Products Hbs Project
Hbs Project hbs
Type Values Removed Values Added
First Time appeared Hbs
Hbs hbs
Vendors & Products Hbs
Hbs hbs
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description hbs is an Express view engine that wraps Handlebars. Its registerAsyncHelper API bypasses Handlebars' automatic HTML escaping: an async helper returns an opaque placeholder during the first render pass, so the double-brace expression escapes only the placeholder, and after rendering hbs substitutes the placeholder with the raw callback return value without escaping it, across the cached, uncached, and layout render paths. An application that passes attacker-influenced data, for example user-supplied content from a database, into an async helper callback can therefore have arbitrary HTML and JavaScript injected into the server-rendered page, resulting in stored or reflected cross-site scripting. Versions 2.1.0 through 4.2.1 are affected, and the issue is fixed in 4.3.0, which HTML-escapes async helper output. Applications that intentionally emit raw HTML from an async helper can opt in explicitly with hbs.SafeString. Users should upgrade to 4.3.0.
Title hbs vulnerable to XSS via registerAsyncHelper output-escaping bypass
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N'}

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
openjs
Published
Updated
Aug 25, 2026, 7:47 PM
Reserved
Jul 18, 2026, 5:03 PM
Status
Analyzed
Published
Aug 25, 2026, 10:18 AM
Modified
Oct 6, 2026, 10:10 PM