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

- Severity: High 8.6 (CVSS:4.0, scored by VulnCheck) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.46%, higher than 41% of CVEs (2026-12-01)
- Published: 2026-11-12T20:58:59.634Z
- Modified: 2026-11-13T17:17:26.743Z
- Weaknesses: CWE-94
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact total
- Assigned by: 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.

(As written by CVE List.)

## Affected

- datamodel-code-generator datamodel-code-generator: before 0.84.0

## Every score

- VulnCheck: 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`
- VulnCheck: 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`

## References

- <https://github.com/datamodel-code-generator/datamodel-code-generator/releases/tag/0.84.0> (release-notes)
- <https://github.com/datamodel-code-generator/datamodel-code-generator/commit/ebfc11d0644d37a71374b28aac06d98748e584ec> (issue-tracking, patch)
- <https://www.vulncheck.com/advisories/datamodel-code-generator-code-injection-via-x-python-type-annotation> (third-party-advisory)

## Sources

- CVE List: [CVE-2026-127208](https://www.cve.org/CVERecord?id=CVE-2026-127208), CVE Terms of Use, modified 2026-11-13
- NVD: [CVE-2026-127208](https://nvd.nist.gov/vuln/detail/CVE-2026-127208), Public domain, modified 2026-11-13

---

Page: https://cve.day/CVE-2026-127208 · Whole record: https://cve.day/CVE-2026-127208.json · Rebuilt by cve.day 2026-11-25T22:59:50.566Z
