CVE-2026-127208
published high CVSS 4.0 · 8.6datamodel-code-generator < 0.84.0 Code Injection via x-python-type Annotation
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| datamodel-code-generator | — | datamodel-code-generator0 to < 0.84.0 · Other versions: unaffected | Affected | Not stated | VulnCheck |
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 4.0
- Base score
- 8.6 / 10
- Severity
- high
- Provider
- VulnCheck · cna
- Vector string
- 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
- Scenarios
- en: GENERAL
Additional Assessments
| Version | Score | Severity | Provider | Vector | Scenarios |
|---|---|---|---|---|---|
| 3.1 | 8.8 | high | VulnCheck · cna | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H | en: GENERAL |
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| datamodel-code-generator | datamodel-code-generator | 0 to < 0.84.0 (affected · semver)Default: unaffected | VulnCheck · cna |
Weaknesses
1- CWE-94 Improper Control of Generation of Code ('Code Injection')
References
3- Patch Commit https://github.com/datamodel-code-generator/datamodel-code-generator/commit/ebfc11d0644d37a71374b28aac06d98748e584ec
- Release Notes https://github.com/datamodel-code-generator/datamodel-code-generator/releases/tag/0.84.0
- VulnCheck Advisory: datamodel-code-generator < 0.84.0 Code Injection via x-python-type Annotation https://www.vulncheck.com/advisories/datamodel-code-generator-code-injection-via-x-python-type-annotation
Provider assertions
2VulnCheck · cna
datamodel-code-generator < 0.84.0 Code Injection via x-python-type Annotation
CISA-ADP · adp
CISA ADP Vulnrichment
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- 5cced6d2d420a7cbb054ebb1d1084dd03eee7aa38ef77dc1408230d35aa3330f
- Ingested
- 13 Nov 2026, 16:18:46 UTC
- Source record
- Official CVE record