Docling has arbitrary file read/write (and command execution when shell-escape is enabled) when rendering untrusted TikZ with the opt-in Tectonic engine
What fixes it
- 2.132.0docling, pipGitHub
- 2.132.0docling-slim, pipGitHub
- 2.132.0docling, PyPIOSV
pip install "docling>=2.132.0" - 2.132.0docling-slim, PyPIOSV
pip install "docling-slim>=2.132.0"
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
Summary
When the LaTeX backend is configured to render TikZ pictures with the Tectonic engine (LatexBackendOptions(tikz_engine="tectonic")), the TikZ body and the document preamble from the input file are compiled by Tectonic without any restriction on TeX's file primitives. A crafted .tex file can read files the process can read and write files at paths the process can write. If the caller also sets tikz_engine_allow_shell_escape=True, the document can run shell commands through \write18.
Details
docling/backend/latex/engines/tectonic.py writes the picture source into a temporary document and runs the tectonic binary on it. _resolve_local_dependency only decides which files are staged into the temporary directory. It does not limit what TeX opens at compile time, so:
\input{/abs/path},\verbatiminput{...}and\openinread arbitrary files, and their content can be typeset into the rendered picture that ends up in the conversion output. For an in-memoryDocumentStream, staging is skipped entirely.\immediate\openout/\writecreate or overwrite files outside the temporary directory. Neither needs shell escape. Tectonic's--untrustedflag does not block them either.
Separately, the TectonicEngine constructor defaults to allow_shell_escape=True. The LaTeX backend always passes tikz_engine_allow_shell_escape explicitly (default False), so this default only affects code that instantiates TectonicEngine directly.
Affected configurations
- Affected: callers that set
tikz_engine="tectonic", have atectonicbinary available (onPATHor in the docling cache), and convert untrusted LaTeX. - Not affected: the default configuration (
tikz_engine=None). docling does not installtectonicautomatically, and the CLI exposes no option to enable it.
Impact
Disclosure of local files readable by the process, and creation or overwrite of files writable by the process. Writing to startup or configuration files can lead to code execution. With shell escape enabled, commands run directly.
Proof of concept
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\immediate\openout15=/tmp/docling-tectonic-poc.txt
\immediate\write15{written by the input document}
\immediate\closeout15
\node {x};
\end{tikzpicture}
\end{document}Converting this file with LatexBackendOptions(tikz_engine="tectonic") creates /tmp/docling-tectonic-poc.txt.
Patches
Mitigated in docling 2.132.0 by #4419:
TectonicEnginenow defaults toallow_shell_escape=False, and without shell escape Tectonic runs with--untrustedand--only-cached.- Before compiling, docling checks the generated document and every staged file. It skips rendering, and keeps the diagram as TikZ code, when the source uses the
\openin,\openout,\XeTeXpicfileor\XeTeXpdffileprimitives, or names an absolute, home, drive-letter or parent-directory path in\input,\include,\includegraphics,\InputIfFileExistsor\graphicspath.
This check is best-effort. It reads the source text, and TeX can open files in ways a text check cannot see, for example through package commands or names built by macros. As documented in the pipeline options reference, untrusted LaTeX rendered with tikz_engine="tectonic" should still be processed in an isolated environment.
Workarounds
Upgrade to 2.132.0. For older versions:
- Do not enable
tikz_engine="tectonic"for untrusted input, or run the conversion in an OS-level sandbox (container, no host mounts, read-only filesystem, no network). - Never set
tikz_engine_allow_shell_escape=Truefor untrusted input.
Text from GitHub Advisory Database
Affected versions 96
- docling, pip>= 2.94.0, < 2.132.0GitHub
- docling-slim, pip>= 2.94.0, < 2.132.0GitHub
- doclingaffected: >= 2.94.0, < 2.132.0CVE List
- docling-slimaffected: >= 2.94.0, < 2.132.0CVE List
- docling, PyPIfrom 2.94.0, fixed in 2.132.0OSV
- docling, PyPI2.100.0OSV
- docling, PyPI2.101.0OSV
- docling, PyPI2.102.0OSV
- docling, PyPI2.102.1OSV
- docling, PyPI2.102.2OSV
- docling, PyPI2.103.0OSV
- docling, PyPI2.104.0OSV
- docling, PyPI2.105.0OSV
- docling, PyPI2.106.0OSV
- docling, PyPI2.107.0OSV
- docling, PyPI2.108.0OSV
- docling, PyPI2.109.0OSV
- docling, PyPI2.110.0OSV
- docling, PyPI2.111.0OSV
- docling, PyPI2.112.0OSV
- docling, PyPI2.113.0OSV
- docling, PyPI2.114.0OSV
- docling, PyPI2.115.0OSV
- docling, PyPI2.116.0OSV
- docling, PyPI2.117.0OSV
- docling, PyPI2.118.0OSV
- docling, PyPI2.118.1OSV
- docling, PyPI2.119.0OSV
- docling, PyPI2.120.1OSV
- docling, PyPI2.120.2OSV
- docling, PyPI2.120.3OSV
- docling, PyPI2.121.0OSV
- docling, PyPI2.122.0OSV
- docling, PyPI2.123.0OSV
- docling, PyPI2.123.1OSV
- docling, PyPI2.124.0OSV
- docling, PyPI2.125.0OSV
- docling, PyPI2.126.0OSV
- docling, PyPI2.127.0OSV
- docling, PyPI2.128.0OSV
- docling, PyPI2.129.0OSV
- docling, PyPI2.130.0OSV
- docling, PyPI2.131.0OSV
- docling, PyPI2.94.0OSV
- docling, PyPI2.95.0OSV
- docling, PyPI2.96.0OSV
- docling, PyPI2.96.1OSV
- docling, PyPI2.97.0OSV
- docling, PyPI2.98.0OSV
- docling, PyPI2.99.0OSV
- docling-slim, PyPIfrom 2.94.0, fixed in 2.132.0OSV
- docling-slim, PyPI2.100.0OSV
- docling-slim, PyPI2.101.0OSV
- docling-slim, PyPI2.102.0OSV
- docling-slim, PyPI2.102.1OSV
- docling-slim, PyPI2.102.2OSV
- docling-slim, PyPI2.103.0OSV
- docling-slim, PyPI2.104.0OSV
- docling-slim, PyPI2.105.0OSV
- docling-slim, PyPI2.106.0OSV
- docling-slim, PyPI2.107.0OSV
- docling-slim, PyPI2.108.0OSV
- docling-slim, PyPI2.109.0OSV
- docling-slim, PyPI2.110.0OSV
- docling-slim, PyPI2.111.0OSV
- docling-slim, PyPI2.112.0OSV
- docling-slim, PyPI2.113.0OSV
- docling-slim, PyPI2.114.0OSV
- docling-slim, PyPI2.115.0OSV
- docling-slim, PyPI2.116.0OSV
- docling-slim, PyPI2.117.0OSV
- docling-slim, PyPI2.118.0OSV
- docling-slim, PyPI2.118.1OSV
- docling-slim, PyPI2.119.0OSV
- docling-slim, PyPI2.120.1OSV
- docling-slim, PyPI2.120.2OSV
- docling-slim, PyPI2.120.3OSV
- docling-slim, PyPI2.121.0OSV
- docling-slim, PyPI2.122.0OSV
- docling-slim, PyPI2.123.0OSV
- docling-slim, PyPI2.123.1OSV
- docling-slim, PyPI2.124.0OSV
- docling-slim, PyPI2.125.0OSV
- docling-slim, PyPI2.126.0OSV
- docling-slim, PyPI2.127.0OSV
- docling-slim, PyPI2.128.0OSV
- docling-slim, PyPI2.129.0OSV
- docling-slim, PyPI2.130.0OSV
- docling-slim, PyPI2.131.0OSV
- docling-slim, PyPI2.94.0OSV
- docling-slim, PyPI2.95.0OSV
- docling-slim, PyPI2.96.0OSV
- docling-slim, PyPI2.96.1OSV
- docling-slim, PyPI2.97.0OSV
- docling-slim, PyPI2.98.0OSV
- docling-slim, PyPI2.99.0OSV
References 6
- github.com/docling-project/docling/commit/38b6fa0a465d46fdacbbec333f50fa19c4f6b342Fixvia CVE List
- github.com/docling-project/docling/releases/tag/v2.132.0Fixvia CVE List
- github.com/advisories/GHSA-x3q2-h9hx-4r4jAdvisoryvia GitHub
- github.com/docling-project/docling/security/advisories/GHSA-x3q2-h9hx-4r4jExploitvia CVE List
- nvd.nist.gov/vuln/detail/CVE-2026-105744Referencevia GitHub
- github.com/docling-project/docling/pull/4419Referencevia CVE List