# GHSA-49G6-96JJ-F7R9: Quadratic time unique\_items list validation in Pydantic V1

- Database: GitHub
- Severity: CVSS 6.9 (Medium)
- Published: 2026-10-29
- Modified: 2026-11-19

## Tracked as

- [CVE-2026-133422](https://cve.now/CVE-2026-133422.md): Pydantic denial of service in unique\_items list validation

## Affected versions

- pydantic (PyPI): from 1.9.0, through 1.10.26

## Description

### Summary

Validating an untrusted list into a field constrained with `unique_items=True` with Pydantic V1 takes quadratic time: an input of a few hundred kilobytes takes seconds to validate.

### Details

The [`ConstrainedList.unique_items_validator`](https://github.com/pydantic/pydantic/blob/v1.10.26/pydantic/types.py#L612-L620) validator (in [`pydantic/types.py`](https://github.com/pydantic/pydantic/blob/v1.10.26/pydantic/types.py)) checks each item against all the following ones:

```python
@classmethod
def unique_items_validator(cls, v: 'Optional[List[T]]') -> 'Optional[List[T]]':
    if v is None:
        return None

    for i, value in enumerate(v, start=1):
        if value in v[i:]:
            raise errors.ListUniqueItemsError()

    return v
```

For a list with no duplicates (the common, valid case), this results in a quadratic number of comparisons.

The issue was fixed in commit https://github.com/pydantic/pydantic/commit/6ec75e57f277a820ec583e601167f25fe8dc7c87.

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

Denial of service through validation of untrusted input. Affected are applications validating untrusted lists into fields constrained with `unique_items=True` (using `conlist()` or `Field()`).

The fix only applies to lists of builtin scalar types (`int`, `float`, `str`, `bytes`, `bool` and `None`), for which duplicates can be detected in linear time. Lists of other types (e.g. models or dictionaries) are still checked in quadratic time, as their items aren't guaranteed to be hashable: bound their size using the `max_items` constraint.

Pydantic V2 models are not affected.

## References

- https://github.com/pydantic/pydantic/security/advisories/GHSA-49g6-96jj-f7r9

Page: https://cve.now/GHSA-49G6-96JJ-F7R9
