{"id":"CVE-2026-39315","published":"2026-04-09T17:54:07Z","modified":"2026-04-13T15:38:52Z","title":"Unhead has a hasDangerousProtocol() bypass via leading-zero padded HTML entities in useHeadSafe()","vendor":"unjs","product":"unhead","tier":"tail","description":{"text":"Unhead is a document head and template manager. Prior to 2.1.13, 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. The HTML5 specification imposes no limit on leading zeros in numeric character references. 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. This vulnerability is fixed in 2.1.13.","provenance":"source","from":"CVE.org"},"cvss":{"score":6.1,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00351,"percentile":0.21172,"provenance":"source"},"cwes":[{"id":"CWE-184","name":"Incomplete List of Disallowed Inputs"}],"references":[{"url":"https://github.com/unjs/unhead/security/advisories/GHSA-95h2-gj7x-gx9w","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/unjs/unhead/commit/961ea781e091853812ffe17f8cda17105d2d2299","tags":["x_refsource_MISC"]},{"url":"https://github.com/unjs/unhead/releases/tag/v2.1.13","tags":["x_refsource_MISC"]}],"priority":{"score":8.5,"factors":[{"name":"EPSS percentile","points":4.23},{"name":"CVSS severity","points":4.27}]},"vendorSlug":"unjs","affectedVersions":[{"vendor":"unjs","product":"unhead","versions":["< 2.1.13"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"partial","timestamp":"2026-04-13T15:28:38.766188Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"unhead","vulnerableRanges":["<2.1.13"],"patched":["2.1.13"],"from":["GHSA-95h2-gj7x-gx9w"],"provenance":"source"}],"summary":{"text":"Unhead's useHeadSafe() composable, which Nuxt recommends for rendering user-supplied content in the document head, fails to block dangerous URI schemes (javascript:, data:, vbscript:) when they are written as HTML entities padded with extra leading zeros, because its entity decoder silently skips such values and the undecoded string passes the protocol check. An attacker who can supply a value rendered through this composable can get a dangerous-scheme URL into server-rendered HTML, where the browser decodes it and executes it, but only if a user interacts with the resulting link or element.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:10:28Z"},"euvd":{"id":"EUVD-2026-20992","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-unjs-unhead-cve-2026-31860","parents":[{"from":"CVE-2026-31860","to":"CVE-2026-39315","relation":"successor","confidence":"high","kind":"lineage","evidence":[{"kind":"version-step","provenance":"source","package":"npm:unhead","fromFixed":"2.1.11","toFixed":"2.1.13","daysApart":28},{"kind":"same-code","provenance":"machine","files":["packages/unhead/src/plugins/safe.ts"],"commits":["https://github.com/unjs/unhead/commit/9ecc4f9568b0e23938f36d4b23fcfa4a18a89045","https://github.com/unjs/unhead/commit/961ea781e091853812ffe17f8cda17105d2d2299"],"basis":"rarely changed file"},{"kind":"similar","provenance":"machine","score":0.34,"basis":"same product + description similarity"}]}],"packageHistory":[{"cve":"CVE-2026-31860","published":"2026-03-12","fixed":"2.1.11","kev":false},{"cve":"CVE-2026-31873","published":"2026-03-12","fixed":"2.1.11","kev":false},{"cve":"CVE-2026-39315","published":"2026-04-09","fixed":"2.1.13","kev":false}],"package":"npm:unhead"}}