CVE-2026-127208

published 12 Nov 2026 · updated 13 Nov 2026

datamodel-code-generator < 0.84.0 Code Injection via x-python-type Annotation

8.8HighCVSS 8.8EPSS 0%

No exploitation in the wild has been reported. EPSS puts the chance of exploitation in the next 30 days at 0%. Fixed in 0.84.0.

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.

Affected

Vendors, products and packages with version ranges

VendorProductVersionsFixed
datamodel-code-generator<0.84.00.84.0

Timeline

Every event on this vulnerability

Embed

A live severity badge for an advisory, README or ticket

CVE-2026-127208 severity on Zeptric[![CVE-2026-127208](https://zeptric.io/badge/cve/CVE-2026-127208.svg)](https://zeptric.io/cve/CVE-2026-127208)