dataclasses-avroschema: Code injection via enum defaults in generated modules
Summary
The Python library dataclasses-avroschema generates Python code from Avro schemas. In versions 0.38.0 through 0.70.5, enum field defaults from the schema are written into the generated module without identifier validation, so a crafted schema can inject additional statements. An attacker who controls the schema could modify the module namespace or stop the generated module from loading. Exploitation requires that a developer or pipeline generates code from the untrusted schema and then imports it.
Affected
- dataclasses-avroschema versions 0.38.0 through 0.70.5 (CVE record)
- Mend lists the affected range as starting at 0.70.0, not 0.38.0
Fixed in
- Upgrade to dataclasses-avroschema 0.70.6, which validates enum defaults as names.
Workaround
- No vendor-documented workaround for unpatched versions.
- Until the upgrade: generate code only from trusted schemas and review generated modules before import.
Exploitation
- No known exploitation in the wild; no KEV listing found.
- No public proof-of-concept found for this CVE.
- CISA SSVC: exploitation none, automatable no, technical impact total.
- The maintainer rates the impact as narrower than arbitrary code execution; case folding often breaks injected code syntactically.
- The CVSS score differs by source: CNA 8.8, VulDB 6.3, Mend CVSS v4 8.7.
Our recommendation
- Upgrade every environment that uses dataclasses-avroschema for code generation to 0.70.6.
- Until then, generate code only from trusted, internally controlled Avro schemas.
- Review generated modules before importing them, especially those produced from third-party schemas.
- Check CI pipelines and developer machines for affected versions, for example with pip show dataclasses-avroschema.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- CVE-2026-108383 OSV entry osv.dev
- GitHub Security Advisory GHSA-4xxf-mv22-hcr8 github.com
- Fix commit 429f3d7 github.com
- Release 0.70.6 github.com
- VulDB entry 417881 vuldb.com
- Mend vulnerability database entry www.mend.io
Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 31 Oct 2026, 19:43.
Original description (NVD)
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.
NVD references (4)
- https://github.com/marcosschroh/dataclasses-avroschema/commit/429f3d705d2d04c0c65e2ef832daed5ff91318fc
- https://github.com/marcosschroh/dataclasses-avroschema/releases/tag/0.70.6
- https://github.com/marcosschroh/dataclasses-avroschema/security/advisories/GHSA-4xxf-mv22-hcr8
- https://github.com/marcosschroh/dataclasses-avroschema/security/advisories/GHSA-4xxf-mv22-hcr8
Sources
The tracker combines official, freely usable data sources – updated continuously:
- NVD (NIST) – CVEs, rating (CVSS), affected products
- CISA KEV – vulnerabilities confirmed by CISA as actively exploited
- CISA Vulnrichment – CISA assessment (SSVC) in the official CVE record
- FIRST EPSS – probability of exploitation
- Microsoft MSRC – Patch Tuesday: vulnerabilities, severity, updates
- PoC-in-GitHub – public proof-of-concept repositories
- Metasploit (Rapid7) – modules of the Metasploit Framework
- Exploit-DB (OffSec) – archive of public exploits (links only)
- Patch days: official vendor pages (linked per vendor) (Vendor patch days)
This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.
Affected? We can help.
We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.
