Prototype Pollution Vulnerability in Ajv (node-ajv) - CVE-2020-15366

node-ajv Updated 02 Oct 2025

Summary

15/07/2020
N/A
Yes i
Medium
5.6

CVE-2020-15366: An issue was discovered in ajv.validate() in Ajv (aka Another JSON Schema Validator) 6.12.2. Affects node-ajv across 2 version ranges.

< 6.12.4-1 < 521c3a53f15f5502fb4a734194932535d311267c

Fixed in 6.12.4-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Ajv (Another JSON Schema Validator) is a widely used library for validating JSON objects against JSON Schema specifications. It is known for its speed and flexibility, allowing developers to ensure that their JSON data adheres to defined structures. However, certain versions of Ajv are vulnerable to a prototype pollution attack, which can lead to severe security implications.

Vulnerability Detail

The vulnerability identified as CVE-2020-15366 affects Ajv versions up to 6.12.2. It arises from the improper handling of JSON schemas, allowing an attacker to craft a malicious schema that can manipulate the prototype of JavaScript objects. This can lead to arbitrary code execution, which is a critical security risk. The worst-case scenario should ideally result in a denial of service, but due to this flaw, it can escalate to code execution, compromising the integrity of the application.

How To Fix

Minimum fixed version

6.12.4-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-ajv

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not feasible, consider validating JSON schemas only from trusted sources. Avoid using untrusted schemas in your application to mitigate the risk of prototype pollution. Additionally, you can implement input validation to sanitize incoming schemas before processing them.

Conclusion

The CVE-2020-15366 vulnerability in Ajv poses a significant risk due to its potential for prototype pollution and arbitrary code execution. It is crucial for developers using Ajv to upgrade to the latest version to mitigate these risks. Additionally, employing best practices for schema validation can further enhance security.

See every vulnerability recorded for node-ajv →

Share this vulnerability

FAQ

Prototype pollution is a security vulnerability that allows an attacker to modify the prototype of built-in JavaScript objects, potentially leading to arbitrary code execution or application instability.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.

The potential impacts include unauthorized code execution, data corruption, and denial of service, which can severely compromise the security and functionality of your application.

No, using Ajv versions prior to 6.12.4-1 is not safe due to the identified prototype pollution vulnerability. It is recommended to upgrade to the fixed version.

The CVSS score for this vulnerability is 5.6, indicating a moderate severity level that requires attention.

Related vulnerabilities

Recent vulnerabilities recorded for node-ajv.

How To Fix

Minimum fixed version

6.12.4-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-ajv

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback