Packages / ajv / Security

ModerateVulnerabilityGHSA-2g4f-4pwh-qvx6CVE-2025-69873Published 11 Feb 2026

ajv has ReDoS when using `$data` option

Affected releases · ajv

  • 8.x8.0.0 – 8.17.1Fixed in 8.18.0
  • 7.x7.0.0 – 7.2.4No fix on this line yet
  • 6.x6.0.0 – 6.12.6Fixed in 6.14.0
  • 5.x and older0.0.4 – 5.5.2No fix, no longer updated

On 8.x, the newest line:

npm install ajv@8.18.0
8.x
  1. Affected

    8.0.0 – 8.17.1

    31 releases

  2. Fixed

    8.18.0 – 8.20.0

    2 releases, latest

7.x
  1. Affected

    7.0.0 – 7.2.4

    12 releases

6.x
  1. Affected

    6.0.0 – 6.12.6

    34 releases

  2. Fixed

    6.14.0 – 6.15.0

    2 releases

5.x
  1. Affected

    5.0.0 – 5.5.2

    20 releases

4.x
  1. Affected

    4.0.0 – 4.11.8

    53 releases

3.x
  1. Affected

    3.0.0 – 3.8.10

    35 releases

2.x
  1. Affected

    2.0.0 – 2.5.0

    15 releases

1.x
  1. Affected

    1.0.0 – 1.4.10

    20 releases

0.x
  1. Affected

    0.0.4 – 0.7.2

    93 releases

317 stable releases of ajv, oldest to newest, one row per major.

Is your project affected?

Paste your package.json, or type the range you declare for ajv. It is read in your browser and sent nowhere.

What happens

ajv (Another JSON Schema Validator) through version 8.17.1 is vulnerable to Regular Expression Denial of Service (ReDoS) when the $data option is enabled. The pattern keyword accepts runtime data via JSON Pointer syntax ($data reference), which is passed directly to the JavaScript RegExp() constructor without validation. An attacker can inject a malicious regex pattern (e.g., \"^(a|a)*$\") combined with crafted input to cause catastrophic backtracking. A 31-character payload causes approximately 44 seconds of CPU blocking, with each additional character doubling execution time. This enables complete denial of service with a single HTTP request against any API using ajv with $data: true for dynamic schema validation.