Description
datamodel-code-generator prior to version 0.70.0 contains a code injection vulnerability that allows attackers who control input schemas to achieve remote code execution by supplying a malicious customBasePath value containing embedded newlines and a dot-free Python expression. The crafted value is emitted verbatim into a generated 'from ... import ...' statement without identifier validation, causing arbitrary Python code to execute when the generated module is imported.
Published: 2026-07-26
Score: 7.5 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

datamodel-code-generator prior to version 0.70.0 contains a code injection vulnerability that allows attackers who control input schemas to achieve remote code execution by supplying a malicious customBasePath value containing embedded newlines and a dot-free Python expression. The crafted value is emitted verbatim into a generated 'from ... import ...' statement without identifier validation, causing arbitrary Python code to execute when the generated module is imported.

Affected Systems

The affected vendor is koxudaxi and the product is datamodel-code-generator. All releases before 0.70.0 are vulnerable. Any installation of the tool that can receive untrusted schema input may be impacted.

Risk and Exploitability

The vulnerability has a CVSS score of 7.5, indicating a high severity level. The EPSS score is less than 1%, suggesting a currently low likelihood of exploitation, and the issue is not listed in the CISA KEV catalog. The attack requires an attacker to supply a crafted schema that the target system processes with datamodel-code-generator; once the generated module is imported, arbitrary Python code executes. The exploitation path is plausible in environments where generated code is automatically imported or executed, particularly in code-generation pipelines or build processes that incorporate the tool without validating the customBasePath field.

Generated by OpenCVE AI on August 3, 2026 at 18:16 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade datamodel-code-generator to version 0.70.0 or later.
  • If immediate upgrade is not possible, validate the customBasePath value before passing it to the tool, ensuring it contains no newlines or malicious Python expressions.
  • Do not automatically import or execute modules generated by the tool until their content is verified, and consider running any such imports in an isolated environment.

Generated by OpenCVE AI on August 3, 2026 at 18:16 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 14 Aug 2026 17:15:00 +0000

Type Values Removed Values Added
CPEs cpe:2.3:a:koxudaxi:datamodel-code-generator:*:*:*:*:*:python:*:*

Wed, 12 Aug 2026 13:00:00 +0000


Mon, 27 Jul 2026 15:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Mon, 27 Jul 2026 13:15:00 +0000

Type Values Removed Values Added
First Time appeared Koxudaxi
Koxudaxi datamodel-code-generator
Vendors & Products Koxudaxi
Koxudaxi datamodel-code-generator

Sun, 26 Jul 2026 05:15:00 +0000

Type Values Removed Values Added
Description datamodel-code-generator prior to version 0.70.0 contains a code injection vulnerability that allows attackers who control input schemas to achieve remote code execution by supplying a malicious customBasePath value containing embedded newlines and a dot-free Python expression. The crafted value is emitted verbatim into a generated 'from ... import ...' statement without identifier validation, causing arbitrary Python code to execute when the generated module is imported.
Title datamodel-code-generator Code Injection via Unvalidated customBasePath Schema Field
Weaknesses CWE-94
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 7.5, 'vector': 'CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


Subscriptions

Koxudaxi Datamodel-code-generator
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-14T16:50:34.298Z

Reserved: 2026-07-17T21:21:58.624Z

Link: CVE-2026-63720

cve-icon Vulnrichment

Updated: 2026-07-27T14:40:00.861Z

cve-icon NVD

Status : Deferred

Published: 2026-07-26T05:16:23.927

Modified: 2026-08-12T13:17:23.283

Link: CVE-2026-63720

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-03T18:30:06Z

Weaknesses
  • CWE-94

    Improper Control of Generation of Code ('Code Injection')