upatch.dev

CVE-2026-90993

Apache XML Graphics Batik: Harden validation in SAXDocumentFactory

Refuses local host file opens by Apache Batik java processes to mitigate XML external entity injection CVE-2026-90993.

High 7.5Vetted

EPSS 0.5%: the estimated chance this CVE is exploited in the next 30 days, as of 25 Nov 2026.

At a glance

CVE-2026-90993 is a high (CVSS 7.5) vulnerability in Apache XML Graphics Batik, published 11 November 2026. A vetted upatch, cve-2026-90993-xxe-block, blocks it on running Linux machines with shirudo until Apache XML Graphics Batik is upgraded.

Severity
High 7.5 CVSS 3.1
Chance of exploitation
0.5% in the next 30 days (EPSS, 25 Nov 2026)
Known exploited
No, not on CISA’s KEV list
Weakness
CWE-611
Affected software
Apache XML Graphics Batik (Apache Software Foundation)
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

CVE-2026-90993 (BATIK-1399, CWE-611), "Apache XML Graphics Batik: Harden validation in SAXDocumentFactory", was published on 11 November 2026 and affects Apache XML Graphics Batik through 1.19. While SAXDocumentFactory.createDocument(InputSource) and the static saxFactory initializer in org.apache.batik.dom.util.SAXDocumentFactory disable external entities on parsers they construct, the overload SAXDocumentFactory.createDocument(String ns, String root, String uri, XMLReader r) attaches this as ContentHandler, DTDHandler, and EntityResolver on the caller-supplied XMLReader and calls r.parse(uri) without disabling external general entities, external parameter entities, or external DTD loading. When a Java service calls createDocument(ns, root, uri, r) with a default XMLReader on an SVG or XML document that declares a DOCTYPE with an external SYSTEM entity such as file:///etc/hostname or file:///etc/passwd, the parser opens the local file and expands its contents into the parsed DOM tree. Version 1.20 (commit ae70b4dececdc33cc79f86d43135ac8c230e094c) fixes the vulnerability by setting http://xml.org/sax/features/external-general-entities, http://xml.org/sax/features/external-parameter-entities, and http://apache.org/xml/features/nonvalidating/load-external-dtd to false on r before parsing.

Official description

XXE vulnerability in Apache XML Graphics Batik. This issue affects Apache XML Graphics Batik: through 1.19. Users are recommended to upgrade to version 1.20, which fixes the issue.

Affected versions

Apache XML Graphics Batik through 1.19; fixed in 1.20 (commit ae70b4dececdc33cc79f86d43135ac8c230e094c).

Kernels: any Linux kernel supported by shirudo with BPF LSM (lsm/file_open) and BTF enabled, including Linux 7.4.

Sources

More references from NVD (3)

Mitigation

One BPF LSM program attached to lsm/file_open returns -EPERM when all of the following hold:

Condition Checked
Regular file (dentry->d_inode->i_mode & S_IFMT) == S_IFREG
Guarded host path Directly in /etc (excluding standard resolver, locale, and loader files hosts, resolv.conf, nsswitch.conf, localtime, timezone, ld.so.cache, gai.conf, and host.conf), directly in /root, or in /home/<user>
Batik Java process Current task executable (mm->exe_file) is java and the first 256 bytes of its command line (mm->arg_start to mm->arg_end) contain batik

When the XMLReader inside SAXDocumentFactory.createDocument tries to open a guarded local file such as /etc/hostname to resolve a file:/// external entity, openat fails with EPERM and createDocument throws an IOException instead of incorporating the file's contents into the DOM. A refusal from an earlier BPF LSM program on the same hook is preserved, and key 0 of the refused per-CPU array map counts refused file opens.

Side effects

  • Any java process whose initial command-line arguments contain batik within the first 256 bytes cannot open regular files directly in /etc (other than the listed resolver and locale files), /root, or /home/<user>.
  • Normal Batik SVG and XML DOM parsing, reading TLS trust stores under /etc/ssl/ or /etc/java-*, and all file accesses by other processes or non-Batik JVMs continue to work.
  • Not covered: a JVM whose classpath places batik beyond the first 256 bytes of mm->arg_start or loads Batik JARs only through a custom class loader or @argfile, or external entity references targeting application files outside /etc, /root, and /home/<user>.

Preemption model and cost

The program holds no locks and updates its per-CPU refused counter with __sync_fetch_and_add, making it safe under every preemption model including PREEMPT_LAZY, PREEMPT_DYNAMIC, and PREEMPT_RT. On every file_open outside /etc, /root, and /home/<user>, the program checks only the inode mode and the parent and grandparent dentry names before returning 0, avoiding task lookups and user-memory reads on normal file operations.

The policy

134 lines of BPF C, attached at lsm/file_open.

// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause

#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.h>

#define EPERM 1
#define S_IFMT 0170000
#define S_IFREG 0100000

char _license[] SEC("license") = "Dual BSD/GPL";

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, __u64);
} refused SEC(".maps");

static __always_inline void count_refused(void)
{
	__u32 key = 0;
	__u64 *value = bpf_map_lookup_elem(&refused, &key);

	if (value)
		__sync_fetch_and_add(value, 1);
}

