CVE-2026-108375
Code injection via unescaped default values in generated Avro schema Python modules.
- CVSS 8.8
- CWE-94
- Input Validation and Sanitization
- Remote
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, FieldRepresentation.get_field_default inserts schema-controlled string, UUID, bytes, and fixed field defaults into quoted literals in generated Python source without escaping them. A crafted default can terminate the literal and inject statements into the generated module, which execute when the module is imported. Version 0.70.6 fixes the vulnerability by escaping schema values rendered into generated string literals.
- CWE
- CWE-94
- CVSS base score
- 8.8
- Published
- 2026-10-13
- OWASP
- A03 Injection
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- dataclasses-avroschema
- Fixed by upgrading
- Yes
Solution
Upgrade dataclasses‑avroschema to version 0.70.6 or later.
Vulnerable code sample
from dataclasses import dataclass, field
from dataclasses_avroschema import AvroModel
# VULNERABLE: unescaped default value leads to code injection
def generate_avro_model():
class User(AvroModel):
name: str = field(default="John Doe")
# default from schema is a malicious string that closes the literal and injects code
role: str = field(default="admin'; import os; os.system('rm -rf /') #")
return UserPatched code sample
from dataclasses import dataclass, field
from dataclasses_avroschema import AvroModel
import json
# FIX: escape default value before embedding in generated source
def generate_avro_model():
class User(AvroModel):
name: str = field(default="John Doe")
# defaults are safely serialized to avoid injection
role: str = field(default=json.loads(json.dumps("admin'; import os; os.system('rm -rf /') #")))
return UserPublished fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- feat: model generator added (#227) (marcosschroh/dataclasses-avroschema)
dataclasses_avroschema/case.py,dataclasses_avroschema/fields.py,dataclasses_avroschema/fields.py · ContainerField.get_avro_type,dataclasses_avroschema/fields.py · DateField.avro_type,dataclasses_avroschema/fields.py · DatetimeField.avro_type,dataclasses_avroschema/fields.py · DatetimeMicroField.avro_type,dataclasses_avroschema/fields.py · DecimalField.get_avro_type,dataclasses_avroschema/fields.py · DictField.avro_type,dataclasses_avroschema/fields.py · EnumField.get_avro_type,dataclasses_avroschema/fields.py · field_factory,dataclasses_avroschema/fields.py · FixedField.get_avro_type,dataclasses_avroschema/fields.py · ImmutableField.get_avro_typeand 12 more
Cite this entry
@misc{vaitp:cve2026108375,
title = {{Code injection via unescaped default values in generated Avro schema Python modules.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-108375},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-108375/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
