/

CVE-2026-85714

Severity:

CRITICAL RISK

(9.1)

SQL Injection (CWE-94) in Stirling-PDF Database Import

CVE-2026-85714

Awaiting Analysis

Vulnerability type

Category:

SQL Code Injection

CWE:

CWE-94

Impact:

Arbitrary File Access and Remote Code Execution

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Stirling-PDF contains an SQL validation weakness in its database import endpoint that can allow an authenticated administrator to upload crafted SQL containing dangerous H2 functions or aliases. When the imported script is processed, the attacker may gain arbitrary file access and potentially execute operating-system commands as the application service account.

Stirling-PDF contains an SQL validation weakness in its database import endpoint that can allow an authenticated administrator to upload crafted SQL containing dangerous H2 functions or aliases. When the imported script is processed, the attacker may gain arbitrary file access and potentially execute operating-system commands as the application service account.

Affected context

The issue occurs in Stirling-PDF deployments using the default H2 database and security mode, where an authenticated administrator can access the database import API. Risk arises when uploaded SQL is validated using an insufficient keyword allowlist before H2 processes it with RUNSCRIPT, permitting statements with file or code-execution side effects.

The issue occurs in Stirling-PDF deployments using the default H2 database and security mode, where an authenticated administrator can access the database import API. Risk arises when uploaded SQL is validated using an insufficient keyword allowlist before H2 processes it with RUNSCRIPT, permitting statements with file or code-execution side effects.

Exploit preconditions

  • Attack surface: The authenticated database import HTTP endpoint
  • Required access: An authenticated account with administrator privileges and permission to import database content
  • Trigger point: Processing an uploaded SQL file through the database import workflow
  • Deployment condition: Use of the affected H2 database and security configuration
  • Why exploitation is possible: Validation accepts statements containing an allowed keyword without reliably rejecting dangerous H2 functions, aliases, or other side-effecting SQL constructs
  • Attack surface: The authenticated database import HTTP endpoint
  • Required access: An authenticated account with administrator privileges and permission to import database content
  • Trigger point: Processing an uploaded SQL file through the database import workflow
  • Deployment condition: Use of the affected H2 database and security configuration
  • Why exploitation is possible: Validation accepts statements containing an allowed keyword without reliably rejecting dangerous H2 functions, aliases, or other side-effecting SQL constructs

Why this happens

The underlying flaw is insufficient validation of semi-structured SQL input. The validation logic normalizes and splits content on semicolons, then accepts statements when they contain any permitted keyword, rather than parsing SQL safely and enforcing an explicit, context-aware grammar.

This insecure allowlist pattern allows dangerous H2 capabilities, including file-access functions and alias creation, to pass validation before RUNSCRIPT evaluates the imported content. The resulting behavior maps to CWE-94: Improper Control of Generation of Code, because attacker-controlled database content can influence the creation or execution of code-like behavior.

The underlying flaw is insufficient validation of semi-structured SQL input. The validation logic normalizes and splits content on semicolons, then accepts statements when they contain any permitted keyword, rather than parsing SQL safely and enforcing an explicit, context-aware grammar.

This insecure allowlist pattern allows dangerous H2 capabilities, including file-access functions and alias creation, to pass validation before RUNSCRIPT evaluates the imported content. The resulting behavior maps to CWE-94: Improper Control of Generation of Code, because attacker-controlled database content can influence the creation or execution of code-like behavior.

Potential impact

  • Arbitrary local file reads or writes may be possible
  • Application configuration or startup files could be modified
  • Commands may execute with the privileges of the JVM service account
  • Sensitive data and credentials may be exposed
  • The application host could be compromised
  • Persistence or lateral movement could follow, depending on service permissions
  • Arbitrary local file reads or writes may be possible
  • Application configuration or startup files could be modified
  • Commands may execute with the privileges of the JVM service account
  • Sensitive data and credentials may be exposed
  • The application host could be compromised
  • Persistence or lateral movement could follow, depending on service permissions

General mitigation guidance

Mitigation focuses on removing executable behavior from database import workflows and reducing trust in uploaded SQL content.

