/

CVE-2026-108375

Severity:

HIGH RISK

(8.8)

Code Injection (CWE-94) in Python Avro Code Generator

CVE-2026-108375

Awaiting Analysis

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

dataclasses-avroschema embeds schema-controlled default values into generated Python source without escaping them. A crafted default may break out of a string literal and inject statements that execute when the generated module is imported.

dataclasses-avroschema embeds schema-controlled default values into generated Python source without escaping them. A crafted default may break out of a string literal and inject statements that execute when the generated module is imported.

Affected context

The vulnerability affects workflows that generate Python code from Avro schemas and render string, UUID, bytes, or fixed-field defaults into Python string literals. Risk exists when an attacker can influence the schema or its default values and the resulting module is later imported or executed.

The vulnerability affects workflows that generate Python code from Avro schemas and render string, UUID, bytes, or fixed-field defaults into Python string literals. Risk exists when an attacker can influence the schema or its default values and the resulting module is later imported or executed.

Exploit preconditions

  • Attack surface: Avro-to-Python source generation
  • Required access: Ability to provide or modify an Avro schema or a field default
  • Trigger point: Import or execution of the generated Python module
  • Why exploitation is possible: Schema-controlled values are inserted into

Python source without sufficient escaping, allowing generated syntax to

contain unintended statements

  • Attack surface: Avro-to-Python source generation
  • Required access: Ability to provide or modify an Avro schema or a field default
  • Trigger point: Import or execution of the generated Python module
  • Why exploitation is possible: Schema-controlled values are inserted into

Python source without sufficient escaping, allowing generated syntax to

contain unintended statements

Why this happens

The underlying flaw is improper neutralization of schema data when it is rendered into generated Python source. Field defaults are placed inside quoted literals without escaping characters that can terminate those literals or alter the surrounding syntax. This maps to CWE-94, because untrusted or insufficiently constrained data becomes executable code during source generation and subsequent module import.

The underlying flaw is improper neutralization of schema data when it is rendered into generated Python source. Field defaults are placed inside quoted literals without escaping characters that can terminate those literals or alter the surrounding syntax. This maps to CWE-94, because untrusted or insufficiently constrained data becomes executable code during source generation and subsequent module import.

Potential impact

  • An attacker may execute arbitrary Python statements in the importing process
  • The application environment could be compromised
  • Credentials, configuration, or data accessible to the process could be exposed
  • Generated artifacts could be altered to support persistence or supply-chain abuse
  • An attacker may execute arbitrary Python statements in the importing process
  • The application environment could be compromised
  • Credentials, configuration, or data accessible to the process could be exposed
  • Generated artifacts could be altered to support persistence or supply-chain abuse

General mitigation guidance

Mitigation generally focuses on treating schema content as untrusted data

throughout code-generation workflows.

Common defensive patterns include:

  • Escaping generated string literals with language-aware serialization routines
  • Prefering structured runtime data or safe serializers over handwritten source interpolation
  • Validating schema defaults against strict type and format constraints before generation
  • Separating generated artifacts from trusted application code and reviewing them before import
  • Restricting the privileges, filesystem access, and secrets available to processes that import generated modules
  • Preventing untrusted parties from modifying schemas or publishing generated artifacts

Mitigation generally focuses on treating schema content as untrusted data

throughout code-generation workflows.

Common defensive patterns include:

  • Escaping generated string literals with language-aware serialization routines
  • Prefering structured runtime data or safe serializers over handwritten source interpolation
  • Validating schema defaults against strict type and format constraints before generation
  • Separating generated artifacts from trusted application code and reviewing them before import
  • Restricting the privileges, filesystem access, and secrets available to processes that import generated modules
  • Preventing untrusted parties from modifying schemas or publishing generated artifacts

How teams detect issues like this

Detection approaches may include:

  • Static analysis rules for string interpolation or concatenation into generated source
  • Code review checks for schema values inserted into quoted Python literals
  • Tests using boundary characters and representative defaults to verify correct escaping
  • Artifact scanning and policy enforcement before generated modules are imported or distributed
  • Monitoring unexpected imports, process execution, or changes to generated code

Automated code review and software composition analysis tools may help identify

unsafe code-generation patterns and affected dependency usage.

Detection approaches may include:

  • Static analysis rules for string interpolation or concatenation into generated source
  • Code review checks for schema values inserted into quoted Python literals
  • Tests using boundary characters and representative defaults to verify correct escaping
  • Artifact scanning and policy enforcement before generated modules are imported or distributed
  • Monitoring unexpected imports, process execution, or changes to generated code

Automated code review and software composition analysis tools may help identify

unsafe code-generation patterns and affected dependency usage.

Sources

SourceLink
github.comgithub.com/marcosschroh/dataclasses-avroschema/commit/01e6d5e15ab0ff69faac39a340d21b85da1e852f
github.comgithub.com/marcosschroh/dataclasses-avroschema/releases/tag/0.70.6
github.comgithub.com/marcosschroh/dataclasses-avroschema/security/advisories/GHSA-9h8h-264x-jcg2

Frequently asked

questions

It can be exploitable through a remote or indirect workflow when an attacker can

influence schemas or defaults that a service processes and the generated module

is subsequently imported. Otherwise, it generally requires local or pipeline

access to the schema-generation process.

The key requirement is the ability to provide or modify an Avro schema or a

relevant field default. The attacker also needs the generated Python artifact

to reach an importing or executing process.

Treat schema values as data, use language-aware escaping or serialization for

generated literals, and validate defaults before source generation. Avoid

constructing executable source through unescaped string interpolation.

Apply secure code-generation policies, review generated artifacts, restrict

schema modification rights, test escaping boundaries, and run import processes

with least privilege.

It can be exploitable through a remote or indirect workflow when an attacker can

influence schemas or defaults that a service processes and the generated module

is subsequently imported. Otherwise, it generally requires local or pipeline

access to the schema-generation process.

The key requirement is the ability to provide or modify an Avro schema or a

relevant field default. The attacker also needs the generated Python artifact

to reach an importing or executing process.

Treat schema values as data, use language-aware escaping or serialization for

generated literals, and validate defaults before source generation. Avoid

constructing executable source through unescaped string interpolation.

Apply secure code-generation policies, review generated artifacts, restrict

schema modification rights, test escaping boundaries, and run import processes

with least privilege.

Find out what's already
exploitable in your codebase.