cve.bz

CVE-2026-127208

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

8.6 high

High (8.6) in datamodel-code-generator datamodel-code-generator.

On this page
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.

Severity

CVSS 4.0

8.6 high
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

CVSS 3.1

8.8 high
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CWE
CWE-94 Improper Control of Generation of Code (Code Injection)
OWASP Top 10
A05:2025 Injection
Published
Modified
Assigned by
VulnCheck (CNA)
NVD analysis
Deferred: the NVD does not plan to analyze it
Record from
the NVD, synced

Ask an AI about this CVE

Show the promptExplain CVE-2026-127208 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2026-127208?via=ask-ai-copy and https://cve.bz/cve/CVE-2026-127208?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2026-127208 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Badge for a README or a site

CVE-2026-127208

An image that stays current: it is drawn from the data each time it is fetched (a host that proxies images, as GitHub does, may show its copy for a while). Markdown:

[![CVE-2026-127208](https://cve.bz/cve/badge/CVE-2026-127208.svg)](https://cve.bz/cve/CVE-2026-127208)

HTML:

<a href="https://cve.bz/cve/CVE-2026-127208"><img src="https://cve.bz/cve/badge/CVE-2026-127208.svg" alt="CVE-2026-127208"></a>

Affected

Versions

From the CNA's record in the CVE List.

ProductAffected
datamodel-code-generatorbefore 0.84.0

Attack patterns (CAPEC)

  • CAPEC-35 Leverage Executable Code in Non-Executable Files Likelihood: High · Severity: Very High
  • CAPEC-77 Manipulating User-Controlled Variables Likelihood: High · Severity: Very High
  • CAPEC-242 Code Injection Likelihood: High · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

History

  1. The NVD deferred its analysis

Changes since this site first stored the record. The same for every record: /api/public/changes.

References

Check your stackJSON