CVE-2026-133422: Quadratic time unique_items list validation in Pydantic V1

Published Nov 20, 2026
·
Updated

Validating an untrusted list into a field constrained with uniqueitems=True with Pydantic V1 takes quadratic time: an input of a few hundred kilobytes takes seconds to validate.

The ConstrainedList.uniqueitemsvalidator validator (in pydantic/types.py) checks each item against all the following ones. For a list with no duplicates (the common, valid case), this results in a quadratic number of comparisons.

The issue was fixed in commit 6ec75e57f277a820ec583e601167f25fe8dc7c87. Users relying on the pydantic.v1 namespace in Pydantic V2 should upgrade to 2.14.2 or later.

Impact: denial of service through validation of untrusted input. Affected are applications validating untrusted lists into fields constrained with uniqueitems=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 maxitems constraint.

Pydantic V2 models are not affected.

Affected Software

1 affected component
pypi/pydantic

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch 6ec75e57f277a820ec583e601167f25fe8dc7c87
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 2.14.2
  3. Configuration

    Bound list size using the max_items constraint, since these item types are still checked in quadratic time.

    Pydantic V1 list fields containing models or dictionaries max_items

Event History

Nov 20, 2026
CVE Published
via MITRE·07:33 AM
Data Sourced
via MITRE·07:33 AM
DescriptionWeakness
Data Sourced
via OSV·07:33 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:18 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which applications are exposed to this denial-of-service condition?

Applications are affected when they validate untrusted lists using Pydantic V1 fields configured with unique_items=True, whether configured through conlist() or Field(). Pydantic V2 models are not affected, but use of the pydantic.v1 namespace in Pydantic V2 is within scope.

2

What does an attacker need to send to trigger the issue?

An attacker needs to submit a sufficiently large list with no duplicate items to an input path that performs affected validation. The no-duplicate case causes each item to be compared with following items, producing quadratic work; a few hundred kilobytes can take seconds to validate.

3

Are all unique_items lists fixed by upgrading?

No. The fix provides linear-time duplicate detection only for builtin scalar item types: int, float, str, bytes, bool, and None. Lists containing other types, such as models or dictionaries, can still be validated in quadratic time because their items may not be hashable.

4

What mitigation is available if affected validation cannot be changed immediately?

For unique-item lists containing non-scalar types, apply a max_items constraint to bound list size. This limits the amount of quadratic validation work for models, dictionaries, and other potentially unhashable item types.

5

What upgrade is identified for users of the Pydantic V1 compatibility namespace?

Users relying on the pydantic.v1 namespace in Pydantic V2 should upgrade to version 2.14.2 or later.

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