---
id: "GHSA-r49w-vh47-r4hf"
page: "https://infrastack.ai/live/GHSA-r49w-vh47-r4hf"
kind: "vulnerability"
aliases: ["GHSA-r49w-vh47-r4hf"]
title: "Validation bypass of Pydantic V1 dataclasses allowing extra data"
severity: "medium"
cvss: 6.3
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "pydantic", "note": ">=1.10.0, <1.10.26", "fixed": ["1.10.27"], "affected": ">= 1.10.0, < 1.10.26", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["cwe-20", "package", "pydantic", "pydantic-v1", "python"]
not_affected_if: ["extra-forbid-or-ignore", "no-untrusted-input", "pydantic-v2-native-api"]
published_at: "2026-10-29T16:57:43+00:00"
first_seen_at: "2026-11-09T22:53:21+00:00"
updated_at: "2026-11-09T22:54:57+00:00"
sources: [{"source": "ghsa-repo", "url": "https://github.com/pydantic/pydantic/security/advisories/GHSA-r49w-vh47-r4hf", "first_seen_at": "2026-11-09T22:53:21+00:00"}]
exploit_sources: []
---

# Validation bypass of Pydantic V1 dataclasses allowing extra data

Link for people: https://infrastack.ai/live/GHSA-r49w-vh47-r4hf (this .md is for agents)

When a Pydantic V1 dataclass is configured to allow extra fields, passing a `__pydantic_initialised__` key makes Pydantic treat the instance as already validated. The field values are then not validated, so data can have a type different from the one declared.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:pydantic affected >= 1.10.0, < 1.10.26 fixed 1.10.27

## How to check

- Check the installed version with `pip show pydantic`; affected versions are `>= 1.10.0` and `< 1.10.26`.
- Search the code for dataclasses using `extra=Extra.allow` (or `Extra.allow` in a Config) that validate untrusted input.

## Fix

- Upgrade pydantic (V1 line) to `1.10.27`.
- If you use the `pydantic.v1` namespace under Pydantic V2, upgrade to `2.14.2` or later.

## Timeline

- 2026-11-09T22:53:21+00:00 ghsa-repo https://github.com/pydantic/pydantic/security/advisories/GHSA-r49w-vh47-r4hf

## Documents

- [advisory] Maintainer's advisory: github.com https://github.com/pydantic/pydantic/security/advisories/GHSA-r49w-vh47-r4hf

## From the sources

### Summary

When extra data is allowed, providing a `__pydantic_initialised__` 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`](https://github.com/pydantic/pydantic/blob/v1.10.26/pydantic/dataclasses.py#L295-L298)):

```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.__dataclass_fields__})
```

A `__pydantic_initialised__` keyword argument thus overrides the internal flag used to skip validation of already validated instances ([`pydantic/dataclasses.py`](https://github.com/pydantic/pydantic/blob/v1.10.26/pydantic/dataclasses.py#L430-L434)):

```python
def _dataclass_validate_values(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 __pydantic_initialised__ an invalid extra property
    if getattr(self, '__pydantic_initialised__'):
        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](https://github.com/pydantic/pydantic/releases/tag/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`).

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
