Advisories for Npm/Unhead package

2026

Unhead has a hasDangerousProtocol() bypass via leading-zero padded HTML entities in useHeadSafe()

useHeadSafe() is the composable that Nuxt's own documentation explicitly recommends for rendering user-supplied content in <head> safely. Internally, the hasDangerousProtocol() function in packages/unhead/src/plugins/safe.ts decodes HTML entities before checking for blocked URI schemes (javascript:, data:, vbscript:). The decoder uses two regular expressions with fixed-width digit caps: // Current — vulnerable const HtmlEntityHex = /&#x([0-9a-f]{1,6});?/gi const HtmlEntityDec = /&#(\d{1,7});?/g The HTML5 specification imposes no limit on leading zeros in numeric character references. …