LibreOffice: RCE without macros or security prompts via JDBC and HSQLDB
Attack Techniques & Methods2026-11-25, 12:04
LibreOffice: RCE without macros or security prompts via JDBC and HSQLDB
Researcher Minseong Kim (ii4gsp) from NSHC Red Alert Labs demonstrated an exploit chain involving two LibreOffice vulnerabilities — CVE-2026-104692 and CVE-2026-104007 — enabling arbitrary code execution on Windows, macOS, and Linux when a specially crafted ODS spreadsheet is opened. The attack requires no macros or additional user interaction. Simply opening the document is enough, provided Java is installed and enabled in LibreOffice.
The exploit chain combines two vulnerabilities:
• CVE-2026-104692 — HSQLDB method allowlist bypass. When HSQLDB was accessed through the generic JDBC driver, the accessibleJavaMethodNames field in HsqlDatabaseProperties was initialized to null instead of an empty set. As a result, supportsJavaMethod() returned true for any method name, allowing arbitrary Java methods to be invoked via SQL CALL.
• CVE-2026-104007 — JDBC classpath validation bypass. When an ODB file was opened directly, ODBFilter::setPropertyInfo() removed the JavaDriverClassPath property to prevent loading attacker-controlled Java classes. However, this check was bypassed when an ODB was referenced through form:datasource. The attacker-controlled classpath was passed to JConnection::construct(), allowing Java classes to be loaded via URLClassLoader.
Exploitation chain:
• The malicious ODS references an external ODB file through form:datasource, which LibreOffice automatically downloads over HTTP.
• The form:apply-design-mode="false" attribute triggers a database connection when the document opens, while form:escape-processing="false" bypasses SingleSelectQueryComposer validation, allowing SQL CALL statements to reach HSQLDB directly.
• The attacker places a compiled Java class inside the ODS itself, which is a ZIP archive. The external ODB sets JavaDriverClassPath, pointing back to this document. It is located using $SYSUSERHOME and the standard Downloads, Desktop, and Documents directories.
• Once the database connection is established, HSQLDB executes the SQL CALL statement, loads the Java class, and invokes a method that runs a system command with the privileges of the user running LibreOffice.
On Linux, the researcher demonstrated RCE using CVE-2026-104007 alone. Instead of HSQLDB CALL, an attacker-controlled JDBC driver's Driver.connect() method executes code during connection setup. According to the researcher, this approach could also work on Windows and macOS, although the published PoC for those platforms chains both vulnerabilities.
The issues were fixed in LibreOffice 26.2.7 and 26.8.2. The patches enforce HSQLDB's Java method restrictions, source JDBC driver paths from user-controlled configuration rather than ODB documents, and require user consent before updating links to external database documents.
Article and PoC: https://ii4gsp.github.io/libreoffice-rce/