XSS Vulnerability in OWASP AntiSamy - libowasp-antisamy-java Package

libowasp-antisamy-java Updated 02 Oct 2025

Summary

19/07/2021
N/A
No i
Medium
6.1

CVE-2021-35043: OWASP AntiSamy before 1.6.4 allows XSS via HTML attributes when using the HTML output serializer (XHTML is not affected). Affects libowasp-antisamy-java versions < 605b26a7f9c83535f844a8f0fa17d3d2e7761e80. No fix is published. How to fix ↓

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 Java library designed to sanitize user input and ensure that HTML content adheres to a defined policy. It is widely used to prevent cross-site scripting (XSS) attacks by filtering out potentially harmful HTML and JavaScript. However, versions prior to 1.6.4 are susceptible to an XSS vulnerability when using the HTML output serializer, which can lead to security breaches if not addressed.

Vulnerability Detail

The vulnerability identified as CVE-2021-35043 allows for cross-site scripting (XSS) attacks through the manipulation of HTML attributes in the libowasp-antisamy-java package. This issue arises when the HTML output serializer is used, permitting attackers to inject malicious scripts via specially crafted inputs. The vulnerability was demonstrated using a 'javascript:' URL with a specific character replacement, which could lead to unauthorized script execution in the user's browser. The potential ramifications include data theft, session hijacking, and other malicious activities that exploit the trust of the user.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If immediate upgrading is not possible, consider implementing input validation and sanitization measures to filter out potentially harmful inputs. Additionally, avoid using the HTML output serializer until the package is updated. You can also use alternative libraries that provide similar functionality without the vulnerability.

Conclusion

The CVE-2021-35043 vulnerability in the libowasp-antisamy-java package poses a significant risk of XSS attacks through improper handling of HTML attributes. It is crucial for users of this library to upgrade to the latest version to mitigate these risks and ensure the security of their applications.

See every vulnerability recorded for libowasp-antisamy-java →

Share this vulnerability

FAQ

CVE-2021-35043 is a vulnerability in the OWASP AntiSamy library that allows for XSS attacks through HTML attributes when using the HTML output serializer.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Exploitation of this vulnerability can lead to unauthorized script execution, data theft, and session hijacking, posing significant security risks.

Yes, you can implement input validation and sanitization measures and avoid using the HTML output serializer until the package is updated.

The CVSS score for CVE-2021-35043 is 6.1, indicating a medium severity level.

Related vulnerabilities

Recent vulnerabilities recorded for libowasp-antisamy-java.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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