Common defensive patterns include:

  • Replacing keyword-based filtering with a narrowly defined, parser-backed import format
  • Allowing only explicitly supported schema and data operations
  • Rejecting H2 functions, aliases, script commands, file operations, and other side-effecting constructs by default
  • Separating data import from database administration and code-generation capabilities
  • Enforcing strong authorization and multifactor protection for administrative import functions
  • Running the application with a dedicated, least-privileged service account
  • Restricting filesystem access and preventing writes to executable or startup locations
  • Applying secure-by-default database and application configurations
  • Preserving validation and authorization checks throughout the import pipeline rather than relying on a single filter

Mitigation focuses on removing executable behavior from database import workflows and reducing trust in uploaded SQL content.

Common defensive patterns include:

  • Replacing keyword-based filtering with a narrowly defined, parser-backed import format
  • Allowing only explicitly supported schema and data operations
  • Rejecting H2 functions, aliases, script commands, file operations, and other side-effecting constructs by default
  • Separating data import from database administration and code-generation capabilities
  • Enforcing strong authorization and multifactor protection for administrative import functions
  • Running the application with a dedicated, least-privileged service account
  • Restricting filesystem access and preventing writes to executable or startup locations
  • Applying secure-by-default database and application configurations
  • Preserving validation and authorization checks throughout the import pipeline rather than relying on a single filter

How teams detect issues like this

Detection can combine source review, runtime monitoring, and policy enforcement:

  • Use static analysis rules to identify SQL allowlists based on substring or keyword matching
  • Review code paths that pass uploaded content to H2 RUNSCRIPT or equivalent script execution APIs
  • Flag database import functionality that permits CREATE ALIAS, file functions, or dynamic code generation
  • Monitor administrative import requests, unusual SQL uploads, and database errors involving file or alias operations
  • Alert on unexpected writes by the JVM service account to configuration, startup, or user-site directories
  • Enforce CI policies that prohibit unsafe database script execution and require parser-backed validation
  • Neutral automated code-review tools may help identify dangerous SQL execution and insufficient input validation patterns

Detection can combine source review, runtime monitoring, and policy enforcement:

  • Use static analysis rules to identify SQL allowlists based on substring or keyword matching
  • Review code paths that pass uploaded content to H2 RUNSCRIPT or equivalent script execution APIs
  • Flag database import functionality that permits CREATE ALIAS, file functions, or dynamic code generation
  • Monitor administrative import requests, unusual SQL uploads, and database errors involving file or alias operations
  • Alert on unexpected writes by the JVM service account to configuration, startup, or user-site directories
  • Enforce CI policies that prohibit unsafe database script execution and require parser-backed validation
  • Neutral automated code-review tools may help identify dangerous SQL execution and insufficient input validation patterns

Sources

SourceLink
github.comgithub.com/Stirling-Tools/Stirling-PDF/commit/d06d3cabaf5b8a7dcd0dbfc584828d8e687e5dd5
github.comgithub.com/Stirling-Tools/Stirling-PDF/pull/6796
github.comgithub.com/Stirling-Tools/Stirling-PDF/releases/tag/v2.13.2
github.comgithub.com/Stirling-Tools/Stirling-PDF/security/advisories/GHSA-mrr8-934j-4g8m

Frequently asked

questions

It can be triggered through the web application by an authenticated administrator, provided the affected database and security configuration are in use. It is not an unauthenticated attack based on the described conditions.

The attacker needs administrator-level access to the database import functionality and the ability to submit a crafted SQL file.

The safest pattern is to avoid executing uploaded SQL as a general-purpose script. Use a narrowly scoped import format, parser-backed validation, explicit operation allowlists, and a least-privileged application account.

Treat uploaded database content as untrusted, reject executable database features by default, protect administrative endpoints with strong access controls, and monitor filesystem and process activity performed by the application service account.

It can be triggered through the web application by an authenticated administrator, provided the affected database and security configuration are in use. It is not an unauthenticated attack based on the described conditions.

The attacker needs administrator-level access to the database import functionality and the ability to submit a crafted SQL file.

The safest pattern is to avoid executing uploaded SQL as a general-purpose script. Use a narrowly scoped import format, parser-backed validation, explicit operation allowlists, and a least-privileged application account.

Treat uploaded database content as untrusted, reject executable database features by default, protect administrative endpoints with strong access controls, and monitor filesystem and process activity performed by the application service account.

Find out what's already
exploitable in your codebase.