Summary
Docling Core exposes an unsafe YAML deserialization path that can lead to remote code execution when untrusted YAML is passed to DoclingDocument.load_from_yaml() and processed with vulnerable PyYAML loaders.
In affected versions, using yaml.FullLoader with older PyYAML releases allows attackers controlling the YAML input to instantiate arbitrary Python objects, potentially executing code within the document-processing application.
Affected context
This vulnerability affects applications that:
- Depend on docling-core versions >= 2.21.0 and < 2.48.4
- Use PyYAML versions prior to 5.4
- Call
docling_core.types.doc.DoclingDocument.load_from_yaml()with YAML content derived from external or otherwise untrusted sources
The risk materializes in document-processing pipelines or services that ingest YAML-based document representations without strict trust or validation assumptions.
Exploit preconditions
- Attack surface: Any component, service, or batch job that:
- Uses docling-core's
DoclingDocument.load_from_yaml()API - Accepts YAML input from users, external integrations, or unverified files
- Required access: Ability to supply or modify YAML content consumed by
load_from_yaml()(e.g., file upload, API parameter, message queue payload, or configuration entry). - Trigger point: Invocation of
DoclingDocument.load_from_yaml()on the attacker-controlled YAML while docling-core usesyaml.FullLoaderwith a PyYAML version vulnerable to CVE-2020-14343. - Why exploitation is possible:
yaml.FullLoaderin affected PyYAML versions can construct arbitrary Python objects from YAML tags. When this behavior is applied to untrusted input, object constructors and side effects may execute during deserialization, enabling code execution rather than mere data parsing.
Why this happens
The core issue is the use of a powerful, general-purpose YAML loader (yaml.FullLoader) on data that may originate from untrusted sources.
This loader supports arbitrary object construction and advanced YAML features that extend beyond simple data representation.
When docling-core's DoclingDocument.load_from_yaml() delegates parsing to this loader without constraining its capabilities, it aligns with CWE-502: Deserialization of Untrusted Data: attacker-controlled serialized content is treated as a specification for runtime objects and behavior.
The safe pattern for configuration and document formats is to employ restricted loaders (e.g., SafeLoader) that only produce primitive types and simple collections, preventing arbitrary code-linked constructions during deserialization.
Potential impact
- Execution of arbitrary Python code within the context of the document-processing application
- Compromise of the host process, including access to its permissions, network reach, and environment variables
- Unauthorized access to or modification of processed documents and associated metadata
- Use of the compromised service as a pivot point for further lateral movement in the environment
- Data exfiltration, tampering, or deletion within the scope of the affected application
General mitigation guidance
Effective mitigation focuses on restricting deserialization behavior and tightening trust boundaries around YAML inputs:
- Prefer secure, restricted YAML loaders that deserialize into primitive data structures only, avoiding arbitrary object construction.
- Treat all external YAML content as untrusted by default, even if it originates from internal services or partners, and minimize the accepted feature set.
- Introduce strict schema validation for YAML-based document representations so that only expected keys, types, and structures are allowed.
- Separate parsing and interpretation layers: first convert YAML into benign data structures, then explicitly map those to application objects using validation and normalization logic.
- Reduce the privilege level of services that perform deserialization (least-privilege execution, filesystem and network constraints, and container sandboxing) to limit blast radius if a parsing component is compromised.
- Prefer configuration and document formats that are less feature-rich or have simpler security models where possible (e.g., JSON or schema-constrained formats) for untrusted input flows.
How teams detect issues like this
Detecting and managing this class of issue typically involves several complementary approaches:
- Static analysis and code scanning:
- Flag usage of dangerous deserialization APIs such as
yaml.loadoryaml.FullLoaderwhen called on non-literal input. - Look for wrapper methods (such as
load_from_yaml()) that delegate to YAML loaders without enforcing trusted sources or validation. - Code review practices:
- Require explicit review of any new or modified deserialization logic, focusing on loaders, allowed types, and input trust assumptions.
- Use secure coding checklists that call out unsafe deserialization as a specific review item, especially in data ingestion and document-processing modules.
- Policy and tooling:
- Enforce organization-wide standards around YAML parsing (e.g., "only SafeLoader or equivalent is allowed for untrusted data") via linting rules or pre-commit hooks.
- Integrate SCA (software composition analysis) tools that can flag known vulnerable combinations of libraries (e.g., specific PyYAML versions with unsafe deserialization behavior) and known CVEs in transitive dependencies.
- Runtime monitoring:
- Monitor for abnormal behavior from document-processing services (unexpected outbound connections, file system modifications, or shell process creation), which may indicate exploitation of unsafe deserialization paths.

