dataclasses-avroschema: Code injection via pydantic-class metadata in generated models
Summary
dataclasses-avroschema generates Python models from Avro schemas. In the Pydantic and AvroDantic model generators, the schema field's pydantic-class value is inserted into a generated field annotation without proper restriction. Because annotations are evaluated when the generated module is imported, a crafted schema can execute arbitrary Python code in the process that imports the module.
Affected
- dataclasses-avroschema versions from 0.44.0 through 0.70.5 (start of range per CNA; sources conflict, treat all versions before 0.70.6 as affected)
Fixed in
- Version 0.70.6 and later
Workaround
- Unknown. No vendor-documented workaround. Do not pass untrusted pydantic-class values to the generator.
Exploitation
- The advisory includes a proof of concept, verified against 0.70.5. CISA SSVC: exploitation status PoC, not automatable.
- No evidence of in-the-wild exploitation found.
Our recommendation
- Upgrade dataclasses-avroschema to 0.70.6 or later.
- Check lockfiles and requirements of all Python projects for versions below 0.70.6.
- Only generate models from Avro schemas that you control or have vetted.
- Prioritise as high if schemas come from external or partner systems, medium if they are trusted and self-written.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- GitHub Security Advisory GHSA-4jmx-9m83-vxx8 github.com
- Release 0.70.6 github.com
- Fix commit 429f3d7 github.com
- Pull request #358 github.com
- OSV CVE-2026-108381 osv.dev
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:42.
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.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.
NVD references (5)
- https://github.com/marcosschroh/dataclasses-avroschema/commit/429f3d705d2d04c0c65e2ef832daed5ff91318fc
- https://github.com/marcosschroh/dataclasses-avroschema/pull/358
- https://github.com/marcosschroh/dataclasses-avroschema/releases/tag/0.70.6
- https://github.com/marcosschroh/dataclasses-avroschema/security/advisories/GHSA-4jmx-9m83-vxx8
- https://github.com/marcosschroh/dataclasses-avroschema/security/advisories/GHSA-4jmx-9m83-vxx8
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.
