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

CVE-2026-108384: dataclasses-avroschema RCE Vulnerability

CVE-2026-108384 is a remote code execution flaw in dataclasses-avroschema that allows arbitrary code execution through crafted schemas. This post explains its impact, affected versions, and mitigation steps.

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

CVE-2026-108384 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. Versions 0.38.0 through 0.70.5 are affected. The BaseGenerator.parse_fixed method interpolates a fixed type's aliases value directly into a generated types.confixed annotation. When aliases is supplied as a bare string instead of a list, the value is emitted as unquoted Python code and evaluated when the generated module is imported. A crafted Avro schema therefore achieves arbitrary code execution against any system that imports the generated module.

Critical Impact

An attacker who controls an Avro schema processed by a vulnerable version can execute arbitrary Python code on the host that imports the generated module.

Affected Products

  • dataclasses-avroschema version 0.38.0 through 0.70.5
  • Python applications that import modules generated from untrusted Avro schemas
  • Downstream tooling using BaseGenerator.parse_fixed for code generation

Discovery Timeline

  • 2026-10-13 - CVE-2026-108384 published to NVD
  • 2026-10-13 - Last updated in NVD database
  • Patch released - Version 0.70.6 fixes the issue by rejecting aliases values that are not lists (GitHub Release 0.70.6)

Technical Details for CVE-2026-108384

Vulnerability Analysis

The flaw sits in the Python code-generation path of dataclasses-avroschema. For Avro fixed types, BaseGenerator.parse_fixed builds a types.confixed(...) annotation and injects the schema's aliases field directly into the rendered source. When the schema supplies aliases as a list, each entry is quoted and the resulting source is safe. When aliases is a bare string, the generator writes it as an unquoted token. Python then evaluates that token at import time, allowing any callable expression embedded in the schema to run with the privileges of the process importing the generated module. This is a classic schema-to-source injection pattern that converts data into executable code.

Root Cause

The generator does not validate that aliases is a list before string-interpolating it into generated Python source. The patch introduces a dedicated InvalidSchemaValue exception and a validate_type_expression helper, ensuring values destined for code positions (names, namespaces, annotations) are rejected rather than escaped when they do not match the expected structural type.

Attack Vector

Exploitation requires an attacker to supply or influence an Avro schema that is subsequently processed by a vulnerable version to generate Python code, and then have that generated module imported. Any pipeline that ingests third-party schemas, such as schema registries, message brokers, or shared repositories, is a viable delivery channel. Successful exploitation yields arbitrary code execution in the context of the importing process.

python
# Patch excerpt: new exception introduced to reject unsafe values
# 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):
        self.value = value
        self.location = location
        self.expected = expected

    def __str__(self):
        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-108384

Indicators of Compromise

  • Avro schemas containing a fixed type where aliases is a string literal rather than a JSON list.
  • Generated Python modules whose types.confixed(...) annotations contain unquoted expressions, function calls, or references to os, subprocess, or __import__.
  • Unexpected child processes, outbound network connections, or file writes originating from Python processes that import generated schema modules.

Detection Strategies

  • Perform static review of all generated model files for types.confixed annotations whose arguments are not quoted strings.
  • Scan ingested Avro schemas for the pattern "aliases":\s*" on fixed types, which indicates a non-list value.
  • Audit CI/CD logs for dataclasses-avroschema versions in the range 0.38.0 to 0.70.5 and flag builds that imported generated modules.

Monitoring Recommendations

  • Monitor Python application telemetry for process spawns, shell invocations, or network egress initiated during module import.
  • Alert on changes to the schema registry or shared schema repositories that modify the aliases field of fixed types.
  • Track dependency inventories so that any reintroduction of a vulnerable dataclasses-avroschema version triggers a review.

How to Mitigate CVE-2026-108384

Immediate Actions Required

  • Upgrade dataclasses-avroschema to version 0.70.6 or later across all build and runtime environments.
  • Regenerate any Python modules previously produced from third-party Avro schemas using the patched version.
  • Quarantine and review generated modules created from untrusted schemas while version 0.70.5 or earlier was in use.

Patch Information

Version 0.70.6 fixes the vulnerability by rejecting aliases values that are not lists. The fix adds the InvalidSchemaValue exception in dataclasses_avroschema/exceptions.py and introduces validate_type_expression to enforce structural checks on values rendered into generated source. See the GitHub Security Advisory GHSA-8j5c-xq6f-2c43 and the upstream patch commit.

Workarounds

  • Validate schemas before processing and reject any fixed type whose aliases field is not a JSON list.
  • Treat Avro schemas from external sources as untrusted input and run code generation in an isolated, non-privileged sandbox.
  • Avoid importing generated modules directly in production processes until they have been reviewed and the library has been upgraded.
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.