{"affected":[{"defaultStatus":"unaffected","ecosystem":"pypi","packageName":"datamodel-code-generator","product":"datamodel-code-generator","source":"CNA: VulnCheck","vendor":"datamodel-code-generator","versions":[{"lessThan":"0.84.0","status":"affected","version":"0","versionType":"semver"}]}],"cveId":"CVE-2026-127208","cwes":["CWE-94"],"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.","epss":null,"exploits":[],"kev":null,"metrics":[{"score":8.6,"severity":"high","source":"CNA: VulnCheck","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","version":"4.0"},{"score":8.8,"severity":"high","source":"CNA: VulnCheck","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","version":"3.1"}],"modifiedAt":1794517139634,"publishedAt":1794517139634,"references":[{"source":"CNA: VulnCheck","tags":["release-notes"],"url":"https://github.com/datamodel-code-generator/datamodel-code-generator/releases/tag/0.84.0"},{"source":"CNA: VulnCheck","tags":["patch","issue-tracking"],"url":"https://github.com/datamodel-code-generator/datamodel-code-generator/commit/ebfc11d0644d37a71374b28aac06d98748e584ec"},{"source":"CNA: VulnCheck","tags":["third-party-advisory"],"url":"https://www.vulncheck.com/advisories/datamodel-code-generator-code-injection-via-x-python-type-annotation"}],"remediation":[{"kind":"fix","source":"CNA: VulnCheck","text":"The reporting source identifies this reference as a patch. Check the advisory for affected versions and supported release branches.","url":"https://github.com/datamodel-code-generator/datamodel-code-generator/commit/ebfc11d0644d37a71374b28aac06d98748e584ec"}],"revision":"07c1aa562a494e70eeecbdad6b4c258a46007cb3dab9ae38308c47584ba65547","sources":[{"modifiedAt":1794517139634,"name":"CNA: VulnCheck","retrievedAt":1794517753721,"url":"https://www.cve.org/CVERecord?id=CVE-2026-127208"}],"ssvc":null,"status":"published","title":"datamodel-code-generator < 0.84.0 Code Injection via x-python-type Annotation","updatedAt":1794517753721}