Summary
Docling Core mishandles untrusted image references by allowing file:// URLs and unbounded inline data URIs, enabling risky interactions with the local filesystem and memory.
In applications that process attacker-controlled image references, this may expose local files readable by the Docling process or cause excessive memory consumption leading to denial of service.
Affected context
The vulnerability appears when Docling Core is used in applications that:
- Accept untrusted or partially trusted image references from users or external documents
- Allow these references to be passed into Docling for resolution or rendering
- Run with access to local files that should not be exposed to document content
In such contexts, file:// URLs and oversized data: URIs processed by Docling can cross trust boundaries or exhaust resources, depending on how and where the application is deployed.
Exploit preconditions
- Attack surface: Any Docling-powered document or image processing endpoint that accepts external or user-supplied image references.
- Required access: Ability to submit or influence image URLs or embedded image payloads (e.g., in documents, markup, or API parameters).
- Trigger point: Resolution of image references by Docling Core, including file:// schemes and data: URIs.
- Why exploitation is possible: The library both permits file scheme access and lacks effective bounds on inline image data size, so document-controlled references can direct the process to local resources or trigger excessive allocation.
Why this happens
The core issue is a failure to constrain how external input can drive resource access and usage.
Docling Core treats image references as inherently trustworthy, resolving file:// URLs using the process' local filesystem context, which maps to CWE-73: External Control of File Name or Path because untrusted input influences what files are opened.
In parallel, Docling accepts inline data: URIs without enforcing robust decoded-size limits, leading to potential CWE-400: Uncontrolled Resource Consumption, as large payloads can be loaded into memory.
Together, these patterns reflect a missing abstraction between untrusted document content and sensitive system resources such as the filesystem and memory.
Potential impact
- Exposure of local files readable by the Docling process when their paths are discoverable or guessable.
- Disclosure of configuration files, logs, or other sensitive artifacts inadvertently located under accessible directories.
- Excessive memory usage from very large inline image payloads, potentially degrading performance.
- Application instability or denial of service if memory exhaustion leads to crashes or restarts.
- Increased attack surface for chained exploits that rely on local file reads (e.g., configuration mining).
General mitigation guidance
Effective mitigation centers on limiting what untrusted document content can reference and how many resources it can consume.
Common defensive patterns include:
- Treating all externally provided image references as untrusted and validating them against a strict allowlist of schemes (e.g., only https).
- Disabling or sandboxing file:// scheme resolution for user-controlled content, or constraining access to a dedicated, non-sensitive directory.
- Enforcing strong upper bounds on decoded image sizes and total payload sizes when processing data: URIs.
- Applying streaming or chunked processing patterns where feasible to avoid loading entire untrusted payloads into memory at once.
- Running Docling-backed services under a least-privilege account with minimal filesystem access and resource limits at the OS or container level.
How teams detect issues like this
Detection often involves a combination of code-level inspection and runtime monitoring:
- Static analysis or code review focused on identifying unvalidated URI handling, especially file:// and data: schemes passed into Docling Core.
- Checks for missing size validations or upper bounds on decoded image data and other binary payloads.
- Security review of configuration and wrapper code to confirm that Docling is only allowed to access intended directories and schemes.
- Runtime monitoring and alerting on abnormal memory growth or spikes coinciding with document processing operations.
- Use of automated SAST/lint rules that flag external input being used as file paths or unbounded binary blobs without size checks.

