CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-54656

CVE-2026-54656: Arbitrary Code Execution in datamodel-code-generator via Unescaped Validator Configurations

Alon Barad
Alon Barad
Software Engineer

Jul 29, 2026·6 min read·51 visits

Executive Summary (TL;DR)

Unescaped string formatting in Pydantic v2 validator generation enables arbitrary code execution at module import time when processing malicious configurations.

CVE-2026-54656 is a high-severity arbitrary code execution vulnerability in the koxudaxi/datamodel-code-generator Python package. When processing validator metadata from external configuration files passed via the --extra-template-data argument, the code generator performs unescaped string interpolation into Pydantic v2 @field_validator decorators. This allows local attackers to construct malicious configuration files that inject arbitrary Python statements into generated models, executing code upon downstream import. This vulnerability has been resolved in version 0.60.2.

Vulnerability Overview

CVE-2026-54656 is a high-severity code injection vulnerability (classified under CWE-94) in the Python library datamodel-code-generator. The package is widely utilized to compile raw schemas—such as OpenAPI specifications, JSON Schema definitions, and GraphQL configurations—into clean Python classes, primarily targeting the Pydantic data validation framework. The vulnerability is situated within the library's Pydantic v2 code generation module, specifically involving the processing of user-defined field validation rules.\n\nThe attack surface is exposed when the code generator processes supplemental field-level validation settings supplied via the --extra-template-data command-line argument. This argument accepts custom metadata formats containing validator parameters. If an attacker can control or supply a maliciously prepared configuration file, they can control the inputs evaluated during code emission.\n\nBecause the target platform lacks robust validation or escaping on these properties, arbitrary Python payloads can be injected directly into the structure of generated files. This architectural vulnerability means that code execution occurs automatically as soon as any downstream system imports or loads the newly generated Python modules. The flaw represents a substantial threat to automated build systems, continuous integration (CI) environments, and developer workstations that programmatically process untrusted schemas.

Root Cause Analysis