static __always_inline bool name_is(const struct dentry *dentry,
				    const char *want, __u32 want_len)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	char buf[16] = {};

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) != want_len ||
	    want_len > sizeof(buf) - 1)
		return false;
	if (bpf_probe_read_kernel_str(buf, sizeof(buf), name) < 0)
		return false;
	for (__u32 i = 0; i < sizeof(buf) - 1; i++) {
		if (i == want_len)
			return true;
		if (buf[i] != want[i])
			return false;
	}
	return false;
}

static __always_inline bool is_root_dentry(const struct dentry *dentry)
{
	return dentry && dentry == BPF_CORE_READ(dentry, d_parent);
}

static __always_inline bool is_allowed_etc_file(const struct dentry *dentry)
{
	return name_is(dentry, "hosts", 5) ||
	       name_is(dentry, "resolv.conf", 11) ||
	       name_is(dentry, "nsswitch.conf", 13) ||
	       name_is(dentry, "localtime", 9) ||
	       name_is(dentry, "timezone", 8) ||
	       name_is(dentry, "ld.so.cache", 11) ||
	       name_is(dentry, "gai.conf", 8) ||
	       name_is(dentry, "host.conf", 9);
}

static __always_inline bool is_guarded_host_file(const struct dentry *dentry)
{
	const struct dentry *parent = BPF_CORE_READ(dentry, d_parent);
	const struct dentry *grand = BPF_CORE_READ(parent, d_parent);
	umode_t mode = BPF_CORE_READ(dentry, d_inode, i_mode);

	if ((mode & S_IFMT) != S_IFREG)
		return false;
	if (name_is(parent, "etc", 3) && is_root_dentry(grand))
		return !is_allowed_etc_file(dentry);
	if (name_is(parent, "root", 4) && is_root_dentry(grand))
		return true;
	if (name_is(grand, "home", 4) &&
	    is_root_dentry(BPF_CORE_READ(grand, d_parent)))
		return true;
	return false;
}

static __always_inline bool has_batik_cmdline(struct task_struct *task)
{
	unsigned long start = BPF_CORE_READ(task, mm, arg_start);
	unsigned long end = BPF_CORE_READ(task, mm, arg_end);
	unsigned long len;
	char buf[256] = {};

	if (!start || end <= start)
		return false;
	len = end - start;
	if (len > sizeof(buf))
		len = sizeof(buf);
	if (bpf_probe_read_user(buf, (__u32)len, (const void *)start))
		return false;
	for (__u32 i = 0; i <= sizeof(buf) - 5; i++) {
		if (buf[i] == 'b' && buf[i + 1] == 'a' && buf[i + 2] == 't' &&
		    buf[i + 3] == 'i' && buf[i + 4] == 'k')
			return true;
	}
	return false;
}

static __always_inline bool current_is_batik(void)
{
	struct task_struct *task = bpf_get_current_task_btf();
	const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);

	if (!name_is(exe, "java", 4))
		return false;
	return has_batik_cmdline(task);
}

static __always_inline int earlier_verdict(int ret)
{
	return ret >= -4095 && ret < 0 ? ret : -EPERM;
}

SEC("lsm/file_open")
int BPF_PROG(cve_2026_90993_open, struct file *file, int ret)
{
	const struct dentry *dentry = file->f_path.dentry;

	if (ret)
		return earlier_verdict(ret);
	if (!is_guarded_host_file(dentry) || !current_is_batik())
		return 0;
	count_refused();
	return -EPERM;
}

Process

How this upatch was written, checked and reviewed, from the registry’s history.

  1. 11 Nov 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #104 openedAdd CVE-2026-90993: Refuses local host file opens by Apache Batik java processes to mitigate XMLromanlab
  3. 25 Nov 2026CICheck entriespassed
  4. 25 Nov 2026CIingestpassed
  5. 25 Nov 2026CICompile with clang 23passed
  6. 25 Nov 2026MergeMerged #104romanlab

No human review is recorded on GitHub for this upatch yet.

Evidence

On Apache XML Graphics Batik 1.19, the loaded upatch refused SAXDocumentFactory.createDocument opening /etc/hostname during external entity resolution while allowing normal SVG parsing.

Tested
25 Nov 2026
Target
Apache XML Graphics Batik 1.19 (SAXDocumentFactory.createDocument with XMLReader) on OpenJDK 21, listening on 127.0.0.1:18093
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Distribution
Ubuntu 26.04
Results
StateXXE file:///etc/hostname read blockedNormal SVG parsing works
Before loadingnoyes
Upatch loadedyesyes
After unloadingnoyes
tools-test.log Output of tools/test --setup before, while, and after loading cve-2026-90993-xxe-block.
tools/test --setup, 2026-11-25T16:24:12Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-90993
  setup   done         BATIK_URL=http://127.0.0.1:18093
  before  reached      SAXDocumentFactory.createDocument resolved file:///etc/hostname
  loaded  blocked      the upatch refused SAXDocumentFactory opening /etc/hostname
  after   reached      SAXDocumentFactory.createDocument resolved file:///etc/hostname
  PASS: reached before, blocked while loaded, reached again after

Use it

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-90993
Publish and roll out
shirudo bpm push build/packages/cve-2026-90993-1.0.0.bee oci://<registry>/<namespace>/cve-2026-90993 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-90993-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>