Critical Vulnerability in Batik Package: Untrusted Java Code Execution Risk

batik Updated 02 Oct 2025

Summary

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

UBUNTU-CVE-2022-41704: A vulnerability in Batik of Apache XML Graphics allows an attacker to run untrusted Java code from an SVG. Affects batik versions < 1.7.ubuntu-8ubuntu2.14.04.3+esm1. Fixed in 1.7.ubuntu-8ubuntu2.14.04.3+esm1. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Batik is an Apache XML Graphics package that provides a framework for handling SVG (Scalable Vector Graphics) files. It allows users to create, manipulate, and render SVG content in Java applications. The package is widely used for its ability to handle complex graphics and is integral to applications that require dynamic graphic rendering. However, a vulnerability has been identified that allows attackers to execute untrusted Java code from SVG files, posing a significant security risk.

Vulnerability Detail

The vulnerability, identified as CVE-2022-41704, originates from the Batik package's handling of SVG files. It allows an attacker to embed malicious Java code within an SVG, which can be executed when the SVG is processed by a vulnerable application. This could lead to unauthorized access, data breaches, or system compromise. The vulnerability affects versions of Batik prior to 1.16, making it crucial for users to update to the latest version to mitigate risks.

How To Fix

Minimum fixed version

1.7.ubuntu-8ubuntu2.14.04.3+esm1

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

As a temporary measure, users can avoid processing untrusted SVG files or implement strict validation and sanitization of SVG content before rendering it in applications. This can help mitigate the risk of executing malicious code.

Conclusion

The vulnerability in the Batik package poses a significant risk due to the potential for executing untrusted Java code from SVG files. Users are strongly advised to update to the latest patched versions to protect their applications from exploitation. Implementing workarounds can provide temporary relief until updates are applied.

See every vulnerability recorded for batik →

Share this vulnerability

FAQ

CVE-2022-41704 is a vulnerability in the Batik package that allows attackers to execute untrusted Java code from SVG files.

Versions of Batik prior to 1.16 are affected by this vulnerability.

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

The CVSS score of this vulnerability is 7.5, indicating a high severity level.

If immediate updates are not possible, avoid processing untrusted SVG files and implement strict validation and sanitization of SVG content.

Related vulnerabilities

Recent vulnerabilities recorded for batik.

How To Fix

Minimum fixed version

1.7.ubuntu-8ubuntu2.14.04.3+esm1

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

Follow Vulert in Google

Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.