Skip to main content
VulnerabilityPublished

CVE-2026-31860: unjs unhead · Cross-site Scripting

Affects unjs unheadSource CVE Database V5

0
Compare

Not known to be exploited · CVSS 5.3 Medium : upgrade to 2.1.11 when convenient.

Data as of 30 Oct 2026, 11:52 UTC

CVSS 4.0 base score
5.3Medium
How severe the flaw is on the 0–10 CVSS scale.
EPSS
0.2% chance of exploitation in 30 days – higher than 19% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
Patch
Available – fixed in 2.1.11
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

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 12 Mar 2026

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponized: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 30 Oct 2026.

What to do

Upgrade unjs unhead to 2.1.11.

Affected software

ProductAffectedFixed in
unjsunheadAffected
  • <2.1.11
Fixed in
  • 2.1.11
npmunheadpkg:npm/unheadOther threatsAffected
  • <2.1.11
Fixed in
  • 2.1.11

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

The primary mitigation is to upgrade unhead to version 2.1.11 or later, where the vulnerability is fixed. Organizations should audit their dependencies and ensure no legacy versions remain in production. Additionally, developers should review usage of useHeadSafe() and avoid relying solely on it for sanitization of user-generated content. Implementing strict input validation and sanitization on all user inputs before passing them to head management functions is critical. Employ Content Security Policy (CSP) headers to restrict script execution sources and mitigate impact of potential XSS. Monitoring and logging unusual script execution or attribute injection attempts in SSR contexts can help detect exploitation attempts. Security teams should educate developers on secure handling of HTML attributes and the limitations of data-attribute prefixes as a security boundary. Finally, conduct regular dependency vulnerability scans and integrate automated patch management to reduce exposure time.

Description

CVE-2026-31860 is a medium severity cross-site scripting (XSS) vulnerability in the unhead package, a document head and template manager used in SSR contexts. Versions prior to 2.1.11 allow attackers to bypass the useHeadSafe() composable, which is intended to safely handle user-generated content, by injecting arbitrary HTML attributes including event handlers into <head> tags. The vulnerability arises because the acceptDataAttrs function only checks if attribute keys start with 'data-' but does not validate for spaces or special characters that can break HTML attribute parsing, enabling malicious payloads. This flaw affects server-side rendered pages and requires user interaction to trigger. Although no known exploits are reported, the vulnerability can lead to client-side script execution, impacting confidentiality and integrity of user sessions. The issue is fixed in version 2.1.11.

References

Community reviews

Loading reviews…