CVE-2020-7787: React adal Improper Authentication Vulnerability

HIGH
Advisory Identifier: GHSA-7mpx-vg3c-cmr4
CVSS 8.2
CWE-287
Published
Advisory Summary

CVE-2020-7787 is a HIGH (CVSS 8.2) improper authentication vulnerability (CWE-287: Improper Authentication) affecting React adal libraries in the npm ecosystem. The issue involves improper authentication in react-adal. Remediation is available by upgrading affected packages to version 0.5.1.

CVE-2020-7787 at a Glance

CVE Identifier CVE-2020-7787
GHSA Identifier GHSA-7mpx-vg3c-cmr4
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-287: Improper Authentication
Affected Product React adal
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

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

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

How to Fix CVE-2020-7787

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

react-adal fixed: 0.5.1
npm install react-adal@0.5.1
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 react-adal

How to Check if You Are Affected

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

npm ls react-adal

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

Note: The npm ls react-adal 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-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In React adal, 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 react-adal < 0.5.1. It is possible for a specially crafted JWT token and request URL can cause the nonce, session and refresh values to be incorrectly validated, causing the application to treat an attacker-generated JWT token as authentic. The logical defect is caused by how the nonce, session and refresh values are stored in the browser local storage or session storage. Each key is automatically appended by ||. When the received nonce and session keys are generated, the list of values is stored in the browser storage, separated by ||, with || always appended to the end of the list. Since || will always be the last 2 characters of the stored values, an empty string ("") will always be in the list of the valid values. Therefore, if an empty session parameter is provided in the callback URL, and a specially-crafted JWT token contains an nonce value of "" (empty string), then adal.js will consider the JWT token as authentic.

CVE-2020-7787 Affected React adal Versions

1 component(s)
Fixed Versions:
0.5.1
Product / Package Ecosystem Affected Versions Fixed Version
react-adal
npm
< 0.5.1
0.5.1

References

Frequently Asked Questions

What is CVE-2020-7787?
CVE-2020-7787 is a security vulnerability in React adal involving Improper Authentication in react-adal under CWE-287: Improper Authentication.
Which React adal versions are affected?
Affected versions include releases prior to 0.5.1 across affected packages: react-adal.
What version fixes CVE-2020-7787?
Upgrading to 0.5.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is react-adal affected?
Yes, react-adal is affected in releases prior to 0.5.1. Upgrade your dependency to 0.5.1 or later.
What is the CVSS score of CVE-2020-7787?
CVE-2020-7787 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2020-7787?
CVE-2020-7787 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check npm dependencies for CVE-2020-7787?
Run the dependency tree command: 'npm ls react-adal'. 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-7mpx-vg3c-cmr4",
  "modified" : "2021-04-09T19:38:58Z",
  "published" : "2021-04-13T15:22:37Z",
  "aliases" : [ "CVE-2020-7787" ],
  "summary" : "Improper Authentication in react-adal",
  "details" : "This affects versions of react-adal < 0.5.1. It is possible for a specially crafted JWT token and request URL can cause the nonce, session and refresh values to be incorrectly validated, causing the application to treat an attacker-generated JWT token as authentic. The logical defect is caused by how the nonce, session and refresh values are stored in the browser local storage or session storage. Each key is automatically appended by ||. When the received nonce and session keys are generated, the list of values is stored in the browser storage, separated by ||, with || always appended to the end of the list. Since || will always be the last 2 characters of the stored values, an empty string (\"\") will always be in the list of the valid values. Therefore, if an empty session parameter is provided in the callback URL, and a specially-crafted JWT token contains an nonce value of \"\" (empty string), then adal.js will consider the JWT token as authentic.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "react-adal"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.5.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7787"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/salvoravida/react-adal/pull/115"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/salvoravida/react-adal/commit/74158dba1647b12fe96fa401e306a6287fe9e2a9"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-REACTADAL-1018907"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-09T19:38:58Z",
    "nvd_published_at" : "2020-12-09T17:15:00Z"
  }
}