Skip to main content

datamodel-code-generator CVE-2026-127208

| EUVDEUVD-2026-124714 HIGH
Code Injection (CWE-94)
2026-11-12 disclosure@vulncheck.com GHSA-5hqf-87jh-5c5q
8.6
CVSS 4.0 · Vendor: vulncheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Supply malicious JSON Schema with crafted x-python-type
  2. Delivery
    Generator emits quoted forward-ref expression bypassing validation
  3. Exploit
    Developer/CI imports generated Pydantic v2 models
  4. Execution
    model_rebuild() eval()s the ForwardRef
  5. Impact
    __import__ payload executes arbitrary code

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires the victim to process an attacker-controlled JSON Schema containing an x-python-type annotation whose value is a string ast.Constant placed in a subscript slice position (outside a Literal[...] context), which bypasses parse_python_type_annotation / _python_type_expr_from_ast validation in versions before 0.84.0. Execution occurs only when the generated Pydantic v2 models are subsequently imported and rebuilt: model_rebuild() evaluates the injected quoted forward reference via eval(). Limiting factors: the attacker needs no authentication (PR:N) but cannot fire the payload alone - a developer, CI/CD pipeline, or runtime process must actually run the generator on the malicious schema and then import/instantiate the output (UI:A). Exploitation is therefore constrained to workflows that feed untrusted schemas into datamodel-code-generator with Pydantic v2 model generation and then load the results; it does not affect a running service that merely received the schema without code generation. Updating to 0.84.0 is the vendor's fix.

Impact

This is a genuine, high-priority developer-supply-chain vulnerability rather than an inflated high-CVSS issue, but its risk is gated by a required user action. The vendor CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:A, VC:H/VI:H/VA:H, score 8.6) describes network-reachable, low-complexity, unauthenticated code injection with full confidentiality/integrity/availability impact on the vulnerable system and no scope change - consistent with the description's arbitrary code execution and CWE-94. The PR:N (no attacker authentication) combined with UI:A (the victim developer must actually run the generator on the malicious schema and then import/rebuild the produced models) is the key nuance: this is not autonomous mass exploitation but a trigger that fires when untrusted schemas flow through a developer, CI/CD, or runtime model-generation path. No EPSS score was provided and the input shows no CISA KEV listing, so there is no evidence of active in-the-wild exploitation; however, the fix commit's regression test publicly embeds a working injection payload ('__import__(...)'), meaning the trigger is demonstrated in public source. The vuln.today decision label 'this_week' aligns with a serious-but-interaction-gated flaw: patch promptly, but widespread automated exploitation is less likely than targeted abuse via poisoned schema/OpenAPI sources. Signals are internally consistent; the main unconfirmed items are EPSS and KEV (absent from input, not necessarily zero risk).

Exploit ScenarioDerived

An attacker publishes or tampers with a JSON Schema / OpenAPI document (e.g., in a public registry, shared API spec, or dependency) containing an x-python-type annotation with a crafted string constant in a subscript slice. A developer or CI/CD pipeline runs datamodel-code-generator (before 0.84.0) over that schema, and when the generated Pydantic v2 models are imported and model_rebuild() runs, Python's eval() resolves the quoted ForwardRef and executes the embedded __import__ payload. The fix commit's own regression test demonstrates a functional payload, so the trigger mechanism is publicly known.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 12, 2026

Code injection in datamodel-code-generator before 0.84.0 lets an attacker hide a Python expression inside a JSON Schema's x-python-type annotation so that it is emitted as a quoted forward reference in the generated Pydantic v2 models. Unauthenticated remote attackers can supply the malicious schema, but the payload only fires when a developer, CI/CD pipeline, or runtime process actually imports the generated models and Pydantic evaluates the forward reference via eval() during model_rebuild(), so exploitation requires that user interaction. No public exploit code was identified at time of analysis and the issue is not in CISA KEV; vendor-released patch 0.84.0 addresses the parser bypass.

RemediationAI

Vendor-released patch: upgrade datamodel-code-generator to 0.84.0, which restricts string and bytes constants to Literal[...] positions and rejects quoted forward references injected through x-python-type (fix commit ebfc11d0644d37a71374b28aac06d98748e584ec; release notes at https://github.com/datamodel-code-generator/datamodel-code-generator/releases/tag/0.84.0). Updating is the vendor's fix; until it is applied, exposure is limited to workflows that generate models from untrusted schemas and then import them, so treating schemas as trusted input and withholding generation plus import of attacker-supplied definitions removes the code-execution path, at the cost of restricting legitimate use of third-party schema sources. Generated model code should be treated as executable content in the supply chain, and the execution context (developer workstation, CI runner, or runtime process) should be reviewed wherever pre-0.84.0 generation from external schemas occurs.

Affected VersionsENISA

datamodel-code-generator 0 <0.84.0

Affected Packages

euvd datamodel_code_generator fix: 0.84.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

datamodel-code-generator is a Python code-generation tool that converts JSON Schema, OpenAPI, and similar definitions into typed model classes. Its x-python-type annotation extension lets schema authors request arbitrary Python type expressions, which the library parses into an AST and re-renders into generated source (parse_python_type_annotation and _python_type_expr_from_ast in _python_type_annotation_codec.py). Prior to 0.84.0, a string ast.Constant appearing in a subscript slice position outside a Literal[...] context (for example list["__import__('builtins').print('XPT_EXEC')"]) was accepted and emitted as a quoted forward reference rather than rejected. Pydantic v2 resolves such forward references with eval() when model_rebuild() runs, turning the generated source into an arbitrary-code-execution sink. The fix adds an _is_literal_base helper and an allow_string_literal flag so string and bytes constants are only permitted as Literal members, raising _InvalidPythonTypeAnnotationError everywhere else. This is a code-injection weakness (CWE-94) rooted in insufficient validation of attacker-controlled type expressions, not a memory-safety or race condition issue.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (vulncheck) PRIMARY 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
vuln.today AI 8.8 HIGH

Attacker needs no authentication (PR:N) but a developer/CI must run the generator and import the output (UI:R); code runs in the victim's process (S:U) with full RCE impact (C/I/A:H).

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

Primary rating from Vendor (vulncheck).

CVSS VectorVendor: vulncheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Active
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch available
Nov 12, 2026 - 22:02 EUVD
CVE Published
Nov 12, 2026 - 21:17 cve.org
HIGH 8.6

DescriptionCVE.org

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.

Executive ViewAI

Why It Matters

CVE-2026-127208 is a high-severity code injection vulnerability in the datamodel-code-generator tool (versions before 0.84.0), used by development teams to generate Pydantic models from JSON schemas. An attacker who can influence a schema-such as through a shared repository or external source-could hide a malicious Python expression that executes when the generated models are imported by a developer or CI/CD pipeline, potentially compromising the build environment or production systems. Leadership should care because this affects the software supply chain and could lead to unauthorized code execution within trusted development workflows.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.4%
Top 68% exploitable
Prevalence
Medium
popular Python model-generation library, but a developer/CI tool, not everywhere
Social Media
2
Sightings
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

43
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +43
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy