Unhead has a 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 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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2026-31860
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 2 Nov 2026, 23:58 UTC · Revision 1
Source evidence
Unhead has a XSS bypass in `useHeadSafe` via attribute name injection and case-sensitive protocol check
core-osv · Original sourcePublished 12 Mar 2026, 17:18 UTC
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 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.
osv:CVE-2026-31860
Complete source record
{
"id": "ff65f8718b8b7302230b62136db641f1c8d09fdff475274a8829f645c6a99c3a",
"url": "https://osv.dev/vulnerability/CVE-2026-31860",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Unhead has a XSS bypass in `useHeadSafe` via attribute name injection and case-sensitive protocol check",
"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 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.",
"evidence": "osv:CVE-2026-31860",
"products": [],
"severity": "medium",
"structured": {
"id": "CVE-2026-31860",
"aliases": [
"CVE-2026-31860",
"GHSA-g5xx-pwrp-g3fv"
],
"metrics": [
{
"type": "CVSS_V4",
"score": "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"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/unjs/unhead",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "59ef1e2ea9008e55765030fccd32d20bb8fdbd1e"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "0"
},
{
"fixed": "2.1.11"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"cpe": "cpe:2.3:a:unjs:unhead:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "0"
},
{
"fixed": "2.1.11"
}
],
"source": "CPE_RANGE"
}
]
}
}
],
"versions": [
"v2.1.10",
"v2.1.9",
"v2.1.8",
"v2.1.7",
"v2.1.6",
"v2.1.5",
"v2.1.4",
"v2.1.3",
"v2.1.2",
"v2.1.1",
"v2.1.0",
"v2.0.19",
"v2.0.18",
"v2.0.17",
"v2.0.16",
"v2.0.15",
"v2.0.14",
"v2.0.13",
"v2.0.12",
"v2.0.11",
"v2.0.10",
"v2.0.9",
"v2.0.8",
"v2.0.7",
"v2.0.6",
"v2.0.5",
"v2.0.4",
"v2.0.3",
"v2.0.2",
"v2.0.1",
"v2.0.0",
"v2.0.0-rc.13",
"v2.0.0-rc.12",
"v2.0.0-rc.11",
"v2.0.0-rc.8",
"v2.0.0-rc.7",
"2.0.0-rc.6",
"v2.0.0-rc.6",
"v2.0.0-rc.5",
"v2.0.0-rc.4",
"v2.0.0-rc.3",
"v2.0.0-rc.2",
"v2.0.0-rc.1",
"v2.0.0-beta.2",
"v2.0.0-beta.1",
"v2.0.0-beta.0",
"v2.0.0-alpha.32",
"v2.0.0-alpha.31",
"v2.0.0-alpha.30",
"v2.0.0-alpha.29",
"v2.0.0-alpha.28",
"v2.0.0-alpha.27",
"v2.0.0-alpha.26",
"v2.0.0-alpha.25",
"v2.0.0-alpha.24",
"v2.0.0-alpha.23",
"v1.11.15",
"v2.0.0-alpha.22",
"v2.0.0-alpha.21",
"v2.0.0-alpha.20",
"v2.0.0-alpha.7",
"v2.0.0-alpha.6",
"v2.0.0-alpha.5",
"v2.0.0-alpha.4",
"v2.0.0-alpha.3",
"v2.0.0-alpha.2",
"v2.0.0-alpha.1",
"v2.0.0-alpha.0",
"v1.11.9",
"v1.11.8",
"v1.10.0",
"v1.10.0-beta.6",
"v1.10.0-beta.5",
"v1.10.0-beta.4",
"v1.10.0-beta.3",
"v1.10.0-beta.2",
"v1.10.0-beta.1",
"v1.9.16",
"v1.9.15",
"v1.9.14",
"v1.9.13",
"v1.9.12",
"v1.9.11",
"v1.9.10",
"v1.9.9",
"v1.9.8",
"v1.9.7",
"v1.9.6",
"v1.9.5",
"v1.9.4",
"v1.9.3",
"v1.9.2",
"v1.9.1",
"v1.9.0",
"v1.8.20",
"v1.8.19",
"v1.8.18",
"v1.8.17",
"v1.8.16",
"v1.8.15",
"v1.8.14",
"v1.8.13",
"v1.8.12",
"v1.8.11",
"v1.8.10",
"v1.8.9",
"v1.8.8",
"v1.8.7",
"v1.8.6",
"v1.8.5",
"v1.8.4",
"v1.8.3",
"v1.8.2",
"v1.8.1",
"v1.8.0",
"v1.7.5",
"v1.7.4",
"v1.7.3",
"v1.7.2",
"v1.7.1",
"v1.7.0",
"v1.6.2",
"v1.6.1",
"v1.6.0",
"v1.5.5",
"v1.5.4",
"v1.5.3",
"v1.5.2",
"v1.5.1",
"v1.5.0",
"v1.4.1",
"v1.4.0",
"v1.3.9",
"v1.3.8",
"v1.3.7",
"v1.3.6",
"v1.3.5",
"v1.3.4",
"v1.3.3",
"v1.3.2",
"v1.3.1",
"v1.3.0",
"v1.2.2",
"v1.2.1",
"v1.2.0",
"v1.1.35",
"v1.1.34",
"v1.1.33",
"v1.1.32",
"v1.1.31",
"v1.1.30",
"v1.1.29",
"v1.1.28",
"v1.1.27",
"v1.1.26",
"v1.1.25",
"v1.1.24",
"v1.1.17",
"v1.1.16",
"v1.1.14",
"v1.1.13",
"v1.1.12",
"v1.1.11",
"v1.1.10",
"v1.1.9",
"v1.1.8",
"v1.1.7",
"v1.1.6",
"v1.1.5",
"v1.1.4",
"v1.1.3",
"v1.1.2",
"v1.1.1",
"v1.1.0",
"v1.0.22",
"v1.0.21",
"v1.0.20",
"v1.0.19",
"v1.0.18",
"v1.0.17",
"v1.0.16",
"v1.0.15",
"v1.0.13",
"v1.0.12",
"v1.0.11",
"v1.0.10",
"v1.0.9",
"v1.0.8",
"v1.0.7",
"v1.0.6",
"v1.0.5",
"v1.0.4",
"v1.0.3",
"v1.0.2",
"v1.0.1",
"v1.0.0",
"v0.7.1",
"v0.7.0",
"v0.6.9",
"v0.6.8",
"v0.6.7",
"v0.6.6",
"v0.6.5",
"v0.6.4",
"v0.6.3",
"v0.6.2",
"v0.6.1",
"v0.6.0",
"v0.5.1",
"v0.5.0",
"v0.4.8",
"v0.4.7",
"v0.4.6",
"v0.4.5",
"v0.4.4",
"v0.4.3",
"v0.4.2",
"v0.4.1",
"v0.4.0",
"v0.3.1",
"v0.3.0",
"v0.2.7",
"v0.2.6",
"v0.2.5",
"v0.2.4",
"v0.2.3",
"v0.2.2",
"v0.2.1",
"v0.2.0",
"v0.1.4",
"v0.1.3",
"v0.1.2",
"v0.1.1",
"v0.1.0",
"v0.0.7",
"v0.0.6",
"v0.0.5",
"v0.0.4",
"v0.0.3",
"v0.0.2",
"v0.0.1"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-31860.json"
}
}
],
"modified": "2026-10-28T02:30:24.349417438Z",
"provider": "osv",
"references": [
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31860.json",
"https://github.com/unjs/unhead/security/advisories/GHSA-g5xx-pwrp-g3fv",
"https://nvd.nist.gov/vuln/detail/CVE-2026-31860"
],
"provider_metadata": {
"cwe_ids": [
"CWE-79"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31860.json"
}
},
"related_cves": [
{
"value": "CVE-2026-31860",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 491020,
"published_at": "2026-03-12T17:18:20.452+00:00"
}