Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSupply malicious JSON Schema with crafted x-python-type
-
DeliveryGenerator emits quoted forward-ref expression bypassing validation
-
ExploitDeveloper/CI imports generated Pydantic v2 models
-
Executionmodel_rebuild() eval()s the ForwardRef
-
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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
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
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).
Primary rating from Vendor (vulncheck).
CVSS VectorVendor: vulncheck
Lifecycle Timeline
2DescriptionCVE.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.
Articles & Coverage 1
Executive ViewAI
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.
Apply vendor patch.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
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.
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
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
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
EUVD-2026-124714
GHSA-5hqf-87jh-5c5q
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB