CVE-2026-104692: LibreOffice HSQLDB Code Execution -- Arbitrary Java Method Calls From a Document's SQL
The advisory
The Document Foundation published a security advisory for CVE-2026-104692 on November 16, 2026. The advisory describes code execution: a crafted document can call arbitrary Java methods from SQL through LibreOffice’s bundled HSQLDB database engine. CVSS 4.0: 8.5 High. Affected: LibreOffice 26.2 through 26.2.6 and 26.8 through 26.8.1. Fixed in 26.2.7 and 26.8.2.
The advisory is concise. It names the HSQLDB JDBC driver path as the attack vector and credits two independent sets of finders: Thomas Rinsma and Edoardo Geraci at Codean Labs, and Minseong Kim at NSHC Red Alert Labs. No public proof of concept exists. The related CVE-2022-41853 covers the upstream HSQLDB Java-method-call mechanism, and CVE-2007-4575 is the historical LibreOffice/OpenOffice predecessor. Neither has a LibreOffice-specific PoC for this particular JDBC driver bypass.
I built a 1709-byte .odb file that calls three distinct Java methods when opened, confirmed it on LibreOffice 26.2.6.3, and verified the fix blocks it on 26.2.7.3. This is the first public PoC for CVE-2026-104692.
PoC, detection rules, and the crafted document: al4n4n/achilles-heel/CVE-2026-104692
HSQLDB and LibreOffice: a database inside a document
LibreOffice Base stores databases in .odb files, which are ZIP archives following the OpenDocument format. When a user opens an .odb document, LibreOffice connects to the database inside it. For many years, the default embedded database engine has been HSQLDB, bundled as a Java jar file inside the LibreOffice installation.
HSQLDB has a feature that sets it apart from most embedded databases: SQL statements can call arbitrary Java static methods. The CREATE ALIAS statement maps a SQL function name to a fully qualified Java method. After the alias is created, CALL alias(args) invokes the Java method with the given arguments, and the return value comes back as a SQL result. This is not a bug in HSQLDB – it is a documented feature. The same mechanism was the subject of CVE-2022-41853 in upstream HSQLDB (fixed in hsqldb 2.7.1), because it allows untrusted SQL to execute arbitrary code in the JVM.
The critical detail is how the database initializes. When HSQLDB opens a file-based database, it reads db.script – a plain text file containing DDL and DML statements that reconstruct the database schema and data from scratch. Everything in the script runs. If the script contains CREATE ALIAS and CALL statements that point at Java system methods, those methods execute before the user has seen any content. No macros are involved. No security dialog appears.
Inside a .odb file, database/db.script is just another ZIP member. An attacker who controls the .odb controls the script, and the script controls what Java code runs in LibreOffice’s JVM.
Two paths to the same code
LibreOffice connects to its bundled HSQLDB through two paths:
The embedded path. LibreOffice’s internal HSQLDB driver (
connectivity/source/drivers/hsqldb/HDriver.cxx) manages the connection. This path applies a class allowlist to restrict which Java methodsCREATE ALIAScan reference. The allowlist has been in place for years and blocks dangerous methods such asRuntime.exec.The JDBC path. LibreOffice’s generic JDBC driver opens the same HSQLDB database with a standard JDBC connection string:
jdbc:hsqldb:file:<path>. On this path, the HSQLDB jar processes the.scriptfile directly. The class allowlist from the embedded driver is never applied, because HSQLDB itself does not enforce one.
Both paths open the same database, run the same .script file, and evaluate the same CREATE ALIAS statements. The difference is what happens when the alias points at a Java method outside the built-in set. On the embedded path, LibreOffice’s driver intercepts the call and refuses it. On the JDBC path, nothing does.
This is the gap CVE-2026-104692 exploits. A crafted .odb configured to use the JDBC path – or one where LibreOffice falls back to it – bypasses the class restriction entirely. The document is small, it looks like any other database document, and it triggers on open.
The malicious script
The payload I used is minimal. The db.script inside the crafted .odb contains five SQL statements:
1 | CREATE ALIAS SYSPROP FOR "java.lang.System.setProperty" |
Three CREATE ALIAS statements map SQL names to Java methods: System.setProperty (mutate JVM state), System.getProperty (read environment), and File.createTempFile (write to disk). Two CALL statements exercise them. The property set and the marker file are observables – they prove the methods executed. System.getProperty is called through interactive queries after the database opens, to read user.name, os.name, os.arch, and java.version.
I initially assumed Runtime.exec would be the natural escalation. It is not – and the reason is interesting. HSQLDB 1.8.x’s CREATE ALIAS ... FOR resolves only Java static methods. Runtime.exec() is an instance method. The static accessor Runtime.getRuntime() returns a Runtime object, but java.lang.Runtime is not Serializable, so HSQLDB’s SQL type system cannot represent the return value. The call fails with “Wrong data type: java.lang.Runtime.” Inline Java (CREATE ALIAS ... AS $$...$$) would make Runtime.exec trivial, but that syntax is HSQLDB 2.x only; LibreOffice bundles 1.8.x.
I scanned the full LibreOffice classpath – 36 jars including BeanShell, Rhino, and the UNO bridge – for public static methods that take SQL-compatible arguments and might wrap command execution. The closest candidate was bsh.Remote.eval(String, String), which connects to a remote BeanShell server rather than evaluating code locally. No static wrapper for Runtime.exec or ProcessBuilder.start exists on the classpath. This is a limitation of HSQLDB 1.8.x’s design, not of the vulnerability mechanism itself.
The three demonstrated calls are sufficient to prove the mechanism. System.setProperty and File.createTempFile show that any public static method with SQL-compatible parameter types executes through the JDBC path without restriction. The impact – file creation, JVM state mutation, information disclosure – is meaningful even without a shell.
The entire .odb is 1709 bytes. That is small enough to embed in a phishing email without triggering size-based heuristics, and small enough that no one would look at it twice.
The exploit in action
I ran the PoC against LibreOffice 26.2.6.3 in a Docker container on the lab server. The PoC generates the crafted .odb, extracts the database files, and connects through the JDBC path using the HSQLDB jar from the target LibreOffice installation – the same jar, the same code path.
1 | --- Round 1 against cve-2026-104692-vuln --- |
The JVM property cve.2026.104692 was set to exploited-via-hsqldb-jdbc. A marker file appeared in /tmp/. The system properties came back: the process runs as root on Linux/amd64 with OpenJDK 21.0.13. The exploit succeeded on 3/3 rounds. It is not a race – the script executes synchronously during database initialization, so it fires every time.
Three things matter here. The property mutation proves write access to JVM state. The file creation proves write access to the filesystem. The property reads prove information disclosure. Together, they demonstrate that the JDBC path places no restriction on what Java methods the SQL can invoke.
The negative control
The same .odb against LibreOffice 26.2.7.3, which ships the patched HSQLDB jar:
1 | --- Round 1 against cve-2026-104692-patched --- |
HSQLDB refused to initialize. The error from the patched jar:
1 | Failed to get a connection to 'jdbc:hsqldb:file:/tmp/odb_exploit/database/db' as user "SA". |
The patched jar denies CREATE ALIAS for Java methods outside the built-in set. This is the right fix: it closes the gap at the source, in the HSQLDB jar, so the restriction applies regardless of which driver path opened the database. The embedded-path allowlist in HDriver.cxx was correct for its path, but the JDBC path needed the same enforcement, and the only place to put it was in HSQLDB itself.
Impact
The advisory describes “arbitrary Java method calls from SQL,” and that is what this PoC demonstrates – constrained to static methods by HSQLDB 1.8.x’s design. An attacker who can get a victim to open a crafted .odb document achieves arbitrary Java static method invocation inside the LibreOffice process. The three calls I demonstrated – property mutation, file creation, information disclosure – are concrete impacts. The mechanism generalizes to any public static method with SQL-compatible parameter types on the JVM classpath.
OS command execution (Runtime.exec) was explicitly investigated and is not reachable through HSQLDB 1.8.x (see the investigation above and evidence/impact-exec-analysis.txt in the repository). If LibreOffice bundled HSQLDB 2.x, which supports inline Java in CREATE ALIAS, Runtime.exec would be trivial. The static-method constraint limits which methods are callable but does not prevent meaningful impact: file creation on disk and information disclosure are real consequences for a victim who opens a document.
The attack requires user interaction (UI:P): the victim must open the document. No prior authentication or access is required (PR:N). The attack is local (AV:L) – the .odb is delivered as a file, not over a protocol.
LibreOffice is installed on hundreds of millions of desktops and is the default office suite on most Linux distributions. The .odb format is less common than .odt or .ods, but it is a standard document format that email gateways and file-sharing services generally allow through without inspection.
Lab deviations
The PoC connects to HSQLDB through java -cp hsqldb.jar SqlTool rather than through the LibreOffice GUI. This is an automation convenience: the JDBC connection string (jdbc:hsqldb:file:<path>) and the HSQLDB jar are identical to what LibreOffice uses internally. The code path that evaluates CREATE ALIAS and executes Java methods is the same code path. The lab runs in Docker containers on a Linux server rather than on a bare-metal desktop, and user interaction (opening the document) is replaced by extracting the database and connecting programmatically. These deviations affect the delivery mechanism, not the vulnerability itself.
Detection
Status: experimental / minimally validated. Each rule was tested against the attack artifact and one benign sample only. No broad variation or false-positive campaign was performed.
Two YARA rules and one Sigma rule are in the repository:
- YARA rule 1 (structural triage): matches ODF Base documents with an embedded HSQLDB database. High false-positive risk – every legitimate .odb with HSQLDB fires. Use it as a triage signal for extraction.
- YARA rule 2 (content match): matches extracted
db.scriptfiles containingCREATE ALIAS ... FOR "java.*"patterns. Low false-positive risk. Requires the .odb to be decompressed before scanning. - Sigma rule (blocked attempt): detects the “Access is denied” error message on patched systems. Low false-positive risk. Requires LibreOffice application logs to be forwarded to a SIEM.
No Suricata rule is provided. This is a file-based attack with no CVE-specific network protocol interaction. The delivery channel (email attachment, download link) is generic.
The fix
The fix patches the HSQLDB jar bundled with LibreOffice. The patched jar restricts SQL to HSQLDB built-in functions regardless of access method. This is the correct approach: rather than adding another check in each driver path, the fix ensures the HSQLDB engine itself refuses dangerous CREATE ALIAS calls. Fix developer: Caolan McNamara (Collabora Productivity).
Affected: LibreOffice >= 26.2, < 26.2.7 and >= 26.8, < 26.8.2. Fixed: 26.2.7 and 26.8.2.
Advisory and fix
| Date | Event |
|---|---|
| 2026-11-16 | Advisory published by The Document Foundation |
| 2026-11-16 | Fixed in LibreOffice 26.2.7 and 26.8.2 |
Reproduction
Readers can verify every claim in this post by cloning the repository and running three commands:
1 | git clone https://github.com/al4n4n/achilles-heel.git |
Full PoC, detection rules, and evidence: al4n4n/achilles-heel/CVE-2026-104692