Oct 8, 2026·6 min read·45 visits
Docling unconditionally imported external third-party entrypoint modules during initialization before checking namespace validation parameters, allowing malicious local packages to execute code at import time.
Docling prior to version 2.131.0 is vulnerable to arbitrary local code execution during module initialization due to incorrect order of operations in its plugin discovery system. Even when the default option to reject external plugins is active, Docling utilizes Pluggy to scan and import entrypoints before performing namespace validation.
Docling is an open-source document processing library widely used to parse and convert structured documents into machine-readable formats. To facilitate extensibility across various optical character recognition (OCR) systems and model pipelines, Docling implements a dynamic plugin discovery framework. This framework discovers and registers extension components configured as Python packaging entrypoints.
By design, Docling includes a configuration mechanism (allow_external_plugins=False) intended to restrict the loading of modules to officially supported namespaces starting with docling.. This flag is active by default in both CLI execution and programmatic API initializations to prevent unauthorized extensions from running.
However, a design flaw exists in how the discovery workflow is sequenced in the base factory engine. Under affected versions, Docling scans the execution environment and resolves all modules declared under the docling group identifier. Because the validation steps are deferred until after the entrypoints are processed, the system exposes an attack surface where installing any untrusted Python package locally leads to automatic execution of that package's import-time logic.
The underlying security flaw is classified under CWE-696 (Incorrect Behavior Order) and CWE-829 (Inclusion of Functionality from Untrusted Control Sphere). In the Python ecosystem, importing a module involves execution of all top-level statements, class definitions, and variable assignments within the target module scope. This behavior is standard and occurs prior to the module object being fully returned to the namespace.
Docling relied on the Pluggy library's PluginManager.load_setuptools_entrypoints() function to identify and register plugins. When Pluggy executes this command, it searches metadata for entrypoints registered under a specified group name. Once found, Pluggy automatically resolves and imports the backing modules so it can register the hook implementations defined within them.
The logic error in Docling's base factory occurs because load_setuptools_entrypoints() is called unconditionally at the beginning of the load_from_plugins function. This loading mechanism executes prior to checking the allow_external_plugins configuration parameter. While the code subsequently screens the module namespace and skips registering any unauthorized objects, the malicious side effects defined at the module's global level have already completed execution in the application's runtime.
To understand the implementation flow of the vulnerability, examine the deprecated code pattern in docling/models/factories/base_factory.py alongside the revised mitigation pattern.
In the vulnerable implementation, all module discovery is executed via direct reliance on Pluggy's autoloader without verification of metadata string names first:
# File: docling/models/factories/base_factory.py (Vulnerable Implementation)
plugin_manager = PluginManager(plugin_name)
# Unconditionally imports all entrypoints declared under the specified plugin_name group
plugin_manager.load_setuptools_entrypoints(plugin_name)
for plugin_name, plugin_module in plugin_manager.list_name_plugin():
plugin_module_name = str(plugin_module.__name__)
# Validation check occurs AFTER import execution
if not allow_external_plugins and not plugin_module_name.startswith("docling."):
logger.warning(
f"The plugin {plugin_name} will not be loaded because Docling is being executed with allow_external_plugins=false."
)
continueThe patched implementation replaces bulk autoloading with standard library inspection via importlib.metadata.entry_points. This allows metadata parsing to filter by namespace string before importing the underlying module:
# File: docling/models/factories/base_factory.py (Patched in Commit 0f443b3786e98688a2da3b7c8f56fe5e46af876c)
from importlib.metadata import entry_points
plugin_manager = PluginManager(plugin_name)
# Query registered metadata structures instead of triggering imports
for entry_point in entry_points(group=plugin_name):
if plugin_manager.get_plugin(entry_point.name) is not None:
continue
# Perform validation on the string metadata path before loading the module
if not allow_external_plugins and not entry_point.module.startswith(
"docling."
):
logger.warning(
f"The plugin {entry_point.name} will not be loaded because Docling is being executed with allow_external_plugins=false."
)
continue
# Safe registration only after metadata validation passes
plugin_manager.register(entry_point.load(), name=entry_point.name)Exploitation of CVE-2026-105745 requires an attacker to place a package with a malformed or malicious entrypoint registration into the local Python package registry (sys.path). While this limitation makes exploitation complex, standard target vectors exist in supply chain spaces such as typosquatting on PyPI, dependency confusion within private registries, or exploiting pre-existing write access to local site-packages.
To construct a proof-of-concept, an attacker defines a dependency package configuration specifying an entrypoint within the target namespace group:
# File: pyproject.toml of malicious dependency
[project.entry-points."docling"]
malicious_payload = "untrusted_package.malicious_plugin"The target file untrusted_package/malicious_plugin.py contains direct system execution logic inside the global/module execution context:
# File: untrusted_package/malicious_plugin.py
import os
import sys
# Code runs instantly upon being searched by pluggy
os.system("id > /tmp/compromised")When Docling is executed on a document by a victim user within an environment where the payload package has been deployed, Docling's entrypoint resolution will automatically look for and load untrusted_package.malicious_plugin. This initiates execution of the target payload sequence, writing user shell privileges to /tmp/compromised before any evaluation checks block the plugin registration.
The impact of this vulnerability is local code execution with the same permissions as the execution context of the Docling tool. Because docling is frequently used in cloud-based parsing services, batch ingestion jobs, or large language model (LLM) data pipeline servers, this context often has elevated capabilities including read access to internal databases, cloud provider instance metadata services, and system environment credentials.
The CVSS v3.1 vector is rated as CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H. The Attack Complexity is classified as High because it relies on placing malicious packages in the local environment, and User Interaction is Required since a user or system process must actively invoke Docling processes.
This behavior is highly impactful in automation settings where data workers run external open-source code inside multi-user shared execution nodes. The lack of proper isolation prior to dynamic imports allows an underprivileged tenant to compromise the active application server simply by installing a local package that register entrypoints under the standard group designations.
The primary resolution path for CVE-2026-105745 is upgrading to version 2.131.0 or newer. If utilizing the core sub-libraries directly, you should verify that docling-core has been upgraded to a version matching or exceeding 2.98.0.
In environments where upgrading dependencies immediately is unfeasible, several defense-in-depth measures should be taken:
site-packages folders to prevent write capabilities by non-administrator users, blocking arbitrary package installations.poetry.lock, requirements.txt with hashes) to enforce integrity validation on all dependencies to prevent dependency hijacking vectors.Security administrators can inspect Python environments for rogue entrypoints under the docling group by running the following audit script:
import importlib.metadata
for ep in importlib.metadata.entry_points(group="docling"):
is_valid = ep.module.startswith("docling.")
status = "APPROVED" if is_valid else "WARNING: UNAUTHORIZED EXTERNAL MODULE"
print(f"Entrypoint Name: {ep.name:25} | Module: {ep.module:40} | Status: {status}")CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
docling docling-project | >= 2.27.0, < 2.131.0 | 2.131.0 |
docling-slim docling-project | >= 2.27.0, < 2.131.0 | 2.131.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-696 |
| Attack Vector | Local |
| CVSS | 6.7 (Medium) |
| EPSS Score | 0.00109 |
| Impact | Arbitrary Code Execution |
| Exploit Status | none |
| KEV Status | No |
The application performs an import operation before validating the external source, leading to unauthorized behavior execution.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.
The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.
CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.
CVE-2026-128077 (GHSA-r99w-jh2x-3mg9) is an authorization bypass and interpretation conflict vulnerability affecting Nuxt and its underlying @nuxt/nitro-server package in versions 4.6.0 through 4.6.3. When an incoming HTTP request path begins with a double forward slash (e.g., //x/admin), the WHATWG URL parser within the Nuxt server-side page renderer interprets the initial segment as a network host/authority and resolves the remaining path (/admin) against the application's page router. Because Nitro server middleware, route-scoped serverHandlers, and Nitro routeRules evaluate the unparsed request path (//x/admin), path-based access controls, redirects, and security header policies configured for /admin fail to match and are bypassed.
Prior to version 2.10.2, the sqlite3-ruby gem explicitly cast 64-bit Ruby string lengths (long) to 32-bit signed integers (int) when invoking the underlying SQLite C API. On 64-bit platforms, providing a string of 4 GiB (2^32 bytes) or larger causes integer truncation, instructing SQLite to process only a prefix of the string. This flaw affects SQL query preparation, bound parameter values, and return values from custom Ruby-defined SQL functions and aggregates, allowing trailing SQL clauses such as WHERE restrictions to be silently dropped under specific conditions.
CVE-2026-128068 (GHSA-cpgf-5mjf-73p7) is a Regular Expression Denial of Service (ReDoS) vulnerability in the rails-html-sanitizer Ruby gem affecting versions 1.0.3 through 1.7.1. The flaw resides in the Rails::HTML::PermitScrubber#scrub_attribute method, which uses the multiline regular expression /^\s*[^#\s].*/m to enforce local-only URI fragment references on SVG elements. On Ruby runtimes prior to version 3.2 (CRuby <= 3.1 and JRuby), evaluating an attribute value composed of repeated newline and whitespace characters without a hash character triggers quadratic backtracking O(n^2). Applications are only vulnerable if their sanitization allowlist is explicitly configured to permit SVG reference elements such as <use> alongside href or xlink:href attributes.