CVE-2026-108382: dataclasses-avroschema allows code injection through generated enum-symbol string literals
dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.38.0 through 0.70.5, EnumRepresentation.rendersymbols concatenates each schema-controlled enum symbol between double quotes in a generated enum assignment. When generator classes are used directly, a quote can terminate the string literal and inject arbitrary Python code into the enum class body, which executes when the generated module is imported. Version 0.70.6 fixes the vulnerability by escaping enum symbol values before rendering them.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
dataclasses-avroschemato a version that resolves this vulnerability.Fixed in 0.70.6
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications using dataclasses-avroschema versions 0.38.0 through 0.70.5 are exposed when they directly use its generator classes to generate Python code from Avro schemas containing attacker-controlled enum symbols, and then import the generated module.
What must an attacker control for exploitation?
An attacker needs control over an enum symbol in an Avro schema processed by the generator. A double quote in that symbol can terminate the generated Python string literal and inject code into the generated enum class body.
When does the injected code execute?
The injected Python code executes when the generated module is imported. Generating the code alone is not described as the execution point.
What version fixes the issue?
Version 0.70.6 fixes the vulnerability by escaping enum symbol values before they are rendered.