dataclasses-avroschema: Code injection in generated Pydantic models
Summary
dataclasses-avroschema generates Python code from Avro schemas and Python models. A schema field's doc value is inserted into a generated pydantic.Field description without escaping, so a crafted quote can end the string and inject Python expressions. The injected code runs when the generated class definition is evaluated, which affects Pydantic and AvroDantic model generation.
Affected
- dataclasses-avroschema from 0.65.9 through 0.70.5 (CNA record: >= 0.65.9, < 0.70.6)
- Affected model types: pydantic and avrodantic
Fixed in
- Version 0.70.6 (escapes the documentation value before rendering it)
Workaround
Unknown. The vendor advisory does not document a workaround.
Exploitation
- CISA SSVC lists exploitation as 'poc' (proof of concept) and automatable as 'no'.
- Public exploit availability is reported inconsistently: some trackers report no public PoC or exploit.
- No evidence of exploitation in the wild found.
Our recommendation
- Check for the package with 'pip show dataclasses-avroschema' and in requirements or lock files.
- Upgrade to version 0.70.6 or later.
- Until the upgrade is done, generate code only from trusted schemas and do not import generated modules from untrusted sources.
- Review doc fields in schemas received from external parties.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- GitHub Security Advisory GHSA-g7p7-mgvm-jw7p github.com
- Fix commit 429f3d7 github.com
- Pull request #843 github.com
- Release 0.70.6 github.com
- OSV entry CVE-2026-108380 osv.dev
- VulDB entry 417867 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: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.65.9 through 0.70.5, PydanticFieldRepresentation.add_field_properties inserts a schema field's doc value between the quotes of a generated pydantic.Field description argument without escaping it. A crafted quote can terminate the string and inject an expression evaluated during generated class definition, allowing arbitrary Python code execution for Pydantic and AvroDantic model generation. Version 0.70.6 fixes the vulnerability by escaping the documentation value before rendering it.
NVD references (5)
- https://github.com/marcosschroh/dataclasses-avroschema/commit/429f3d705d2d04c0c65e2ef832daed5ff91318fc
- https://github.com/marcosschroh/dataclasses-avroschema/pull/843
- https://github.com/marcosschroh/dataclasses-avroschema/releases/tag/0.70.6
- https://github.com/marcosschroh/dataclasses-avroschema/security/advisories/GHSA-g7p7-mgvm-jw7p
- https://github.com/marcosschroh/dataclasses-avroschema/security/advisories/GHSA-g7p7-mgvm-jw7p
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.
