Description
dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.44.0 through 0.70.5, the Pydantic and AvroDantic model generators insert a schema field's pydantic-class value after pydantic. in a generated field annotation without safely restricting the expression. Because annotations are evaluated when the generated module is imported, a crafted value can execute arbitrary Python code. Version 0.70.6 fixes the vulnerability by restricting the value to a bare name or a call to a bare name with literal arguments.
Published: 2026-10-13
Score: 8.8 High
EPSS: n/a
KEV: No
Impact: Remote Code Execution via import of generated code
Action: Immediate Patch
AI Analysis

Impact

The vulnerability arises in the dataclasses-avroschema tool, which generates Avro schemas from Python data definitions and also produces corresponding Python code. Between versions 0.44.0 and 0.70.5 the generator inserts a schema field’s pydantic-class value directly into a field annotation without sanitisation. When the generated module is imported, Python evaluates the annotation, allowing a crafted field value to execute arbitrary code. This flaw effectively permits remote code execution in any process that imports the generated module, compromising confidentiality, integrity, and availability of the target system.

Affected Systems

Affected products include the dataclasses-avroschema package maintained by marcosschroh on PyPI. Versions from 0.44.0 through 0.70.5 are impacted. The issue was resolved in release 0.70.6 and later revisions, which enforce that the pydantic-class value is either a bare name or a bare name call with literal arguments.

Risk and Exploitability

The CVSS score of 8.8 classifies this flaw as High severity. While no EPSS value is available, the lack of a KEV listing does not negate the risk. The attack vector is inferred to be local or from an untrusted schema source: an attacker who can supply a schema that will be compiled into Python code can trigger code execution when that code is imported. Once exploited, the attacker can run arbitrary commands with the privileges of the importing process. Defensive controls should focus on preventing untrusted schemas from being processed by the generator or sanitising metadata before code generation.

Generated by OpenCVE AI on October 13, 2026 at 19:56 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to dataclasses-avroschema version 0.70.6 or later, which sanitises the pydantic-class value.
  • If an upgrade is not immediately possible, manually enforce that any pydantic-class field contains only a simple identifier or a call with literal arguments, removing or sanitising any other content prior to code generation.
  • Treat any module generated from untrusted or external schemas as untrusted code and avoid importing it into production environments.
  • Run the generation process in an isolated environment and validate the resulting code before use.

Generated by OpenCVE AI on October 13, 2026 at 19:56 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 13 Oct 2026 18:00:00 +0000

Type Values Removed Values Added
Description dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.44.0 through 0.70.5, the Pydantic and AvroDantic model generators insert a schema field's pydantic-class value after pydantic. in a generated field annotation without safely restricting the expression. Because annotations are evaluated when the generated module is imported, a crafted value can execute arbitrary Python code. Version 0.70.6 fixes the vulnerability by restricting the value to a bare name or a call to a bare name with literal arguments.
Title dataclasses-avroschema pydantic-class metadata allows code injection in generated annotations
Weaknesses CWE-94
References
Metrics cvssV3_1

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


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-10-13T17:43:11.422Z

Reserved: 2026-10-09T21:36:27.043Z

Link: CVE-2026-108381

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-10-13T18:17:17.310

Modified: 2026-10-13T18:17:17.310

Link: CVE-2026-108381

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-13T20:00:16Z

Weaknesses
  • CWE-94

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