PyPI
CVE-2026-127208
datamodel-code-generator < 0.84.0 Code Injection via x-python-type Annotation
- Severity
- High 8.6
- Published
- 12 Nov 2026
- Last changed
- 13 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 0.84.0
- Exploit chance
- 0.4% in the next 30 daysHigher than 31% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- Code injection (CWE-94)
- Attack
- Over the network · No login needed · Needs someone to click or open something
- Attacker can
- Read data · Change data · Take it down
- CVSS vector
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- Sources
- CVE Program
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.
Affected software
| Software | Affected versions |
|---|---|
datamodel-code-generatorPyPI · osv:PyPI:datamodel-code-generator |
|
About datamodel-code-generator
- Weekly downloads (PyPI)
- 4,574,767PyPI Stats, 24 Nov 2026
This is the only vulnerability in datamodel-code-generator in our list.
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-127208