CVE-2026-127208
JSON

8.6high

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

Severity
8.6high CVSS:4.0 by VulnCheck
Exploit likelihood
0.46% (higher than 41% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
VulnCheck

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.

Affected

Product or packageVersionsReported by
datamodel-code-generator datamodel-code-generatorbefore 0.84.0CVE List

All scores

VulnCheck8.6high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
VulnCheck8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-94

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-127208 changed 2026-11-13CVE Terms of Use
NVDCVE-2026-127208 changed 2026-11-13Public domain