Intel

AIKIDO-2026-84516

html-minifier-next is vulnerable to Cross-Site Scripting (XSS)

Cross-Site Scripting (XSS)GHSA-34rq-ghfm-r98r Published 3 days ago

61

Medium Risk

This Affects:

JShtml-minifier-next
4.6.0 - 7.5.1
Fixed in 7.5.2
Are you affected? Scan for Free

TL;DR

The minifier automatically processes the contents of JSON script elements such as application/json and application/ld+json by round-tripping them through JSON.parse() and JSON.stringify(). Because JSON.stringify() writes < and / literally, any \u003C escaping present in the source JSON is dropped from the output. A nested </script> sequence carried inside user-supplied JSON data can then terminate the containing script element early and inject live DOM, including a second executing script. The fix re-escapes < as \u003C after stringifying so encoded payloads can no longer break out of the script element.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you minify HTML that contains JSON script elements (such as application/json or application/ld+json) carrying untrusted, user-supplied content.

Background info

html-minifier-next is vulnerable to Cross-Site Scripting (XSS) in versions 4.6.0 - 7.5.1.

How to fix this

Upgrade the html-minifier-next library to the patch version.