{
  "affected": [
    {
      "ranges": [
        {
          "database_specific": {
            "extracted_events": [
              {
                "introduced": "0.25.0"
              },
              {
                "fixed": "0.60.1"
              }
            ],
            "source": "AFFECTED_FIELD"
          },
          "events": [
            {
              "introduced": "a46fe94e36806eb4c24cf4e6327afbd5aff3b2f4"
            },
            {
              "fixed": "a321547e8b94d352394b6f98c919866fc149473c"
            }
          ],
          "repo": "https://github.com/datamodel-code-generator/datamodel-code-generator",
          "type": "GIT"
        },
        {
          "database_specific": {
            "source": "REFERENCES"
          },
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "aec47bc414779f4a9992b3919c8f7663afd6c988"
            },
            {
              "fixed": "a321547e8b94d352394b6f98c919866fc149473c"
            }
          ],
          "repo": "https://github.com/koxudaxi/datamodel-code-generator",
          "type": "GIT"
        }
      ]
    }
  ],
  "aliases": [
    "GHSA-j884-q54q-mmx3"
  ],
  "database_specific": {
    "cna_assigner": "GitHub_M",
    "cwe_ids": [
      "CWE-1336",
      "CWE-94"
    ],
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54621.json"
  },
  "details": "datamodel-code-generator generates Python data models from schema definitions. Prior to 0.60.1, GraphQL Union description values in src/datamodel_code_generator/model/template/UnionTypeStatement.jinja2 and src/datamodel_code_generator/model/template/UnionTypeStatement.py312.jinja2 are rendered into Python comments without neutralizing carriage returns in Python # comments, allowing attacker-controlled GraphQL schema content to inject Python code into generated models that runs when imported. This issue is fixed in version 0.60.1.",
  "id": "CVE-2026-54621",
  "modified": "2026-09-08T11:30:53.030109305Z",
  "published": "2026-07-28T21:35:27.863Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.1"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54621.json"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-j884-q54q-mmx3"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-54621"
    },
    {
      "type": "FIX",
      "url": "https://github.com/koxudaxi/datamodel-code-generator/commit/aec47bc414779f4a9992b3919c8f7663afd6c988"
    }
  ],
  "schema_version": "1.9.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description"
}