SecurityContext

CVE-2026-54654: datamodel-code-generator - Code Injection

  • Cve: CVE-2026-54654
  • Name: datamodel-code-generator - Code Injection
  • Description: datamodel-code-generator generates Python data models from schema definitions. From 0.14.1 until 0.60.2, the --extra-template-data comment field is rendered into Python comments in src/datamodel_code_generator/model/template/TypeAliasAnnotation.jinja2, src/datamodel_code_generator/model/template/TypedDict.jinja2, src/datamodel_code_generator/model/template/dataclass.jinja2, src/datamodel_code_generator/model/template/msgspec.Struct.jinja2, src/datamodel_code_generator/model/template/pydantic/BaseModel.jinja2, and src/datamodel_code_generator/model/template/pydantic_v2/BaseModel.jinja2 without neutralizing carriage returns in Python # comments, allowing an attacker-controlled comment value to inject Python code into generated models that runs when imported. This issue is fixed in version 0.60.2.
  • Impact: Attackers can execute arbitrary Python code upon importing generated models, potentially leading to full system compromise.
  • Remediation: Update to version 0.60.2 or later.
  • Vulnerability type: code_injection
  • Vulnerability impact: remote_code_execution
  • Requirement type: none
  • Labels source: projectdiscovery
  • Severity: high
  • Cvss score: 7.8
  • Cvss vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
  • Epss score: 0.0021
  • Epss percentile: 0.11032
  • Assignee: [email protected]
  • Published at: 2026-07-28T22:17:40Z
  • Age in days: 119
  • Modified at: 2026-10-23T23:10:00Z
  • Patch available: yes
  • References total: 3
  • Products total: 1
  • Oss: yes
  • Projects total: 2
  • Advisory url: https://nvd.nist.gov/vuln/detail/CVE-2026-54654
  • Nvd status: deferred
  • Checked, none or zero: known exploited entries, nuclei templates, public exploits total, public exploits capped, public exploits, rejected by nvd
  • Not known: requirements, hackerone

Cwe

IdName
CWE-94Improper Control of Generation of Code

References

Same in every row:

  • Source: nvd
  • Tags:
Url
https://github.com/koxudaxi/datamodel-code-generator/commit/b73abb5cd703a50471b8950bbd3bd0b82ad71de7
https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.2
https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-wjv6-jcfj-mf9r

Products

ProductAffectedPlatform boundSourcesUrl
koxudaxi:datamodel-code-generator>= 0.14.1, < 0.60.2nocna_alias_text/v1/products/koxudaxi/datamodel-code-generator

Projects

RepositoryLink kindsIndexedUrl
koxudaxi/datamodel-code-generatorcommit, fix, package, releases, security_advisoryyes/v1/repositories/koxudaxi/datamodel-code-generator
datamodel-code-generator/datamodel-code-generatorfixyes/v1/repositories/datamodel-code-generator/datamodel-code-generator

Index

  • Repositories: 27
  • Repositories high signal: 22
  • Packages: 1

Exploitation

  • Checked, none or zero: known exploited, known exploited by, exploitation seen, public exploit, public exploit count, initial access, remote, authentication required
  • Not known: known exploited since, vulncheck known exploited since, public exploit first date, nuclei template, initial access since, hackerone reports, exposed hosts