Description
dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.40.0 through 0.70.5, ClassRepresentation.render_docstring copies a schema record's doc value into a generated triple-double-quoted class docstring without escaping quotes or backslashes. A crafted triple-quote sequence can close the docstring and inject statements into the generated class body, while a trailing backslash can escape the generated closing delimiter, allowing Python code execution during module import. Version 0.70.6 fixes the vulnerability by escaping quotes, backslashes, and unsafe control characters before rendering docstrings.
Published: 2026-10-13
Score: 8.8 High
EPSS: < 1% Very Low
KEV: No
Impact: Arbitrary code execution during module import
Action: Immediate Patch
AI Analysis

Impact

The flaw is in how the dataclasses‑avroschema library renders the documentation string of Avro schema records into a generated Python class docstring. The rendering routine copies the document value directly into a triple‑quoted string without escaping quote characters or backslashes. A malicious schema can include a closing triple‑quote sequence followed by Python statements, or a trailing backslash that prevents the generated closing delimiter from terminating the string. When the generated module is imported, the injected code is executed in the importing process’s context, giving the attacker arbitrary code execution. This is a classic instance of code injection via improper input escaping (CWE‑94).

Affected Systems

The Python library dataclasses‑avroschema, maintained by marcosschroh, is affected. All releases from 0.40.0 through 0.70.5 contain the issue. The vulnerability is remedied in version 0.70.6 and later.

Risk and Exploitability

The CVSS base score of 8.8 signals high severity. No EPSS score is available and the flaw is not listed in the CISA KEV catalog, indicating there is no public evidence of exploitation. Attackers must supply a crafted Avro schema that a trusted application processes to generate Python code. Once that generated module is imported, the embedded code runs with the authority of the importing process. Consequently, the vulnerability presents a local code‑execution risk, especially in environments that accept untrusted schemas or import generated modules without additional validation.

Generated by OpenCVE AI on October 13, 2026 at 20:20 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade dataclasses‑avroschema to version 0.70.6 or later to activate the escape routine that sanitizes documentation strings.
  • If an upgrade cannot be performed immediately, filter or sanitize the "doc" attribute of every Avro record before passing it to the code generator—specifically escape triple‑quote sequences, backslashes, and control characters. This prevents the injected code from being interpreted as part of the docstring.
  • Limit the execution of generated modules to a strictly trusted environment; where feasible, run the import in a sandbox or isolated process to contain potential code execution.

Generated by OpenCVE AI on October 13, 2026 at 20:20 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 21 Oct 2026 20:45:00 +0000

Type Values Removed Values Added
First Time appeared Marcosschroh
Marcosschroh dataclasses-avroschema
Vendors & Products Marcosschroh
Marcosschroh dataclasses-avroschema

Wed, 14 Oct 2026 17:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Tue, 13 Oct 2026 18:00:00 +0000

Type Values Removed Values Added
Description dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.40.0 through 0.70.5, ClassRepresentation.render_docstring copies a schema record's doc value into a generated triple-double-quoted class docstring without escaping quotes or backslashes. A crafted triple-quote sequence can close the docstring and inject statements into the generated class body, while a trailing backslash can escape the generated closing delimiter, allowing Python code execution during module import. Version 0.70.6 fixes the vulnerability by escaping quotes, backslashes, and unsafe control characters before rendering docstrings.
Title dataclasses-avroschema record documentation can terminate generated class docstrings
Weaknesses CWE-94
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}


Subscriptions

Marcosschroh Dataclasses-avroschema
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-10-14T15:55:41.448Z

Reserved: 2026-10-09T21:36:27.043Z

Link: CVE-2026-108378

cve-icon Vulnrichment

Updated: 2026-10-14T15:55:33.710Z

cve-icon NVD

Status : Awaiting Analysis

Published: 2026-10-13T18:17:16.857

Modified: 2026-10-16T16:00:33.533

Link: CVE-2026-108378

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-21T20:25:10Z

Weaknesses
  • CWE-94

    Improper Control of Generation of Code ('Code Injection')