The root cause of CVE-2026-54656 resides in src/datamodel_code_generator/model/pydantic_v2/base_model.py within the _process_validators() method. This method is designed to parse customized validation settings under the validators block of the configuration mapping. It extracts metadata keys such as fields, field, function, and mode to build lists of validation instructions that are subsequently passed to a Jinja2 template representing Pydantic @field_validator class decorators.\n\nDuring processing, the method evaluates the fields list and constructs a string representation (fields_str) using a list comprehension over an f-string: fields_str = ", ".join(f"'{f}'" for f in fields). The application assumes that input values are basic string field identifiers, wrapping each in single quotes without any character validation or sanitization. Similarly, the validator execution mode is formatted directly via mode_str = f"mode='{mode}'" without verification against permitted Pydantic validation phases.\n\nThis implementation creates a classic code generation escape. If a string within the fields list or mode contains a single quote character ('), the literal boundary of the Python string is terminated inside the generated code. A comma can then be appended to introduce new function parameters, or arbitrary Python expressions can be written to execute payload logic directly within the decorator's argument evaluation context.

Code Analysis

The vulnerable implementation in the _process_validators() function performs string joining via f-strings. Consider the key section of the vulnerable codebase:\n\npython\n# Vulnerable code block in base_model.py\ndef _process_validators(self) -> None:\n validators = self.extra_template_data.get(\"validators\")\n if not validators:\n return\n ...\n for validator in validators:\n fields = validator.get(\"fields\")\n # Unsafe f-string join without escaping\n fields_str = \", \".join(f\"'{f}'\" for f in fields)\n \n # Unsafe mode construct\n mode_str = f\"mode='{mode}'\"\n ...\n\n\nThe Jinja2 template renders these properties directly inside the class definition scope: @field_validator({{ fields_str }}, {{ mode_str }}). This direct inclusion permits the embedding of sub-expressions inside the decorator statement.\n\nTo remediate this issue, the maintainers implemented a multi-stage defensive strategy in commit a43d02906111a2fdcaf13ee5b62eb2da85376f19. First, they integrated a validation function normalize_validators() to parse inputs against structured schema models. Second, they replaced raw f-string interpolation with safe serialization using repr() and Python's string representation formats:\n\npython\n# Patched code block in base_model.py\n# The input data is processed through strong schema enforcement models\nfrom datamodel_code_generator.validators import normalize_validators\n\ndef _process_validators(self) -> None:\n self.extra_template_data.pop(\"prepared_validators\", None)\n validators = self.extra_template_data.get(\"validators\")\n if not validators:\n return\n\n # Enforce type, structural and identifier validation rules\n try:\n validators = normalize_validators(validators)\n except ValidationError as e:\n raise Error(f\"Invalid validators configuration: {format_validation_error(e)}\") from e\n ...\n for validator in validators:\n ...\n # Refactored to utilize safe string representation serializing\n fields_str = \", \".join(repr(f) for f in fields)\n \n # Uses Python format specifier '!r' which acts as repr()\n mode_str = f\"mode={mode!r}\"\n ...\n\n\nThis structural patch prevents injection. Any single quotes contained within the parameter values are correctly escaped as \\' during repr() evaluation, neutralizing the string breakout vector.

Exploitation Methodology

Exploitation of CVE-2026-54656 is local but can be weaponized in automated pipelines or client-side execution contexts. To trigger the flaw, an attacker must supply a malicious JSON or YAML configuration file via the --extra-template-data CLI parameter. There are three primary avenues for injection: field-level breakout, validation mode injection, and import-level injection.\n\nIn a field breakout scenario, an attacker modifies the configuration structure to inject Python execution primitives inside the string boundaries. An input structure targeting the field parameter might resemble the following:\n\njson\n{\n \"User\": {\n \"validators\": [\n {\n \"field\": \"name', __import__('os').system('touch /tmp/pwned'), 'email\",\n \"function\": \"myapp.validators.validate_name\"\n }\n ]\n }\n}\n\n\nDuring compilation, the generator writes the following line to the output Python model: @field_validator('name', __import__('os').system('touch /tmp/pwned'), 'email', mode='after'). When this generated file is loaded downstream (such as by an import statement or a test runner), the Python interpreter executes the __import__('os').system(...) command during module initialization, culminating in arbitrary command execution on the host environment.

Impact Assessment

The security impact of CVE-2026-54656 is assessed as high, with a CVSS v3.1 base score of 7.8 (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H). The local attack vector requires that a user or an automated agent execute the generator with a malicious input file and subsequently load the output Python module.\n\nBecause the payload executes at module-definition time upon import, it inherits the execution context and permissions of the executing process. This allows for compromise of confidentiality, integrity, and availability. In typical DevOps pipelines, the importing application may run with elevated privileges or hold environment secrets (such as API keys, cloud credentials, or database connection strings) that can be readily exfiltrated by a payload.\n\nWhile this CVE is not currently active in CISA's Known Exploited Vulnerabilities (KEV) catalog, the ease with which proof-of-concept payloads can be generated makes it a high risk for build pipelines processing third-party configurations.

Remediation & Patch Analysis

The recommended remediation is to upgrade datamodel-code-generator to version 0.60.2 or later. This release enforces a rigid validation schema, requiring that validator modes conform to Pydantic-approved constants (before, after, wrap, plain) and verifying that target fields are valid Python identifiers.\n\nIf immediate software upgrade is not feasible, operational environments should apply strict input filtering on configuration files before ingestion. Implement schema checkers to verify that all elements under validators are clean alphanumeric sequences, specifically rejecting any files containing control characters, semicolons, or single quotes.\n\nAdditionally, isolate automated build processes that utilize datamodel-code-generator within containerized sandboxes. Restrict the network egress of these environments during runtime to prevent exfiltration of credentials if an injection is successfully processed.

Fix Analysis (1)

Technical Appendix

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

Affected Systems

datamodel-code-generator

Affected Versions Detail

Product
Affected Versions
Fixed Version
datamodel-code-generator
koxudaxi
>= 0.52.1, < 0.60.20.60.2
AttributeDetail
CWE IDCWE-94
Attack VectorLocal
CVSS v3.17.8 (High)
Exploit Statuspoc
ImpactArbitrary Code Execution
Affected Range>= 0.52.1, < 0.60.2
Patched Version0.60.2

MITRE ATT&CK Mapping

T1059Command and Scripting Interpreter
Execution
T1203Exploitation for Client Execution
Execution
CWE-94
Improper Control of Generation of Code ('Code Injection')

The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended code segment when it is sent to a downstream component.

References & Sources

  • [1]NVD - CVE-2026-54656
  • [2]GitHub Security Advisory GHSA-8m8r-38jm-f355
  • [3]datamodel-code-generator v0.60.2 Release Notes

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 10 hours ago•CVE-2026-63304
8.1

CVE-2026-63304: OS Command Injection in WWBN AVideo via listFFmpegProcesses

WWBN AVideo versions through 29.0 contain an OS command injection vulnerability (CWE-78) in the standalone API utility function listFFmpegProcesses(). The function constructs a shell pipeline to monitor active FFmpeg processes by interpolating a user-controlled keyword parameter directly into a single-quoted grep argument without sanitization or shell escaping. An attacker capable of crafting or submitting a valid encrypted codeToExec payload can break out of the single-quoted argument context and execute arbitrary operating system commands with the privileges of the web server user.

Alon Barad
Alon Barad
4 views•9 min read
•about 11 hours ago•CVE-2026-59726
10.0

CVE-2026-59726: Unauthenticated Remote Code Execution in Ruflo MCP Bridge

Ruflo versions prior to 3.16.3 expose the Model Context Protocol (MCP) bridge HTTP endpoints (`POST /mcp` and `POST /mcp/:group`) on all network interfaces (`0.0.0.0:3001`) without authentication. Because the primary JSON-RPC tool dispatcher (`executeTool()`) bypasses existing tool blocklists, an unauthenticated network attacker can invoke the `terminal_execute` tool to achieve arbitrary command execution inside the bridge container. This initial access permits full exfiltration of third-party LLM provider API keys, unauthorized access to the co-located MongoDB instance, and manipulation of the AgentDB learning store.

Alon Barad
Alon Barad
11 views•2 min read
•about 12 hours ago•CVE-2026-59818
6.5

CVE-2026-59818: Improper Certificate Revocation List (CRL) Validation on Split gRPC Listeners in etcd

In etcd versions prior to 3.5.32 and 3.6.13, configuring the server with --listen-client-http-urls decouples HTTP and gRPC traffic onto distinct network listeners. Due to an implementation flaw in how TLS configurations are passed to the gRPC server instance, the Certificate Revocation List (CRL) defined by --client-crl-file is enforced exclusively on the HTTP listener and omitted entirely on the dedicated gRPC listener. This allows an adversary possessing a revoked, CA-signed client certificate to bypass mutual TLS (mTLS) revocation checks and authenticate directly to the gRPC interface.

Amit Schendel
Amit Schendel
6 views•10 min read
•about 13 hours ago•CVE-2026-59831
4.4

CVE-2026-59831: Remote Code Execution via Unvalidated URL Scheme Handling in GitHub CLI

GitHub CLI (gh) versions 2.10.0 through 2.95.0 contain an input validation vulnerability in the `gh codespace jupyter` command path. When connecting to a remote Codespace to launch a JupyterLab session, the CLI retrieves a server URL via a remote procedure call (RPC) and passes it directly to the host operating system's default URL dispatcher without validating the scheme or target host. A compromised or malicious Codespace can return a custom protocol URI, such as `vscode://` or `vscode-insiders://`, allowing an attacker to invoke local desktop application handlers and achieve arbitrary command execution on the developer's workstation.

Alon Barad
Alon Barad
13 views•9 min read
•about 14 hours ago•CVE-2026-59191
6.9

CVE-2026-59191: Path Traversal and Arbitrary File Read in CakePHP TwigView FileLoader

A path traversal vulnerability exists in the cakephp/twig-view plugin for the CakePHP framework prior to versions 1.3.3 and 2.1.2. The Cake\TwigView\Twig\FileLoader::findTemplate() method verifies template existence using PHP's native file_exists() function without ensuring the target path resides within configured application or plugin template directories. When user-controlled input is passed to template inclusion mechanisms, an unauthenticated remote attacker can read arbitrary local files accessible to the PHP runtime.

Alon Barad
Alon Barad
6 views•9 min read
•about 15 hours ago•CVE-2026-64855
8.2

CVE-2026-64855: Cryptographic Signature Verification Bypass in soapbar WS-Security Implementation

CVE-2026-64855 (GHSA-859w-52fx-hcm6) is a cryptographic signature verification and authentication bypass vulnerability in the soapbar Python library prior to version 0.13.0. In vulnerable versions, the verify_envelope_bsp() function derives its trust anchor directly from the incoming SOAP message by extracting an untrusted X.509 certificate embedded inside the wsse:BinarySecurityToken header. Because the function checks only the temporal validity of the extracted certificate without performing Certificate Authority (CA) chain validation or certificate pinning, an unauthenticated network attacker can generate a self-signed certificate, sign an arbitrary SOAP payload, and pass verification.

Amit Schendel
Amit Schendel
9 views•10 min read