PortGate

Advisories · Node.js & Next.js

CVE-2021-3918 Critical CVSS 9.8

json-schema prototype pollution

Disclosed 2021 · Last reviewed 2 Dec 2026

A schema could set Object.prototype while it was being compiled.

What happened

The compiler assigned keys from the schema onto objects without a prototype check.

Affected and patched versions

Affected
The json-schema package before 0.4.0.
Patched
json-schema 0.4.0. Prefer Ajv or another maintained validator for new code.

How to check your server

Check

npm ls json-schema

How to fix and harden

  1. Upgrade or replace the package.
  2. This library is lightly maintained. New code should use a maintained JSON schema validator.

Fix

npm ls json-schema

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON