CVE-2026-31860
MEDIUM 5.3CVSS 4.0Unhead has XSS bypass in `useHeadSafe` via attribute name injection and case-sensitive protocol check
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.
- Published
- 12 Mar 2026
- Last modified
- 17 Jun 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Analyzed
- Weakness
- CWE-79
- Also known as
- GHSA-g5xx-pwrp-g3fv
- Sources
- NVDJSONOSV GHSA-g5xx-pwrp-g3fvJSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | security-advisories@github.com (Secondary) | CVSS 4.0 | MEDIUM 5.3 | 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X |
| OSV | GitHub | CVSS 4.0 | 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 | |
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | MEDIUM 6.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | unjs | unheadcpe:2.3:a:unjs:unhead:*:*:*:*:*:*:*:* |
< 2.1.11 | 2.1.11 |
| OSV | npm | unhead | < 2.1.11 | 2.1.11 |
References
- https://github.com/unjs/unhead/security/advisories/GHSA-g5xx-pwrp-g3fv · Exploit, Mitigation, Vendor Advisory, WEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-31860 · ADVISORY
- https://github.com/unjs/unhead/commit/9ecc4f9568b0e23938f36d4b23fcfa4a18a89045 · WEB
- https://github.com/unjs/unhead · PACKAGE
- https://github.com/unjs/unhead/releases/tag/v2.1.11 · WEB
History
- 25 Nov 2026 21:01 UTC · NVD: first stored (published 12 Mar 2026)
- 25 Nov 2026 20:11 UTC · OSV: first stored (published 12 Mar 2026)