Impact
Unhead’s useHeadSafe() previously attempted to defend against dangerous protocols by decoding HTML entities before checking for blocked URI schemes. The decoder used fixed‑width regular expressions, which silently skipped leading‑zero padded numeric character references that exceeded the digit cap. As a result, entities such as ﻭ were left undecoded and passed to a simple startsWith('javascript:') test that failed to detect the malicious protocol. The unsafe string was then written directly to the server‑side rendered HTML, where browsers decode it natively and construct the blocked URI, allowing an attacker to execute arbitrary JavaScript in all browsers that load the page. This flaw has the same effect as a client‑side XSS flaw that can lead to session hijacking, data theft, or defacement. The weakness is a classic case of CWE‑184: Unexpected Interpretation of Parameters, where malformed input bypasses validation logic. From the information supplied, the vulnerability does not allow direct server‑side code execution; its impact is confined to the client context, enabling attackers to run scripts in the browser.
Affected Systems
The affected product is the Node.js library Unhead by the unjs organization. All releases prior to version 2.1.13 are vulnerable, including any upstream Nuxt.js projects that use useHeadSafe() to render user‑supplied content in the document head.
Risk and Exploitability
The CVSS score of 6.1 indicates a moderate severity, primarily because the attack requires the ability to inject content into the <head> area of a page. The EPSS score of less than 1% suggests a low probability of existing exploitation, and the vulnerability is not currently listed in the CISA KEV catalog. However, because the flaw enables attackers to run arbitrary JavaScript in the browsers of all users who view the affected page, the potential damage can be substantial if the content is widely accessed. The likely attack vector is the insertion of specially crafted payloads that include leading‑zero padded entities through user‑controlled fields that are passed to useHeadSafe().
OpenCVE Enrichment
Github GHSA