# CVE-2026-31860: Unhead has a XSS bypass in `useHeadSafe` via attribute name injection and case-sensitive protocol check

- Severity: Medium 5.3 (CVSS:4.0, scored by GitHub_M) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.29%, higher than 23% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-03-12T14:19:15.000Z
- Modified: 2026-06-17T10:34:38.983Z
- Also known as: GHSA-g5xx-pwrp-g3fv
- Weaknesses: CWE-79
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- unjs unhead: < 2.1.11; before 2.1.11
- unhead (npm): before 2.1.11

## Every score

- GitHub_M: CVSS:4.0 5.3 Medium `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`
- GitHub: CVSS:4.0 Medium `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: CVSS:3.1 6.1 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`

## 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)

## Sources

- CVE List: [CVE-2026-31860](https://www.cve.org/CVERecord?id=CVE-2026-31860), CVE Terms of Use, modified 2026-03-13
- GitHub Advisory Database: [GHSA-g5xx-pwrp-g3fv](https://github.com/advisories/GHSA-g5xx-pwrp-g3fv), CC-BY-4.0, modified 2026-03-14
- NVD: [CVE-2026-31860](https://nvd.nist.gov/vuln/detail/CVE-2026-31860), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2026-31860 · Whole record: https://cve.day/CVE-2026-31860.json · Rebuilt by cve.day 2026-11-25T22:59:15.838Z
