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

CVE-2026-108379: dataclasses-avroschema RCE Vulnerability

CVE-2026-108379 is a remote code execution flaw in dataclasses-avroschema affecting versions 0.38.0 through 0.70.5. Attackers can inject malicious code via crafted namespace values. This article covers technical details, affected versions, impact assessment, and mitigation strategies.

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-108379 Overview

CVE-2026-108379 is a code injection vulnerability [CWE-94] in dataclasses-avroschema, a Python library that generates Avro schemas from dataclasses, Pydantic models, and Faust Records, and generates Python code from Avro schemas. The flaw exists in BaseGenerator.parse_fixed, which embeds a fixed type's namespace value between quotes inside a generated types.confixed annotation without escaping or validation. An attacker who supplies a crafted Avro schema can terminate the namespace string and inject arbitrary Python expressions. Python evaluates the injected code at class definition time, resulting in arbitrary code execution. Versions 0.38.0 through 0.70.5 are affected, and version 0.70.6 contains the fix.

Critical Impact

A crafted namespace value in an Avro schema triggers arbitrary Python code execution when the generated model class is defined.

Affected Products

  • dataclasses-avroschema versions 0.38.0 through 0.70.5
  • Python applications that generate code from untrusted Avro schemas using this library
  • Downstream tooling that invokes BaseGenerator.parse_fixed on attacker-controlled input

Discovery Timeline

  • 2026-10-13 - CVE-2026-108379 published to the National Vulnerability Database
  • 2026-10-13 - Last updated in NVD database

Technical Details for CVE-2026-108379

Vulnerability Analysis

The vulnerability is a code injection flaw in the Python model generator of dataclasses-avroschema. When processing an Avro fixed type, BaseGenerator.parse_fixed constructs a types.confixed(...) annotation string by concatenating the schema's namespace field between quote characters. Because the generator writes this annotation directly into Python source code that is later executed, any characters capable of breaking out of the surrounding string literal become executable code.

The generated class source is subsequently loaded by Python, meaning injected expressions run with the privileges of the process performing code generation. This typically occurs during build pipelines, schema registry integrations, or client stub generation, where the resulting access can be used to steal secrets, pivot into connected systems, or persist on CI/CD infrastructure.

Root Cause

The root cause is missing validation and escaping of the namespace field before it is interpolated into a Python source template. The generator trusted the Avro schema to contain safe identifier characters. Avro namespaces must be dot-separated sequences of valid Avro names, but the library did not enforce this constraint prior to code emission.

The fix in version 0.70.6 introduces an InvalidSchemaValue exception and a validate_type_expression helper that reject any value that cannot be safely rendered into generated source. Values are refused rather than escaped, because they end up as code rather than as string literals.

Attack Vector

Exploitation requires an application to generate Python model code from an Avro schema that an attacker can influence. The attacker supplies a fixed type whose namespace contains a quote character followed by arbitrary Python. When the generator writes the types.confixed annotation, the quote closes the intended string literal and the trailing content becomes an expression that Python evaluates when the generated class is defined.

python
# Security patch from version 0.70.6 - new validation primitive
# Source: https://github.com/marcosschroh/dataclasses-avroschema/commit/429f3d705d2d04c0c65e2ef832daed5ff91318fc

class InvalidSchemaValue(Exception):
    """
    A value taken from the schema cannot be rendered into the generated source.

    It is raised for the values that end up in code rather than in a string literal --
    a name, a namespace, an annotation -- where escaping does not apply and the only
    safe answer is to refuse the schema.
    """

    def __init__(self, value, location, expected) -> None:
        self.value = value
        self.location = location
        self.expected = expected

    def __str__(self) -> str:
        return (
            f"Invalid {self.location} {self.value!r}. It is rendered into the generated source as code, "
            f"so it must be {self.expected}"
        )

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-108379

Indicators of Compromise

  • Avro schemas containing fixed type definitions with namespace values that include quote characters, parentheses, or Python keywords
  • Unexpected child processes spawned by Python interpreters running schema generation jobs
  • Outbound network connections initiated by build agents or schema registry workers at class-definition time

Detection Strategies

  • Audit code-generation pipelines for use of dataclasses-avroschema at versions 0.38.0 through 0.70.5
  • Scan Avro schema sources for non-conforming namespace values that violate the dot-separated Avro name grammar
  • Review CI/CD logs for anomalous process execution, file writes, or outbound connections during model generation steps

Monitoring Recommendations

  • Instrument build and generator hosts with endpoint telemetry that captures Python interpreter child processes and script arguments
  • Log all schema ingestion events, including source, schema hash, and the identity of the submitter
  • Alert on code-generation jobs that write files outside expected output directories or make external DNS and HTTP requests

How to Mitigate CVE-2026-108379

Immediate Actions Required

  • Upgrade dataclasses-avroschema to version 0.70.6 or later across all services, build systems, and developer environments
  • Inventory every pipeline that calls BaseGenerator.parse_fixed or performs Python code generation from Avro schemas
  • Treat any Avro schema sourced from external parties or shared registries as untrusted until the upgrade is complete

Patch Information

The fix is available in dataclasses-avroschema 0.70.6. The patch, applied in commit 429f3d7, introduces the InvalidSchemaValue exception and the validate_type_expression helper, and requires namespaces to be dot-separated sequences of valid Avro names. See the GitHub Security Advisory GHSA-h9q3-f96w-f88j for the full disclosure.

Workarounds

  • Validate Avro namespace fields against the regular expression for dot-separated Avro names before passing schemas to the generator
  • Run model generation in an isolated sandbox with no network access and least-privilege credentials
  • Restrict schema registry write permissions so only trusted identities can publish schemas consumed by generators
bash
# Upgrade to the patched version
pip install --upgrade 'dataclasses-avroschema>=0.70.6'

# Verify the installed version
python -c "import dataclasses_avroschema; 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.