← News

Datamodel-code-generator: arbitrary code execution

HighAI-generated2026-11-14

CVE
CVE-2026-127208
Severity
High (CVSS 8.8)
Attack conditions
Remotely, over the network · No account needed · A user must take some action
Exploitation probability (EPSS)
0.3% (within 30 days; FIRST EPSS, 16 November 2026)

Summary

Datamodel-code-generator versions before 0.84.0 allow attackers to run arbitrary code by providing a malicious JSON Schema with a crafted annotation.

Details

According to the NVD record, datamodel-code-generator prior to version 0.84.0 has a code injection flaw. The vulnerability is triggered when a specially crafted JSON Schema includes an x-python-type annotation that bypasses internal validation checks.

An attacker can embed malicious Python code, such as __import__ calls, inside quoted strings. When the generated source code is processed by Pydantic v2, the code is evaluated, leading to arbitrary code execution on developer machines, CI/CD pipelines, or any application that imports the generated models at runtime.

What to do

The source record does not name a specific patch, fixed version or workaround. General measures:

  • Follow the vendor's security advisories.
  • Apply the update when it is released.
  • Limit access to the product as much as possible, especially from the internet.

Sources

Timeline

  • 12 November 2026 NVD record published
  • 14 November 2026 This article was written