CVE-2022-28367: Cross-site Scripting in OWASP AntiSamy
Summary
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
- libowasp-antisamy-java · Debian:11
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.
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.
No signup required · Results in about 60 seconds
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 →
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.