Oct 8, 2026·6 min read·46 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.
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.