CVE-2026-108381: dataclasses-avroschema pydantic-class metadata allows code injection in generated annotations

Published Oct 13, 2026
·
Updated

dataclasses-avroschema generates Avro schemas from Python dataclasses, Pydantic models, and Faust Records and generates Python code from Avro schemas. From version 0.44.0 through 0.70.5, the Pydantic and AvroDantic model generators insert a schema field's pydantic-class value after pydantic. in a generated field annotation without safely restricting the expression. Because annotations are evaluated when the generated module is imported, a crafted value can execute arbitrary Python code. Version 0.70.6 fixes the vulnerability by restricting the value to a bare name or a call to a bare name with literal arguments.

Affected Software

1 affected component
pypi/dataclasses-avroschema>=0.44.0<=0.70.5

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade dataclasses-avroschema to a version that resolves this vulnerability.

    Fixed in 0.70.6

Event History

Oct 13, 2026
CVE Published
via MITRE·05:43 PM
Data Sourced
via MITRE·05:43 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are affected?

Deployments using dataclasses-avroschema versions 0.44.0 through 0.70.5 are affected when they generate Pydantic or AvroDantic models from an Avro schema containing a crafted pydantic-class field value.

2

What must an attacker control for exploitation?

An attacker needs to supply or influence an Avro schema whose field metadata includes a malicious pydantic-class value, and that schema must be used to generate Python code. The generated module must then be imported, because the field annotations are evaluated at import time.

3

What should be done if patching is not immediately possible?

Do not generate or import models from untrusted Avro schemas, and review schema inputs for pydantic-class metadata values. Restrict generation to schemas from trusted sources until an upgrade is possible.

4

How can I determine whether generated code may be affected?

Inspect generated Pydantic or AvroDantic model code for field annotations constructed from schema pydantic-class values after the pydantic. prefix. Generated modules from schemas with untrusted or unexpected values should be treated as potentially unsafe to import.

5

What version contains the fix?

Version 0.70.6 restricts pydantic-class values to a bare name or a call to a bare name with literal arguments.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203