# CVE-2026-85714: Stirling-PDF: Remote Code Execution via H2

The Markdown version of <https://upatch.dev/cve/CVE-2026-85714>. Last updated 25 Nov 2026.

## At a glance

CVE-2026-85714 is rated Critical 9.1 (CVSS 3.1, CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H). It affects Stirling-PDF (Stirling-Tools) and was published on 14 Oct 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 3.4%: the estimated chance it is exploited in the next 30 days, as of 24 Nov 2026. The upatch `cve-2026-85714-import-block` mitigates it, and is vetted (merged into the registry).

A upatch is a signed BPF program that shirudo loads into a running Linux kernel to block the code path this CVE's exploit takes. It holds the line until the fix ships; it does not replace patching.

## The vulnerability

CVE-2026-85714 (GHSA-mrr8-934j-4g8m), published on 14 October 2026, is a remote code execution vulnerability in Stirling-PDF prior to 2.13.2 when running with the default H2 database and security mode enabled. An authenticated administrator can upload a crafted `.sql` file to `POST /api/v1/database/import-database` (`DatabaseController.importDatabase`), which writes the upload to `Files.createTempFile("backup_", ".sql")` and passes it to `DatabaseService.importDatabaseFromUI()`. In `DatabaseService.validateSqlContent()`, statements split on `;` are accepted whenever they match any pattern in `ALLOWED_PATTERNS` (`CREATE`, `INSERT INTO`, `VALUES`, `NULL`, and others). Dangerous H2 functions and statements such as `FILE_READ`, `CSVWRITE`, and `CREATE ALIAS` embedded inside allowed statements pass validation and execute when `verifyBackup()` and `executeDatabaseScript()` run `RUNSCRIPT FROM ?`. An existing `backup_*.sql` file in `backup/db/` can also be imported through `GET /api/v1/database/import-database-file/{fileName}`.

### Official description

Stirling-PDF is a locally hosted web application that facilitates various operations on PDF files. Prior to 2.13.2, an authenticated administrator using the default H2 database and security mode can upload a crafted SQL file to POST /api/v1/database/import-database. DatabaseService.validateSqlContent() splits normalized input on semicolons and accepts a statement when it contains any allowed keyword, allowing dangerous H2 functions such as FILE_READ and CSVWRITE, plus CREATE ALIAS, to bypass the insufficient whitelist and execute side effects when RUNSCRIPT processes the file. This permits arbitrary file access. The demonstrated operating-system command execution chain writes attacker-controlled startup files to a user-site location and then triggers an application Python interpreter configured to load those startup files, resulting in command execution as the JVM service account. This issue is fixed in version 2.13.2.

## What the upatch does

Two BPF LSM programs return `-EPERM` to processes whose executable is named `java` when acting on a file whose name starts with `backup_` and ends with `.sql` inside either Stirling-PDF's `stirling-tmp` temporary directory or its `backup/db` backup directory:

| Hook               | Refused                                                           |
| ------------------ | ----------------------------------------------------------------- |
| `lsm/inode_create` | Creating a `backup_*.sql` file in `stirling-tmp/` or `backup/db/` |
| `lsm/file_open`    | Opening a `backup_*.sql` file in `stirling-tmp/` or `backup/db/`  |

Refusing `backup_*.sql` creation and open in `stirling-tmp/` stops `DatabaseController.importDatabase` at `Files.createTempFile("backup_", ".sql")` before `DatabaseService.importDatabaseFromUI()` or H2 `RUNSCRIPT` can read the uploaded SQL. Refusing `backup_*.sql` in `backup/db/` also stops `DatabaseController.importDatabaseFromBackupUI` and `DatabaseService.importDatabase()` from executing an existing backup script. Each program tests the first byte of the file name (`b`) first and returns immediately for other files.

The `refused` per-CPU array counts refusals: key 0 for creates, key 1 for opens.

The policy: [`cve-2026-85714-import-block.bpf.c`](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-85714), 146 lines of BPF C attached at `lsm/inode_create` and `lsm/file_open`, licensed GPL-2.0 OR BSD-2-Clause.

## Side effects

- Uploading a database backup to `POST /api/v1/database/import-database` fails with HTTP 500 because the `backup_*.sql` temporary file cannot be created.
- Importing, exporting, or downloading `backup_*.sql` files in `backup/db/` fails while the upatch is loaded.
- Normal PDF operations and user authentication in Stirling-PDF continue to work, because PDF uploads and conversions use other temporary file prefixes in `stirling-tmp/`.
- Not covered: a JVM started with `java.io.tmpdir` outside a directory named `stirling-tmp` for the temporary file creation check (though `backup/db/` still matches the backup directory layout), or a JVM launcher whose executable is not named `java`.

