The vulnerability is a Cross-Site Scripting (XSS) issue in the OWASP Java HTML Sanitizer, identified as GHSA-g9gq-3pfx-2gw2. It arises from the improper handling of HTML content when a specific, non-default policy is configured. The exploit requires the policy to permit both <noscript> and <style> tags, and critically, to allow text content within <style> elements using the .allowTextIn("style") method.
The core of the problem is a flaw in the sanitizer's parsing logic. When it encounters a malicious string like <noscript><style></noscript><script>alert(1)</script>, it incorrectly processes the </noscript> tag as a valid tag closure, even though it's inside a <style> block that should be treated as text. This results in a sanitized output that, when rendered by a browser, allows a <script> tag to be executed outside the intended sanitized context. The browser's unique parsing rules for <noscript> content contribute to the successful execution of the script.
The primary vulnerable function is org.owasp.html.PolicyFactory.sanitize, as this is the method that performs the flawed sanitization. The org.owasp.html.HtmlPolicyBuilder.allowTextIn method is also identified as a key function, as it enables the specific configuration that exposes the vulnerability. An engineer with this CVE in their environment should be aware that any use of the sanitizer with this particular combination of policy rules is at risk and should be remediated by avoiding this configuration until a patch is available.