CVE-2022-28367: Cross-site Scripting in OWASP AntiSamy

org.owasp.antisamy:antisamy Updated 02 Oct 2025

Summary

23/04/2022
Yes i
Moderate
6.1

CVE-2022-28367: Cross-site Scripting in OWASP AntiSamy. Affects org.owasp.antisamy:antisamy versions < 1.6.6. Fixed in 1.6.6. How to fix ↓

Also tracked for

The same CVE-2022-28367 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

OWASP AntiSamy is a library designed to cleanse HTML from untrusted sources. It provides fast and configurable sanitization to prevent cross-site scripting (XSS) attacks. The library is commonly used in Maven projects with the package name 'org.owasp.antisamy:antisamy'. However, versions prior to 1.6.6 are vulnerable to a specific XSS issue.

Vulnerability Detail

The vulnerability in OWASP AntiSamy (CVE-2022-28367) allows for XSS attacks through HTML tag smuggling on STYLE content. This occurs due to improper encoding of Cascading Style Sheets (CSS) content by the output serializer. An attacker can exploit this vulnerability to inject malicious scripts into web pages, potentially leading to unauthorized access, data theft, or other malicious activities.

How To Fix

Minimum fixed version

1.6.6

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can manually sanitize and encode the STYLE content before passing it to OWASP AntiSamy. Ensure that all user-generated input is properly validated and sanitized to prevent XSS attacks. Here's an example of how to sanitize the STYLE content using Java and OWASP Java Encoder library:

import org.owasp.encoder.Encode;

String styleContent = request.getParameter("style");
String sanitizedStyle = Encode.forHtmlContent(styleContent);
// Pass the sanitizedStyle to OWASP AntiSamy

Remember, this is just a temporary solution, and it is strongly recommended to upgrade to the latest secure version of OWASP AntiSamy.

Conclusion

In conclusion, the vulnerability (CVE-2022-28367) in OWASP AntiSamy allows for XSS attacks through HTML tag smuggling on STYLE content. It is crucial to upgrade to version 1.6.6 or later of the 'org.owasp.antisamy:antisamy' package to mitigate this vulnerability. Additionally, ensure proper input validation and sanitization to prevent XSS attacks. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for org.owasp.antisamy:antisamy →

Share this vulnerability

FAQ

OWASP AntiSamy is a library that provides fast and configurable cleansing of HTML from untrusted sources. It helps prevent cross-site scripting (XSS) attacks by sanitizing user-generated HTML input.

The vulnerability allows for XSS attacks through HTML tag smuggling on STYLE content. An attacker can inject malicious scripts into web pages, potentially leading to unauthorized access, data theft, or other malicious activities.

Versions prior to 1.6.6 of the 'org.owasp.antisamy:antisamy' package are affected by this vulnerability.

To fix this vulnerability, upgrade to version 1.6.6 or later of the 'org.owasp.antisamy:antisamy' package in your Maven project.

As a temporary workaround, you can manually sanitize and encode the STYLE content before passing it to OWASP AntiSamy. However, it is strongly recommended to upgrade to the latest secure version.

Related vulnerabilities

Recent vulnerabilities recorded for org.owasp.antisamy:antisamy.

How To Fix

Minimum fixed version

1.6.6

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback