{"id":"CVE-2026-31860","published":"2026-03-12T17:18:20Z","modified":"2026-03-13T16:26:51Z","title":"Unhead has a XSS bypass in `useHeadSafe` via attribute name injection and case-sensitive protocol check","vendor":"unjs","product":"unhead","tier":"tail","description":{"text":"Unhead is a document head and template manager. Prior to 2.1.11, useHeadSafe() can be bypassed to inject arbitrary HTML attributes, including event handlers, into SSR-rendered <head> tags. This is the composable that Nuxt docs recommend for safely handling user-generated content. The acceptDataAttrs function (safe.ts, line 16-20) allows any property key starting with data- through to the final HTML. It only checks the prefix, not whether the key contains spaces or other characters that break HTML attribute parsing. This vulnerability is fixed in 2.1.11.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.3,"severity":"MEDIUM","version":"4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00321,"percentile":0.17558,"provenance":"source"},"cwes":[{"id":"CWE-79","name":"Improper Neutralization of Input During Web Page Generation"}],"references":[{"url":"https://github.com/unjs/unhead/security/advisories/GHSA-g5xx-pwrp-g3fv","tags":["x_refsource_CONFIRM"]}],"priority":{"score":7.2,"factors":[{"name":"EPSS percentile","points":3.51},{"name":"CVSS severity","points":3.71}]},"vendorSlug":"unjs","affectedVersions":[{"vendor":"unjs","product":"unhead","versions":["< 2.1.11"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"partial","timestamp":"2026-03-13T16:26:47.686961Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"unhead","vulnerableRanges":["<2.1.11"],"patched":["2.1.11"],"from":["GHSA-g5xx-pwrp-g3fv"],"provenance":"source"}],"summary":{"text":"Unhead, a document head and template manager, has a flaw in its useHeadSafe() composable in which the acceptDataAttrs function accepts any property key beginning with \"data-\" without checking for characters, such as spaces, that break HTML attribute parsing, allowing arbitrary attributes to be injected into SSR-rendered head tags. An unauthenticated remote attacker can exploit this by supplying crafted input that is rendered into the page head, but exploitation requires a user to interact with the affected page.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:14:55Z"},"euvd":{"id":"EUVD-2026-11639","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-unjs-unhead-cve-2026-31860","children":[{"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"}}