dataclasses-avroschema: Code injection via enum symbols in generated Python code
Summary
The Python library dataclasses-avroschema generates Avro schemas from Python classes and generates Python code from Avro schemas. In versions 0.38.0 through 0.70.5, enum symbols from a schema are inserted into generated code inside double quotes without escaping. A crafted symbol containing a quote can break out of the string literal and inject arbitrary Python code, which runs when the generated module is imported. The generator classes are used directly in the affected scenario, and the attacker must be able to supply or alter schema content.
Affected
- dataclasses-avroschema versions >= 0.38.0 and < 0.70.6 (up to and including 0.70.5)
Fixed in
- Version 0.70.6 (escapes enum symbol values before rendering; the vendor's companion advisory indicates that enum symbols are also validated as names)
Workaround
- No workaround is documented by the vendor.
- Interim measure: do not generate code from untrusted or unreviewed schemas, and review enum symbols in schemas from external registries before generation.
Exploitation
- CISA SSVC: exploitation status 'poc', automatable: no, technical impact: total.
- No evidence of exploitation in the wild found; CISA KEV status not verified.
- No public exploit found in the sources reviewed.
Our recommendation
- Identify all installations and lock files or CI images that include dataclasses-avroschema and check for versions 0.38.0 to 0.70.5.
- Upgrade to version 0.70.6 or later and rebuild generated modules.
- Restrict code generation to trusted schemas and review schemas from partners or external registries before generation.
- Relevance for most SMEs is low, unless models are auto-generated from external Avro schemas in CI or data pipelines.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- GitHub Security Advisory GHSA-vrq9-94ww-jv3c github.com
- Fix commit 429f3d7 github.com
- Release 0.70.6 github.com
- OSV CVE-2026-108382 osv.dev
- VulDB 417866 vuldb.com
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, EnumRepresentation.render_symbols concatenates each schema-controlled enum symbol between double quotes in a generated enum assignment. When generator classes are used directly, a quote can terminate the string literal and inject arbitrary Python code into the enum class body, which executes when the generated module is imported. Version 0.70.6 fixes the vulnerability by escaping enum symbol values before rendering them.
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-vrq9-94ww-jv3c
- https://github.com/marcosschroh/dataclasses-avroschema/security/advisories/GHSA-vrq9-94ww-jv3c
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.
