# CVE-2026-108377: dataclasses-avroschema code injection in generated Python code

Source: https://junglewise.ai/threats/cve-2026-108377-dataclasses-avroschema-generates-avro-schemas-from-python  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-10-13. Updated: 2026-10-16  
License: CC BY 4.0 with a link back

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

dataclasses-avroschema is a Python library that converts Avro schemas into Python dataclasses and generates Python code from those schemas. An attacker who controls a maliciously crafted Avro schema can inject arbitrary Python code into the generated class definitions, which executes when the generated module is imported. This affects applications that generate Python code from untrusted or externally provided Avro schemas.

Technologies: [Dataclasses-Avroschema](https://junglewise.ai/threats/technologies/dataclasses-avroschema). Vendors: [Dataclasses-Avroschema](https://junglewise.ai/threats/vendors/dataclasses-avroschema).

## Quick answers

**Is CVE-2026-108377 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-108377 being exploited in the wild.

**How severe is CVE-2026-108377?** High severity, with a CVSS score of 8.8, published 13 October 2026.

**Which products and versions are affected?** Dataclasses-Avroschema 0.62.3 through 0.70.5.

**Is there a fix for CVE-2026-108377?** Yes: fixed in 0.70.6. Until then: Avoid generating Python code from untrusted or externally provided Avro schemas until upgrading to version 0.70.6. If code generation from external schemas is necessary, validate that all schema names and identifiers match the pattern [A-Za-z_][A-Za-z0-9_]* before processing. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-108377 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-108377?** Check whether you run 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

Avoid generating Python code from untrusted or externally provided Avro schemas until upgrading to version 0.70.6. If code generation from external schemas is necessary, validate that all schema names and identifiers match the pattern [A-Za-z_][A-Za-z0-9_]* before processing.

## Technical details

The vulnerability is a code injection flaw in ClassRepresentation.render_metaclass and related code generation functions. Schema-controlled Avro record names, defaults, namespaces, docs, and enum symbols are inserted into generated Python string literals and other code contexts without proper escaping or validation. A specially crafted schema value can terminate a string literal with a quote and inject arbitrary Python statements that execute at module import time. The fix (version 0.70.6) escapes values rendered into string literals using json.dumps and validates identifier positions against the Avro specification pattern `[A-Za-z_][A-Za-z0-9_]*`.

## Affected products

- dataclasses-avroschema dataclasses-avroschema 0.62.3 through 0.70.5

## Timeline

- 2026-10-13: disclosed

## References

- [https://github.com/marcosschroh/dataclasses-avroschema/commit/429f3d705d2d04c0c65e2ef832daed5ff91318fc](https://github.com/marcosschroh/dataclasses-avroschema/commit/429f3d705d2d04c0c65e2ef832daed5ff91318fc)
- [https://github.com/marcosschroh/dataclasses-avroschema/commit/919d3e07c8938369cfc2c0569007ba373247e74a](https://github.com/marcosschroh/dataclasses-avroschema/commit/919d3e07c8938369cfc2c0569007ba373247e74a)

## Related threats

- [dataclasses-avroschema code injection in enum generation](https://junglewise.ai/threats/cve-2026-108385-dataclasses-avroschema-generates-avro-schemas-from-python)
- [dataclasses-avroschema code injection in field documentation](https://junglewise.ai/threats/cve-2026-108380-dataclasses-avroschema-generates-avro-schemas-from-python)
- [dataclasses-avroschema code injection in generated model defaults](https://junglewise.ai/threats/cve-2026-108376-dataclasses-avroschema-generates-avro-schemas-from-python)
- [dataclasses-avroschema code injection in generated Python modules](https://junglewise.ai/threats/cve-2026-108375-dataclasses-avroschema-generates-avro-schemas-from-python)
