Skip to content

Reflected XSS when using flashMessages or languageDictionary

High severity GitHub Reviewed Published Jun 4, 2021 in auth0/lock • Updated Feb 1, 2023

Package

npm auth0-lock (npm)

Affected versions

< 11.30.1

Patched versions

11.30.1

Description

Overview

Versions before and including 11.30.0 are vulnerable to reflected XSS. An attacker can execute arbitrary code when the library's

  • flashMessage feature is utilized and user input or data from URL parameters is incorporated into the flashMessage.
  • languageDictionary feature is utilized and user input or data from URL parameters is incorporated into the languageDictionary.

Am I affected?

You are affected by this vulnerability if you are using auth0-lock version 11.30.0 or lower and all of the following conditions apply:

  • You are utilizing flashMessage feature.
  • User input or data from URL parameters is incorporated into the flashMessage.

An example of a vulnerable snippet where query parameters are used to populate the text property of a flashMessage.

var params = new URLSearchParams(location.search);
var errorMessage = params.get('error__message');
var showParams = {};

if (!!errorMessage === true) {
  showParams.flashMessage = {
    type: 'error',
    text: 'We were unable to log you in. ' + errorMessage,
  };
}

lock.show(showParams);

OR

  • You are utilizing languageDictionary feature.
  • User input or data from URL parameters is used in languageDictionary properties.

An example of a vulnerable snippet where query parameters are used to populate the socialLoginInstructions property of a languageDictionary.

var params = new URLSearchParams(location.search);
var instruction = params.get('instruction');

var options = {
  languageDictionary: {
    emailInputPlaceholder: "something@youremail.com",
    title: "title",
    socialLoginInstructions: instruction
  },
};

var lock = new Auth0LockPasswordless(
    CLIENT_ID,
    DOMAIN,
    options
);

lock.show()

How to fix that?

Upgrade to version 11.30.1.

Will this update impact my users?

The fix uses DOMPurify to sanitise the flashMessage and languageDictionary inputs. If you are including inline JavaScript in these fields, like script tags or onclick attributes, these will be removed.

References

@lzychowski lzychowski published to auth0/lock Jun 4, 2021
Reviewed Jun 4, 2021
Published to the GitHub Advisory Database Jun 4, 2021
Published by the National Vulnerability Database Jun 4, 2021
Last updated Feb 1, 2023

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

EPSS score

0.116%
(47th percentile)

Weaknesses

CVE ID

CVE-2021-32641

GHSA ID

GHSA-jr3j-whm4-9wwm

Source code

No known source code
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.