Skip to content
Heist/ feed
Back to feed
High

hbs vulnerable to XSS via registerAsyncHelper output-escaping bypass

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-16231
Confirmed fixed CVEs
Not specified
Updated in this feed
2 Nov 2026, 23:58 UTC · Revision 1

Source evidence

hbs vulnerable to XSS via registerAsyncHelper output-escaping bypass

core-osv · Original source

Published 25 Aug 2026, 10:00 UTC

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.

osv:CVE-2026-16231
Complete source record
{
  "id": "2aea4fd24ef82a5afd4eca3995afeb93547dc672b9fef65819bd9c7b9aded52e",
  "url": "https://osv.dev/vulnerability/CVE-2026-16231",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "hbs vulnerable to XSS via registerAsyncHelper output-escaping bypass",
    "summary": "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.",
    "evidence": "osv:CVE-2026-16231",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2026-16231",
      "aliases": [
        "CVE-2026-16231",
        "GHSA-rg36-rxv9-2m9q"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/pillarjs/hbs",
              "type": "GIT",
              "events": [
                {
                  "introduced": "544f5b0c5a6f5e449c4710e80c950be501fab3d7"
                },
                {
                  "fixed": "2f979ff3c3cef96413d016b5abda881223795033"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "2.1.0"
                      },
                      {
                        "fixed": "4.3.0"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StandardRange"
                  },
                  {
                    "cpe": "cpe:2.3:a:hbs_project:hbs:*:*:*:*:*:node.js:*:*",
                    "range": [
                      {
                        "introduced": "2.1.0"
                      },
                      {
                        "fixed": "4.3.0"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v4.2.1",
            "v4.2.0",
            "v4.1.2",
            "v4.1.1",
            "v4.1.0",
            "v4.0.6",
            "v4.0.5",
            "v4.0.4",
            "v4.0.3",
            "v4.0.2",
            "v4.0.1",
            "v4.0.0",
            "v3.1.1",
            "v3.1.0",
            "v3.0.1",
            "v3.0.0",
            "v2.9.0",
            "v2.8.0",
            "v2.7.0",
            "v2.6.0",
            "v2.5.0",
            "v2.4.0",
            "v2.3.1",
            "v2.3.0",
            "v2.1.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-16231.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:24.570437329Z",
      "provider": "osv",
      "references": [
        "https://cna.openjsf.org/security-advisories.html",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/16xxx/CVE-2026-16231.json",
        "https://github.com/pillarjs/hbs/security/advisories/GHSA-rg36-rxv9-2m9q",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-16231"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-79"
        ],
        "cna_assigner": "openjs",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/16xxx/CVE-2026-16231.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-16231",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 491012,
  "published_at": "2026-08-25T10:00:09.678+00:00"
}