# CVE-2026-127208 - datamodel-code-generator \< 0.84.0 Code Injection via x-python-type Annotation

DevFeed: [CVE-2026-127208 - datamodel-code-generator \< 0.84.0 Code Injection via x-python-type Annotation](<https://devfeed.tech/articles/cve-2026-127208-datamodel-code-generator-0-84-0-code-injection-via-x-python-type-annotation-130952.md>)

Original publisher: [Read original article](<https://cvefeed.io/vuln/detail/CVE-2026-127208>)

Author: CVEFEED.io; vulncheck.com

Published: 2026-11-12T21:17:22Z

Content type: news

Language: en

Sources: [Latest High/Critical Vulnerabilitiy Feed](<https://devfeed.tech/sources/latest-high-critical-vulnerabilitiy-feed.md>)

Topics: [execution](<https://devfeed.tech/topics/execution.md>), [Pydantic](<https://devfeed.tech/topics/pydantic.md>), [Python](<https://devfeed.tech/topics/python.md>), [JSON](<https://devfeed.tech/topics/json.md>)

Tags: [2026](<https://devfeed.tech/tags/2026.md>), [annotation](<https://devfeed.tech/tags/annotation.md>), [ast](<https://devfeed.tech/tags/ast.md>), [ci-cd](<https://devfeed.tech/tags/ci-cd.md>), [ci-cd-pipelines](<https://devfeed.tech/tags/ci-cd-pipelines.md>), [code-execution](<https://devfeed.tech/tags/code-execution.md>), [code-generator](<https://devfeed.tech/tags/code-generator.md>), [code-injection](<https://devfeed.tech/tags/code-injection.md>), [cve](<https://devfeed.tech/tags/cve.md>), [cve-2026-127208](<https://devfeed.tech/tags/cve-2026-127208.md>), [eval](<https://devfeed.tech/tags/eval.md>), [json-schema](<https://devfeed.tech/tags/json-schema.md>), [malicious](<https://devfeed.tech/tags/malicious.md>), [pydantic](<https://devfeed.tech/tags/pydantic.md>), [python](<https://devfeed.tech/tags/python.md>), [rebuild](<https://devfeed.tech/tags/rebuild.md>), [runtime](<https://devfeed.tech/tags/runtime.md>), [source-code](<https://devfeed.tech/tags/source-code.md>), [string](<https://devfeed.tech/tags/string.md>), [validation](<https://devfeed.tech/tags/validation.md>)

## AI overview

datamodel-code-generator versions before 0.84.0 are vulnerable to code injection through a crafted JSON Schema x-python-type annotation. A string ast.Constant in a subscript slice position can bypass validation; malicious expressions in generated source may then be evaluated by Pydantic v2 as a ForwardRef during model_rebuild(), enabling arbitrary code execution where generated models are imported. The excerpt identifies developer workstations, CI/CD pipelines, and runtime model-generation applications as potentially affected environments. It reports severity 8.8 (High), but lists no affected products in its table and provides no remediation details.

## Source excerpt

CVE ID :CVE-2026-127208 Published : Nov. 12, 2026, 9:17 p.m. | 52 minutes ago 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. Severity: 8.8 | HIGH Visit the link for more details, such as CVSS details, affected products, timeline, and more...