Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. unhead
  4. ›
  5. CVE-2026-39315

CVE-2026-39315: Unhead has a hasDangerousProtocol() bypass via leading-zero padded HTML entities in useHeadSafe()

April 9, 2026

useHeadSafe() is the composable that Nuxt’s own documentation explicitly recommends for rendering user-supplied content in <head> safely. Internally, the hasDangerousProtocol() function in packages/unhead/src/plugins/safe.ts decodes HTML entities before checking for blocked URI schemes (javascript:, data:, vbscript:). The decoder uses two regular expressions with fixed-width digit caps:

// Current — vulnerable
const HtmlEntityHex = /&#x([0-9a-f]{1,6});?/gi
const HtmlEntityDec = /&#(\d{1,7});?/g

The HTML5 specification imposes no limit on leading zeros in numeric character references. Both of the following are valid, spec-compliant encodings of : (U+003A):

  • &#0000000058; — 10 decimal digits, exceeds the \d{1,7} cap
  • &#x000003A; — 7 hex digits, exceeds the [0-9a-f]{1,6} cap

When a padded entity exceeds the regex digit cap, the decoder silently skips it. The undecoded string is then passed to startsWith('javascript:'), which does not match. makeTagSafe() writes the raw value directly into SSR HTML output. The browser’s HTML parser decodes the padded entity natively and constructs the blocked URI.

Note: This is a separate, distinct issue from CVE-2026-31860 / GHSA-g5xx-pwrp-g3fv, which was an attribute key injection via the data-* prefix. This finding targets the attribute value decoder — a different code path with a different root cause and a different fix.


References

  • github.com/advisories/GHSA-95h2-gj7x-gx9w
  • github.com/unjs/unhead
  • github.com/unjs/unhead/commit/961ea781e091853812ffe17f8cda17105d2d2299
  • github.com/unjs/unhead/releases/tag/v2.1.13
  • github.com/unjs/unhead/security/advisories/GHSA-95h2-gj7x-gx9w
  • nvd.nist.gov/vuln/detail/CVE-2026-39315

Code Behaviors & Features

Detect and mitigate CVE-2026-39315 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 2.1.13

Fixed versions

  • 2.1.13

Solution

Upgrade to version 2.1.13 or above.

Impact 6.1 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Learn more about CVSS

Weakness

  • CWE-184: Incomplete List of Disallowed Inputs

Source file

npm/unhead/CVE-2026-39315.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:15:18 +0000.