Mutation XSS Vulnerability in AntiSamy Library (CVE-2024-23635)

libowasp-antisamy-java Updated 02 Oct 2025

Summary

02/02/2024
N/A
No i
Medium
6.1

CVE-2024-23635: AntiSamy is a library for performing fast, configurable cleansing of HTML coming from untrusted sources. Affects libowasp-antisamy-java versions < 12a2e31d3855430c119480655c2bbbbb79a66ecd. 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

AntiSamy is a widely-used library designed for the fast and configurable cleansing of HTML content originating from untrusted sources. It is particularly valuable for web applications that need to sanitize user-generated content to prevent security threats. The library allows users to define policies for sanitization, including options to preserve comments in the HTML. However, prior to version 1.7.5, a significant vulnerability existed that could lead to mutation cross-site scripting (mXSS) attacks when the 'preserveComments' directive was enabled.

Vulnerability Detail

The vulnerability arises from a flaw in the parsing mechanism of the AntiSamy library, which can lead to mXSS when the 'preserveComments' directive is active in the policy file. This flaw allows malicious actors to craft inputs that exploit the sanitization process, resulting in executable elements being interpreted from comment tags in the sanitized output. The potential ramifications include unauthorized script execution in the context of the user's browser, leading to data theft, session hijacking, or other malicious activities.

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 upgrading is not immediately feasible, a temporary workaround is to disable the 'preserveComments' directive in your AntiSamy policy file. This can be done by modifying the policy XML file to set <preserveComments>false</preserveComments>. However, this may affect the functionality of your application if comments are essential.

Conclusion

The mutation XSS vulnerability in the AntiSamy library (CVE-2024-23635) poses a significant risk to applications that utilize this library for HTML sanitization. Users are strongly advised to upgrade to version 1.7.5 or later to mitigate this risk. Additionally, reviewing and updating policy files is crucial to ensure that the 'preserveComments' directive is appropriately configured.

See every vulnerability recorded for libowasp-antisamy-java →

Share this vulnerability

FAQ

CVE-2024-23635 is a vulnerability in the AntiSamy library that allows for mutation XSS attacks when the 'preserveComments' directive is enabled.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which analyzes your manifest file for vulnerabilities.

Exploiting this vulnerability can lead to unauthorized script execution, potentially resulting in data theft, session hijacking, or other malicious activities.

Yes, you can temporarily mitigate the risk by disabling the 'preserveComments' directive in your AntiSamy policy file.

The CVSS score of this vulnerability is 6.1, indicating a moderate level of severity.

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