Critical Java Code Execution Vulnerability in Apache Batik

batik Updated 02 Oct 2025

Summary

25/10/2022
N/A
Yes i
High
7.5

CVE-2022-42890: A vulnerability in Batik of Apache XML Graphics allows an attacker to run Java code from untrusted SVG via JavaScript. Affects batik across 2 version ranges.

< 1.12-4+deb11u1 >= 1b708df57205a70c2c9fb8235ff5eab837609968, < 8e94aaaf3872a670040c6faebe82c907cb380fad

Fixed in 1.12-4+deb11u1. 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

Apache Batik is a powerful toolkit for working with SVG (Scalable Vector Graphics) in Java. It allows developers to create, manipulate, and render SVG content. However, prior to version 1.16, Batik had a significant vulnerability that could allow untrusted SVG files to execute arbitrary Java code via JavaScript, posing a serious security risk to applications using this library.

Vulnerability Detail

The vulnerability identified as CVE-2022-42890 allows an attacker to exploit the Batik library by embedding malicious JavaScript within SVG files. When these SVG files are processed by an application using Batik, the untrusted JavaScript can execute Java code, potentially leading to unauthorized access, data manipulation, or system compromise. This vulnerability affects all versions of Apache Batik prior to 1.16, making it critical for users to upgrade to the latest version to mitigate risks.

How To Fix

Minimum fixed version

1.12-4+deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade batik

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

Workaround

If upgrading is not immediately possible, consider implementing strict input validation to sanitize SVG files before processing them with Batik. This can help mitigate the risk of executing malicious JavaScript. Additionally, avoid processing SVG files from untrusted sources.

Conclusion

The CVE-2022-42890 vulnerability in Apache Batik poses a significant risk by allowing untrusted SVG files to execute arbitrary Java code. Users are strongly advised to upgrade to version 1.16 or later to mitigate this risk. Implementing input validation and using tools like Vulert can help monitor and protect against such vulnerabilities.

See every vulnerability recorded for batik →

Share this vulnerability

FAQ

CVE-2022-42890 is a vulnerability in Apache Batik that allows untrusted SVG files to execute arbitrary Java code via JavaScript.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. By checking your manifest file like package-lock.json, you can identify if your application is affected by this vulnerability.

If exploited, this vulnerability can lead to unauthorized access, data manipulation, or even complete system compromise, depending on the permissions of the application using Batik.

Yes, you can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

The CVSS score for CVE-2022-42890 is 7.5, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for batik.

How To Fix

Minimum fixed version

1.12-4+deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade batik

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