Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. datamodel-code-generator
  4. ›
  5. CVE-2026-55415

CVE-2026-55415: datamodel-code-generator vulnerable to code injection via `x-python-import` / `customTypePath` in generated import statements

July 28, 2026

A malicious input schema (OpenAPI / JSON Schema) can execute arbitrary Python code on the machine that imports the generated model. The x-python-import and customTypePath schema extensions flow, unsanitized, into the import statements datamodel-code-generator emits. A newline embedded in the extension value breaks out of the from … import … line and injects an attacker-controlled statement at module scope, which runs at import time. This is an unauthenticated, schema-content–driven remote code execution against any consumer of the generated code (e.g. arbitrary file read,the PoC exfiltrates /etc/passwd). It survives the v0.61.0 security release that fixed the related x-python-type, default_factory, GraphQL-union-description, and validators sinks those fixes did not cover this sibling path.

References

  • github.com/advisories/GHSA-5578-w22f-pfx9
  • github.com/koxudaxi/datamodel-code-generator/commit/577d49569c2254c371a97e495020ae2238a73b84
  • github.com/koxudaxi/datamodel-code-generator/releases/tag/0.64.0
  • github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-5578-w22f-pfx9
  • nvd.nist.gov/vuln/detail/CVE-2026-55415

Code Behaviors & Features

Detect and mitigate CVE-2026-55415 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions starting from 0.11.6 before 0.64.0

Fixed versions

  • 0.64.0

Solution

Upgrade to version 0.64.0 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-94: Improper Control of Generation of Code ('Code Injection')
  • CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')

Source file

pypi/datamodel-code-generator/CVE-2026-55415.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:17:18 +0000.