CVE-2026-108381: dataclasses-avroschema code injection in generated annotations

CVE-2026-108381 · Severity: high · CVSS 8.8 · Published 2026-10-13

dataclasses-avroschema is a Python library that generates Avro schemas from dataclasses and generates Python code from Avro schemas. Versions 0.44.0 through 0.70.5 contain a critical vulnerability where crafted Avro schema values are inserted into generated Python code without proper escaping, allowing arbitrary code execution when the generated module is imported. This affects applications that generate models from untrusted or externally-sourced schemas.

Technologies: Marcosschroh Dataclasses-Avroschema. Vendors: Marcosschroh.

Quick answers

Is CVE-2026-108381 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-108381 being exploited in the wild.
How severe is CVE-2026-108381?
High severity, with a CVSS score of 8.8, published 13 October 2026.
Which products and versions are affected?
Marcosschroh Dataclasses-Avroschema 0.44.0 through 0.70.5.
Is there a fix for CVE-2026-108381?
Yes: fixed in 0.70.6. Until then: Restrict the import and processing of Avro schemas to trusted sources only. Avoid generating models from schemas obtained from untrusted registries or external systems until upgraded.</anigation> <parameter name="timeline">[{"kind": "disclosed", "at": "2026-10-13"}, {"kind": "patched", "at": "2026-08-18", "note": "Fix committed prior to public disclosure"}] Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-108381 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-108381?
Check whether you run Marcosschroh Dataclasses-Avroschema at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • Fixed in: 0.70.6

Restrict the import and processing of Avro schemas to trusted sources only. Avoid generating models from schemas obtained from untrusted registries or external systems until upgraded.</anigation> <parameter name="timeline">[{"kind": "disclosed", "at": "2026-10-13"}, {"kind": "patched", "at": "2026-08-18", "note": "Fix committed prior to public disclosure"}]

Technical details

The vulnerability exists in the Pydantic and AvroDantic model generators, which insert schema field values (particularly the `pydantic-class` annotation) into generated Python source code without safe restriction. Multiple schema attributes including record names, enum symbols, field defaults, and docstrings are rendered directly into string literals and identifier positions in the emitted code. An attacker can craft a malicious Avro schema with specially-crafted values to break out of string literals or inject code into identifier positions, resulting in arbitrary Python code execution during module import.

Affected products

  • marcosschroh dataclasses-avroschema 0.44.0 through 0.70.5

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.