datamodel-code-generator is vulnerable to Code Injection
88
CVE Score
High
Code Injection
When generating Python models from attacker-controlled JSON Schema, OpenAPI, or related schema input, schema-provided default_factory values are interpolated verbatim into generated Field(default_factory=...) or field(default_factory=...) calls without validation. The expression is evaluated at class-definition time when the generated module is imported, enabling arbitrary code execution in the developer or CI process. Default invocation against a malicious schema reaches this sink without special CLI flags. The fix whitelists only dict, list, and set as allowed factory names and rejects other values before code generation.
Upgrade the datamodel-code-generator library to the patch version.
You are affected if you are using a version that falls within the vulnerable range.
0.17.0 - 0.60.1
Fixed in 0.60.2datamodel-code-generator is vulnerable to Code Injection in versions 0.17.0 - 0.60.1.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.