Unhead has a XSS bypass in `useHeadSafe` via attribute name injection and case-sensitive protocol check
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Passive
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- None · None · None
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub. Impact type from CWE-79.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| unjs | unhead | before 2.1.11 | 2.1.11 | Patch available | CNA |
| — | unhead (npm) | before 2.1.11 | 2.1.11 | Patch available | GHSA-g5xx-pwrp-g3fv |
- unhead Vendorunjs Affected before 2.1.11 Fixed in 2.1.11 Patch available CNA
- unhead (npm) Vendor— Affected before 2.1.11 Fixed in 2.1.11 Patch available GHSA-g5xx-pwrp-g3fv
Remediation
- Fix · CNA unhead (unjs) Fixed in 2.1.11
- Fix · GHSA-g5xx-pwrp-g3fv unhead (npm) Fixed in 2.1.11 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2026-31860
- 2026-10-03 Alias added: GHSA-g5xx-pwrp-g3fv
References
More unjs Unhead vulnerabilities
- TI-2026-24425 Unhead has a Bypass of URI Scheme Sanitization in makeTagSafe via Case-Sensitivity CVSS 3.1MEDIUM 6.1
- TI-2026-28305 Unhead has a hasDangerousProtocol() bypass via leading-zero padded HTML entities in useHeadSafe() CVSS 3.1MEDIUM 6.1
Sources
- CVE-2026-31860 · CVE Program
- CVE-2026-31860 · NVD
- FIRST EPSS
- GHSA-g5xx-pwrp-g3fv · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences