Intel

AIKIDO-2026-74136

swc_html_minifier is vulnerable to Cross-Site Scripting (XSS)

Cross-Site Scripting (XSS)GHSA-5qr2-v392-m9g8 Published 2 days ago

61

Medium Risk

This Affects:

RUSTswc_html_minifier
0.4.1 - 58.0.0
Fixed in 59.0.0
Are you affected? Scan for Free

TL;DR

The HTML minifier in swc_html_minifier compresses JSON embedded in script elements such as application/json and application/ld+json by parsing and re-serializing the JSON value. During serialization it can turn escaped less-than sequences like \u003C back into literal < characters, so a script-closing sequence inside the JSON can terminate the containing script element early because HTML tokenization runs before the JSON is consumed. When the minified HTML embeds user-controlled JSON data, inert data can become active markup and execute script in the origin of the generated page. The fix re-escapes less-than signs after JSON serialization so the script element boundary is preserved.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you minify HTML that embeds user-controlled JSON inside a script element such as application/json or application/ld+json.

Background info

swc_html_minifier is vulnerable to Cross-Site Scripting (XSS) in versions 0.4.1 - 58.0.0.

How to fix this

Upgrade the swc_html_minifier library to the patch version.