Where
-Infinity
0
Severity
6.3
Input Validation
AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Summary

When extra data is allowed, providing a pydanticinitialised key when validating a Pydantic V1 dataclass makes it considered as already validated, resulting in field values not being validated.

Details

When extra data is allowed, the init() method of Pydantic V1 dataclasses stores all the provided keyword arguments in the instance dict before validation (pydantic/dataclasses.py):

python elif config.extra == Extra.allow: for k, v in kwargs.items(): self.dict.setdefault(k, v) init(self, args, {k: v for k, v in kwargs.items() if k in self.dataclassfields})

A pydanticinitialised keyword argument thus overrides the internal flag used to skip validation of already validated instances (pydantic/dataclasses.py):

python def dataclassvalidatevalues(self: 'Dataclass') -> None: # validation errors can occur if this function is called twice on an already initialised dataclass. # for example if Extra.forbid is enabled, it would consider pydanticinitialised an invalid extra property if getattr(self, 'pydanticinitialised'): return

The issue was fixed in commit https://github.com/pydantic/pydantic/commit/b26913fe6, published in V1.10.27.

If you are relying on the pydantic.v1 namespace in Pydantic V2, upgrade to V2.14.2 or later.

Impact

Validation bypass: data returned by validation doesn't match the declared type. Affected are applications validating untrusted data into Pydantic V1 dataclasses allowing extra data (with extra=Extra.allow).

1 / 2
Source: MITRE
First published (updated )
Severity
6.3
Input Validation
AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N

When extra data is allowed (extra=Extra.allow), providing a pydanticinitialised key when validating a Pydantic V1 dataclass makes it considered as already validated, resulting in field values not being validated. The init() method of Pydantic V1 dataclasses stores all the provided keyword arguments in the instance dict before validation, so a pydanticinitialised keyword argument overrides the internal flag used to skip validation of already validated instances. As a result, data returned by validation doesn't match the declared type. Affected are applications validating untrusted data into Pydantic V1 dataclasses allowing extra data. The issue was fixed in Pydantic 1.10.27. Users relying on the pydantic.v1 namespace in Pydantic V2 should upgrade to 2.14.2 or later.

First published (updated )

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