CVE-2026-133276: Validation bypass of Pydantic V1 dataclasses allowing extra data
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).
Other sources
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.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pydanticto a version that resolves this vulnerability.Fixed in 1.10.27 - Upgrade
Upgrade
pydanticto a version that resolves this vulnerability.Fixed in 2.14.2