datamodel-code-generator before 0.84.0 contains a code injection vulnerability that allows attackers to achieve arbitrary code execution by supplying a malicious JSON Schema with a crafted x-python-type annotation containing a string ast.Constant node in a subscript slice position, which bypasses validation in parse_python_type_annotation and _python_type_expr_from_ast. Attackers can embed malicious Python expressions such as __import__ calls within quoted string literals in the generated source code, which Pydantic v2 evaluates as a ForwardRef via eval() during model_rebuild(), resulting in arbitrary code execution on developer workstations, CI/CD pipelines, or applications that generate and import the produced models at runtime.
Advisories

No advisories yet.

Fixes

Solution

No solution given by the vendor.


Workaround

No workaround given by the vendor.

History

Fri, 13 Nov 2026 03:45:00 +0000

Type Values Removed Values Added
First Time appeared Datamodel-code-generator
Datamodel-code-generator datamodel-code-generator
Vendors & Products Datamodel-code-generator
Datamodel-code-generator datamodel-code-generator

Thu, 12 Nov 2026 21:15:00 +0000

Type Values Removed Values Added
Description datamodel-code-generator before 0.84.0 contains a code injection vulnerability that allows attackers to achieve arbitrary code execution by supplying a malicious JSON Schema with a crafted x-python-type annotation containing a string ast.Constant node in a subscript slice position, which bypasses validation in parse_python_type_annotation and _python_type_expr_from_ast. Attackers can embed malicious Python expressions such as __import__ calls within quoted string literals in the generated source code, which Pydantic v2 evaluates as a ForwardRef via eval() during model_rebuild(), resulting in arbitrary code execution on developer workstations, CI/CD pipelines, or applications that generate and import the produced models at runtime.
Title datamodel-code-generator < 0.84.0 Code Injection via x-python-type Annotation
Weaknesses CWE-94
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 8.6, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


Projects

Sign in to view the affected projects.

cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-11-12T20:58:59.634Z

Reserved: 2026-11-12T16:30:10.903Z

Link: CVE-2026-127208

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Deferred

Published: 2026-11-12T21:17:22.933

Modified: 2026-11-12T21:17:23.090

Link: CVE-2026-127208

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-11-13T03:30:13Z

Weaknesses