## Preemption model and cost

The programs keep no state beyond the `refused` per-CPU counter map, which is updated with an atomic fetch-and-add (`__sync_fetch_and_add`), so they are safe under every preemption model, including `PREEMPT_LAZY`, preemptible RCU, and `PREEMPT_RT`. On every file create or open whose name does not start with `b`, a run costs a single byte read of the dentry name.

## Affected versions

Stirling-PDF versions prior to 2.13.2 are affected; version 2.13.2 (commit `d06d3cabaf5b8a7dcd0dbfc584828d8e687e5dd5`) fixes the issue by stripping string literals and rejecting `DENIED_PATTERNS` (`CREATE ALIAS`, `CREATE TRIGGER`, `CREATE AGGREGATE`, `CREATE LINKED TABLE`, `FILE_WRITE`, `FILE_READ`, `CSVWRITE`, `CSVREAD`, `LINK_SCHEMA`, `RUNSCRIPT`, and `SCRIPT TO`).

Kernels: the program uses the `lsm/inode_create` and `lsm/file_open` hooks on Linux kernels with BPF LSM and BTF enabled, including Linux 7.4.

## How it was tested

On a vulnerable Stirling-PDF 2.13.1 with H2 and login enabled, POST /api/v1/database/import-database wrote backup\_\*.sql and ran H2 RUNSCRIPT before and after the upatch was loaded (HTTP 200), and was refused with HTTP 500 while the upatch was loaded.

- **Tested:** 25 Nov 2026
- **Target:** Stirling-PDF 2.13.1 (Stirling-PDF-with-login.jar) on OpenJDK 21, H2 database, DOCKER_ENABLE_SECURITY=true, loopback only
- **Kernel:** 7.4-shirudo-ci-20261123
- **Architecture:** x86_64

### Results

| State           | POST /api/v1/database/import-database writes backup\_\*.sql and runs RUNSCRIPT |
| --------------- | ------------------------------------------------------------------------------ |
| Before loading  | yes (HTTP 200)                                                                 |
| Upatch loaded   | no (HTTP 500)                                                                  |
| After unloading | yes (HTTP 200)                                                                 |

## How to apply

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:

```sh
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-85714
```

Publish and roll out:

```sh
shirudo bpm push build/packages/cve-2026-85714-1.0.0.bee oci://<registry>/<namespace>/cve-2026-85714 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-85714-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>
```

## Review

- Contributors: romanlab.
- Reviewers: none recorded yet.

## Sources and links

- [GHSA-mrr8-934j-4g8m advisory](https://github.com/Stirling-Tools/Stirling-PDF/security/advisories/GHSA-mrr8-934j-4g8m)
- [Fix commit d06d3cabaf5b8a7dcd0dbfc584828d8e687e5dd5](https://github.com/Stirling-Tools/Stirling-PDF/commit/d06d3cabaf5b8a7dcd0dbfc584828d8e687e5dd5)
- [Pull request #6796](https://github.com/Stirling-Tools/Stirling-PDF/pull/6796)
- [Stirling-PDF v2.13.2 release](https://github.com/Stirling-Tools/Stirling-PDF/releases/tag/v2.13.2)
- [Stirling-PDF v2.13.1 release](https://github.com/Stirling-Tools/Stirling-PDF/releases/tag/v2.13.1)

### Links

- [CVE-2026-85714 on upatch.dev](https://upatch.dev/cve/CVE-2026-85714) (this page, as HTML)
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-85714)
- [CVE.org](https://www.cve.org/CVERecord?id=CVE-2026-85714)
- [CWE-94](https://cwe.mitre.org/data/definitions/94.html)
- Upatch source: [upatches/cve-2026-85714](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-85714)

### More references from NVD (4)

- [github.com](https://github.com/Stirling-Tools/Stirling-PDF/commit/d06d3cabaf5b8a7dcd0dbfc584828d8e687e5dd5)
- [github.com](https://github.com/Stirling-Tools/Stirling-PDF/pull/6796)
- [github.com](https://github.com/Stirling-Tools/Stirling-PDF/releases/tag/v2.13.2)
- [github.com](https://github.com/Stirling-Tools/Stirling-PDF/security/advisories/GHSA-mrr8-934j-4g8m)
