top of page
perceptive_background_267k.jpg

datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JS…

Published:

28 juli 2026 om 00:00:00

Alert date:

29 juli 2026 om 01:04:30

Source:

nvd.nist.gov

Click to open the original link from this advisory

Supply Chain & Dependencies, Web Technologies

CVE-2026-54653 affects datamodel-code-generator versions 0.17.0 through 0.60.2, a tool that generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from various schema formats. The vulnerability exists in src/datamodel_code_generator/parser/jsonschema.py where attacker-controlled default_factory values are preserved through JsonSchemaObject.init and get_field_extras. These values are then emitted into Field(default_factory=...) or field(default_factory=...) calls in the generated code. When a user imports the generated model, the malicious Python expressions are executed, leading to arbitrary code execution. The attack vector requires an attacker to supply a crafted schema input to the code generator. The issue has been patched in version 0.60.2, and users are advised to upgrade immediately.

Technical details

Mitigation steps:

Affected products:

datamodel-code-generator 0.17.0 - 0.60.1

Related links:

Related CVE's:

Related threat actors:

IOC's:

This article was created with the assistance of AI technology by Perceptive.

© 2025 by Perceptive Security. All rights reserved.

email: info@perceptivesecurity.com

Deze website toont informatie afkomstig van externe bronnen; Perceptive aanvaardt geen verantwoordelijkheid voor de juistheid, volledigheid of actualiteit van deze informatie.

bottom of page