Skip to main content
Vulnerability Database/CVE-2026-108375

CVE-2026-108375: dataclasses-avroschema RCE Vulnerability

CVE-2026-108375 is a remote code execution flaw in dataclasses-avroschema affecting versions 0.38.0 through 0.70.5. Crafted defaults can inject code into generated modules. This post covers technical details, impact, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-108375 Overview

CVE-2026-108375 is a code injection vulnerability [CWE-94] in dataclasses-avroschema, a Python library that generates Avro schemas from dataclasses, Pydantic models, and Faust Records. The flaw affects versions 0.38.0 through 0.70.5. The FieldRepresentation.get_field_default method inserts schema-controlled string, UUID, bytes, and fixed field defaults into quoted Python literals in generated source without escaping them. An attacker who controls an Avro schema value can terminate the literal and inject arbitrary Python statements. The injected code executes when the generated module is imported. Version 0.70.6 resolves the issue by escaping schema values rendered into generated string literals.

Critical Impact

Arbitrary Python code execution occurs when a developer or build pipeline imports a module generated from a malicious Avro schema.

Affected Products

  • dataclasses-avroschema version 0.38.0 through 0.70.5
  • Python projects using ModelGenerator to produce code from untrusted Avro schemas
  • CI/CD and codegen pipelines that import generated modules automatically

Discovery Timeline

  • 2026-10-13 - CVE CVE-2026-108375 published to NVD
  • 2026-10-13 - Last updated in NVD database

Technical Details for CVE-2026-108375

Vulnerability Analysis

The dataclasses-avroschema library includes a model generator that converts Avro schemas into Python source code. During code emission, FieldRepresentation.get_field_default renders default values for string, UUID, bytes, and fixed fields directly into Python string literals in the output module. The function wraps the value in quotes but does not escape embedded quote characters, backslashes, or newlines.

An attacker who supplies a crafted schema can place a closing quote inside a default value, then append arbitrary Python statements. The emitted source becomes a valid Python module containing attacker-controlled code at module scope. When the application or build pipeline imports the generated module, the injected statements execute with the privileges of the importing process.

Root Cause

The root cause is missing output encoding when serializing schema-controlled strings into generated source code. The generator treated the Avro default field as trusted text and used naive string concatenation instead of a safe literal serializer such as repr().

Attack Vector

Exploitation requires that a victim run ModelGenerator against an attacker-controlled schema and then import or execute the resulting module. Common exposure paths include schema registries, pull-request-driven codegen, and tooling that regenerates data models from upstream Avro definitions.

python
# Patch excerpt (public exports added by the model generator feature)
from .field_utils import *  # noqa: 401
from .model_generator.generator import BaseClassEnum, ModelGenerator  # noqa: 401
from .schema_generator import AvroModel  # noqa: 401
from .types import *  # noqa: 401
# Source: https://github.com/marcosschroh/dataclasses-avroschema/commit/01e6d5e15ab0ff69faac39a340d21b85da1e852f

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-108375

Indicators of Compromise

  • Generated Python modules containing unexpected statements outside class definitions, such as import os, subprocess, or network calls at module scope.
  • Avro schema fields with default values containing quote characters, backslashes, or newline sequences.
  • Build or CI processes spawning child processes immediately after importing generated model modules.

Detection Strategies

  • Scan source control for dataclasses-avroschema versions between 0.38.0 and 0.70.5 in requirements.txt, poetry.lock, or pyproject.toml.
  • Diff newly generated model files against prior versions and flag any top-level executable code.
  • Validate Avro schemas before codegen by rejecting default values containing unescaped quotes or control characters.

Monitoring Recommendations

  • Alert on unexpected outbound network connections or process creation originating from CI runners and developer workstations during model regeneration.
  • Log all invocations of ModelGenerator and record the schema source URL or registry subject.
  • Monitor schema registry writes and review changes to default fields on string, UUID, bytes, and fixed types.

How to Mitigate CVE-2026-108375

Immediate Actions Required

  • Upgrade dataclasses-avroschema to version 0.70.6 or later across all projects and build images.
  • Audit any Python modules previously generated from untrusted Avro schemas and regenerate them with the patched version.
  • Restrict write access to schema registries and require code review for changes to default values.

Patch Information

Version 0.70.6 escapes schema values rendered into generated string literals, closing the injection path in FieldRepresentation.get_field_default. See the GitHub Security Advisory GHSA-9h8h-264x-jcg2, the GitHub Release 0.70.6, and the GitHub Commit Notice for details.

Workarounds

  • Treat all Avro schemas from external sources as untrusted and validate default fields before codegen.
  • Execute ModelGenerator in a sandboxed container with no network egress and ephemeral credentials.
  • Review generated modules in pull requests before merging, ensuring no top-level executable statements are present.
bash
# Upgrade to the patched release
pip install --upgrade 'dataclasses-avroschema>=0.70.6'

# Verify the installed version
python -c "import dataclasses_avroschema, sys; print(dataclasses_avroschema.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.