CVE-2026-127208
datamodel-code-generator before 0.84.0 contains a code injection …
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.
What to do now
- Check your exposureFind out whether the affected software runs anywhere in your environment, including systems of suppliers.
- UpdateInstall the version in which the vendor fixed the vulnerability. The references lead to the advisory.
- Limit access until thenIf you cannot update at once, take the system off the internet or restrict who can reach it.
References
- github.com/datamodel-code-generator/datamodel-code-generator/commit/ebfc11d0644d37a71374b2
- github.com/datamodel-code-generator/datamodel-code-generator/releases/tag/0.84.0
- www.vulncheck.com/advisories/datamodel-code-generator-code-injection-via-x-python-type-ann
- nvd.nist.gov/vuln/detail/CVE-2026-127208
- cve.org/CVERecord?id=CVE-2026-127208
Data: CVE list and the NVD. This product uses data from the NVD API but is not endorsed or certified by the NVD.