CVE-2026-108380 in dataclasses-avroschemainfo

Summary

by MITRE • 10/13/2026

dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.65.9 through 0.70.5, PydanticFieldRepresentation.add_field_properties inserts a schema field's doc value between the quotes of a generated pydantic.Field description argument without escaping it. A crafted quote can terminate the string and inject an expression evaluated during generated class definition, allowing arbitrary Python code execution for Pydantic and AvroDantic model generation. Version 0.70.6 fixes the vulnerability by escaping the documentation value before rendering it.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 10/13/2026

The dataclasses-avroschema library serves as a bridge between Python object definitions and Apache Avro serialization formats, enabling developers to generate Avro schemas from Python dataclasses, Pydantic models, and Faust Records while also facilitating code generation from existing Avro schemas. Within the version range spanning 0.65.9 through 0.70.5, a critical server-side request forgery and arbitrary code execution vulnerability exists within the PydanticFieldRepresentation.add_field_properties method. This function is responsible for mapping schema field attributes to their corresponding Python representations during the code generation process. Specifically, when processing documentation strings associated with Avro schema fields, the library fails to properly sanitize or escape special characters before embedding them into the generated Python source code.

The technical flaw centers on string interpolation logic that directly inserts a schema field's doc value between the quotes of a generated pydantic.Field description argument without performing necessary escaping operations. In standard Python syntax, strings enclosed in double quotes allow for variable substitution and expression evaluation if not handled correctly within dynamic generation contexts. By failing to escape quotation marks present in the input documentation string, an attacker can craft a malicious doc value that contains unescaped quote characters. This malformed input effectively terminates the intended string literal prematurely, allowing subsequent content to be interpreted as executable Python code rather than data.

This vulnerability leads to severe operational impacts, primarily arbitrary Python code execution during the model generation phase. When a developer or automated system processes an Avro schema containing a crafted doc field with injected payloads, the resulting generated class definition will execute the embedded expressions immediately upon import or instantiation of the module. This constitutes a Remote Code Execution (RCE) vector if the source of the Avro schemas is not fully trusted, such as when consuming schemas from external partners or public registries without rigorous validation. The attack aligns with CWE-94 Improper Control of Generation of Code and CWE-78 OS Command Injection in broader contexts, though here it manifests specifically through Python expression injection within a code generation toolchain.

The exploitation requires the victim to generate Pydantic models from untrusted Avro schemas using the affected library versions. Once triggered, the injected payload runs with the privileges of the user executing the script or service that imports the generated module. This can lead to complete system compromise, data exfiltration, or lateral movement within an environment where such schema processing occurs regularly as part of a data pipeline or API gateway infrastructure. The vulnerability highlights the risks inherent in dynamic code generation tools when input sanitization is overlooked during template rendering processes.

Version 0.70.6 addresses this security deficiency by implementing proper escaping mechanisms for documentation values before they are rendered into the generated Python code. This fix ensures that special characters, particularly quotation marks and other syntactic delimiters, are safely encoded so they remain within string literals rather than breaking out to execute as code. Organizations utilizing dataclasses-avroschema should immediately upgrade to version 0.70.6 or later to mitigate this risk. Additionally, defensive measures include validating the source of Avro schemas before processing them and implementing strict input validation on any metadata fields that are destined for dynamic code generation contexts. Monitoring execution environments for unexpected subprocess calls or network connections during model initialization can also aid in detecting potential exploitation attempts in legacy systems where patching is not immediately feasible.

Responsible

GitHub M

Reservation

10/09/2026

Disclosure

10/13/2026

Moderation

accepted

EPSS

0.00000

KEV

no

Activities

very low

Sources

Do you know our Splunk app?

Download it now for free!