CVE-2026-108376

dataclasses-avroschema allows code injection through record names in generated default factories

Published Oct 13, 2026 CVSS 3.1 · 8.8 High EPSS < 1% KEV · Not listed
Description
dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.47.3 through 0.70.5, FieldRepresentation.get_field_default inserts a schema-controlled referenced record name into the callable position of a generated default_factory lambda without validating it as an Avro name. A crafted record name can become an arbitrary Python expression that executes when an instance of the generated model consumes the field default. Version 0.70.6 fixes the vulnerability by rejecting record names that do not match the Avro name grammar.

Analysis

AI-generated

Technical impact

A flaw in dataclasses-avroschema allows a crafted Avro record name to be injected as a Python expression in the lambda used for a field's default_factory. When the generated model creates an instance, this expression is evaluated, giving the attacker the ability to execute arbitrary code. The weakness is an input validation failure (CWE-94).

Affected Systems

The issue impacts the Python library marcosschroh:dataclasses-avroschema versions 0.47.3 through 0.70.5. Systems that use these releases to generate dataclasses, Pydantic models, or Faust records from Avro schemas are potentially affected.

Risk and Exploitability

The CVSS score of 8.8 indicates a high severity. While no EPSS score is available, the lack of a KEV listing does not diminish the potential for exploitation. The vulnerability can be triggered when an attacker supplies a malicious record name during schema creation, making it most relevant for applications that import or process external Avro schemas without validating record names. Given the high severity and the ability to execute code on model instantiation, the risk is substantial under the described conditions.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the library to version 0.70.6 or later, which rejects invalid record names
  • Apply strict input validation to any Avro record names before passing them to dataclasses-avroschema
  • Avoid importing or generating schemas from untrusted sources; use safe sandboxing or content filtering

Generated by OpenCVE AI on October 13, 2026 at 18:54 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

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

Type Values Removed Values Added
First Time appeared Marcosschroh
Marcosschroh dataclasses-avroschema
Vendors & Products Marcosschroh
Marcosschroh dataclasses-avroschema
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.38.0 through 0.70.5, FieldRepresentation.get_field_default renders a schema-controlled enum field default as an enum member reference after applying case conversion but without validating it as an identifier. Newlines, operators, and punctuation can escape the intended reference and inject constrained statements into the generated module, allowing namespace modification or preventing the module from loading. Version 0.70.6 fixes the vulnerability by validating enum defaults as names. dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.47.3 through 0.70.5, FieldRepresentation.get_field_default inserts a schema-controlled referenced record name into the callable position of a generated default_factory lambda without validating it as an Avro name. A crafted record name can become an arbitrary Python expression that executes when an instance of the generated model consumes the field default. Version 0.70.6 fixes the vulnerability by rejecting record names that do not match the Avro name grammar.
Title dataclasses-avroschema enum field defaults can inject statements into generated modules dataclasses-avroschema allows code injection through record names in generated default factories
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.38.0 through 0.70.5, FieldRepresentation.get_field_default renders a schema-controlled enum field default as an enum member reference after applying case conversion but without validating it as an identifier. Newlines, operators, and punctuation can escape the intended reference and inject constrained statements into the generated module, allowing namespace modification or preventing the module from loading. Version 0.70.6 fixes the vulnerability by validating enum defaults as names.
Title dataclasses-avroschema enum field defaults can inject statements into generated modules
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'}

Weaknesses
  • CWE-94

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

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Oct 16, 2026, 10:23 PM
Reserved
Oct 9, 2026, 9:36 PM
Status
Awaiting Analysis
Published
Oct 13, 2026, 6:17 PM
Modified
Oct 16, 2026, 11:16 PM