CVE-2022-36033: XSS Vulnerability in org.jsoup:jsoup

org.jsoup:jsoup Updated 02 Oct 2025

Summary

01/09/2022
Yes i
Moderate
6.1

CVE-2022-36033: jsoup may not sanitize code injection XSS attempts if SafeList.preserveRelativeLinks is enabled. Affects org.jsoup:jsoup versions < 1.15.3. Fixed in 1.15.3. How to fix ↓

Also tracked for

The same CVE-2022-36033 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

org.jsoup:jsoup is an open-source Java library used for parsing HTML and manipulating HTML documents. It provides a convenient API for extracting and manipulating data from HTML documents. However, a vulnerability has been discovered in jsoup that could allow for cross-site scripting (XSS) attacks if certain conditions are met.

Vulnerability Detail

The vulnerability in jsoup arises from its handling of HTML containing javascript: URL expressions. By embedding control characters into the href attribute value, an attacker can bypass the URL validation check and inject malicious code. If the SafeList.preserveRelativeLinks option is enabled and a Content Security Policy is not set, the unsanitized HTML can lead to XSS attacks. This can be particularly dangerous for sites that accept user input HTML and use jsoup to sanitize it.

How To Fix

Latest published version: 1.23.2 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.15.3

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

To temporarily mitigate the vulnerability without upgrading, follow these steps:

  1. Disable the SafeList.preserveRelativeLinks option in jsoup.
  2. Implement a Content Security Policy that disallows javascript expressions in link URLs.

Conclusion

The XSS vulnerability in org.jsoup:jsoup can be mitigated by upgrading to version 1.15.3 or later, cleaning previously persisted content, and implementing a Content Security Policy. Disabling the SafeList.preserveRelativeLinks option can provide temporary mitigation. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for org.jsoup:jsoup →

Share this vulnerability

FAQ

The vulnerability allows for potential cross-site scripting (XSS) attacks on sites that accept user input HTML and use jsoup to sanitize it. If the SafeList.preserveRelativeLinks option is enabled and a Content Security Policy is not set, an attacker can inject malicious code that may be executed when a reader clicks on a crafted link.

To fix this vulnerability, upgrade to jsoup version 1.15.3 or later. Additionally, ensure that any previously persisted content is cleaned using the updated version. If immediate upgrading is not possible, disable the SafeList.preserveRelativeLinks option and implement a Content Security Policy that disallows javascript expressions in link URLs.

Yes, you can temporarily mitigate the vulnerability by disabling the SafeList.preserveRelativeLinks option in jsoup and implementing a Content Security Policy that disallows javascript expressions in link URLs.

A Content Security Policy (CSP) defines the allowed sources of various types of content in a web page. By disallowing javascript expressions in link URLs, a CSP can prevent the execution of injected malicious code, effectively mitigating the XSS vulnerability.

There is no known public exploit for this vulnerability at the time of this advisory. However, it is important to promptly apply the recommended fixes to prevent potential exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for org.jsoup:jsoup.

How To Fix

Latest published version: 1.23.2 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.15.3

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