CVE-2026-127208

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

  • High 8.8

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.

Key facts

Published
12 Nov 2026
Last changed
13 Nov 2026
Assigned by
VulnCheck
EPSS
0.371% likely to be exploited in the next 30 days, higher than 31.548% of CVEs (scores for 15 Nov 2026)
SSVC (CISA)
Exploitation: none; Automatable: no; Technical impact: total

Severity scores

Each score is shown as its source gave it. They are not averaged or merged.

  • 8.6CVSS 4.0, Highfrom the CNA (VulnCheck)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
  • 8.8CVSS 3.1, Highfrom the CNA (VulnCheck)CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Historical context and remediation

This reference retains the original CVE publication date. A recent record update does not mean a new attack occurred.

No separately sourced impact summary is available on this page yet. Consult the description, version data and dated exploitation evidence.

No explicit remediation statement is available on this page yet. Consult the original record and vendor references before choosing a fix.

Version statuses below come from the CNA. An “unaffected” version is not necessarily a currently supported release or proof of a patch date. EPSS is a dated risk estimate, not a count of historical attacks.

Read the original CVE record.

Affected products

VendorProductVersions
datamodel-code-generatordatamodel-code-generator
  • Default status: unaffected
  • 0 up to but excluding 0.84.0 (affected)

Timeline

  1. 12 Nov 2026 Published

Weakness

References