CVE-2021-23820: Json pointer Prototype Pollution Vulnerability

MODERATE
Advisory Identifier: GHSA-v5vg-g7rq-363w
CVSS 5.6
CWE-1321 CWE-843
Published
Advisory Summary

CVE-2021-23820 is a MODERATE (CVSS 5.6) prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Json pointer libraries in the npm ecosystem. The issue involves prototype pollution in json-pointer. Remediation is available by upgrading affected packages to version 0.6.2.

CVE-2021-23820 at a Glance

CVE Identifier CVE-2021-23820
GHSA Identifier GHSA-v5vg-g7rq-363w
Severity MODERATE
CVSS v3.1 Base Score 5.6
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Json pointer
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2021-23820

To remediate this vulnerability, upgrade all affected Json pointer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

json-pointer fixed: 0.6.2
npm install json-pointer@0.6.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls json-pointer

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-23820, inspect your project dependencies using npm:

npm ls json-pointer

Analyze the terminal output to locate any version of Json pointer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.6.2), your application is affected.

Note: The npm ls json-pointer command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Json pointer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

This affects versions of package `json-pointer` up to and including `0.6.1`. A type confusion vulnerability can lead to a bypass of CVE-2020-7709 when the pointer components are arrays.

CVE-2021-23820 Affected Json pointer Versions

1 component(s)
Fixed Versions:
0.6.2
Product / Package Ecosystem Affected Versions Fixed Version
json-pointer
npm
< 0.6.2
0.6.2

References

Frequently Asked Questions

What is CVE-2021-23820?
CVE-2021-23820 is a security vulnerability in Json pointer involving Prototype Pollution in json-pointer under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Json pointer versions are affected?
Affected versions include releases prior to 0.6.2 across affected packages: json-pointer.
What version fixes CVE-2021-23820?
Upgrading to 0.6.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is json-pointer affected?
Yes, json-pointer is affected in releases prior to 0.6.2. Upgrade your dependency to 0.6.2 or later.
What is the CVSS score of CVE-2021-23820?
CVE-2021-23820 has a CVSS v3.1 base score of 5.6 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2021-23820?
CVE-2021-23820 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2021-23820?
Run the dependency tree command: 'npm ls json-pointer'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v5vg-g7rq-363w",
  "modified" : "2022-07-15T20:23:13Z",
  "published" : "2021-11-08T17:40:49Z",
  "aliases" : [ "CVE-2021-23820" ],
  "summary" : "Prototype Pollution in json-pointer",
  "details" : "This affects versions of package `json-pointer` up to and including `0.6.1`. A type confusion vulnerability can lead to a bypass of CVE-2020-7709 when the pointer components are arrays.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "json-pointer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.6.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.6.1"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23820"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/manuelstofer/json-pointer/pull/36"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/manuelstofer/json-pointer/commit/931b0f9c7178ca09778087b4b0ac7e4f505620c2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/manuelstofer/json-pointer"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/manuelstofer/json-pointer/blob/master/index.js%23L78"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-JSONPOINTER-1577287"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321", "CWE-843" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-11-04T16:55:47Z",
    "nvd_published_at" : "2021-11-03T18:15:00Z"
  }
}