Vulnerabilities

5 via 37 paths

Dependencies

602

Source

GitHub

Commit

7828cb61

Find, fix and prevent vulnerabilities in your code.

Issue type
  • 5
  • 6
Severity
  • 1
  • 2
  • 7
  • 1
Status
  • 11
  • 0
  • 0

critical severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: elliptic
  • Introduced through: @solid/oidc-op@0.11.8 and @solid/oidc-auth-manager@0.24.5

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 @solid/oidc-op@0.11.8 jwk-to-pem@2.0.7 elliptic@6.6.1
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 @solid/oidc-auth-manager@0.24.5 @solid/oidc-op@0.11.8 jwk-to-pem@2.0.7 elliptic@6.6.1
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 @solid/oidc-auth-manager@0.24.5 @solid/oidc-rs@0.5.8 jwk-to-pem@2.0.7 elliptic@6.6.1

Overview

elliptic is a fast elliptic-curve cryptography implementation in plain javascript.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature due to an anomaly in the _truncateToN function. An attacker can cause legitimate transactions or communications to be incorrectly flagged as invalid by exploiting the signature verification process when the hash contains at least four leading 0 bytes, and the order of the elliptic curve's base point is smaller than the hash.

In some situations, a private key exposure is possible. This can happen when an attacker knows a faulty and the corresponding correct signature for the same message.

Note: Although the vector for exploitation of this vulnerability was restricted with the release of versions 6.6.0 and 6.6.1, it remains possible to generate invalid signatures in some cases in those releases as well.

PoC

var elliptic = require('elliptic'); // tested with version 6.5.7
var hash = require('hash.js');
var BN = require('bn.js');
var toArray = elliptic.utils.toArray;

var ec = new elliptic.ec('p192');
var msg = '343236343739373234';
var sig = '303502186f20676c0d04fc40ea55d5702f798355787363a91e97a7e50219009d1c8c171b2b02e7d791c204c17cea4cf556a2034288885b';
// Same public key just in different formats
var pk = '04cd35a0b18eeb8fcd87ff019780012828745f046e785deba28150de1be6cb4376523006beff30ff09b4049125ced29723';
var pkPem = '-----BEGIN PUBLIC KEY-----\nMEkwEwYHKoZIzj0CAQYIKoZIzj0DAQEDMgAEzTWgsY7rj82H/wGXgAEoKHRfBG54\nXeuigVDeG+bLQ3ZSMAa+/zD/CbQEkSXO0pcj\n-----END PUBLIC KEY-----\n';

// Create hash
var hashArray = hash.sha256().update(toArray(msg, 'hex')).digest();
// Convert array to string (just for showcase of the leading zeros)
var hashStr = Array.from(hashArray, function(byte) {
  return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join('');
var hMsg = new BN(hashArray, 'hex');
// Hashed message contains 4 leading zeros bytes
console.log('sha256 hash(str): ' + hashStr);
// Due to using BN bitLength lib it does not calculate the bit length correctly (should be 32 since it is a sha256 hash)
console.log('Byte len of sha256 hash: ' + hMsg.byteLength());
console.log('sha256 hash(BN): ' + hMsg.toString(16));

// Due to the shift of the message to be within the order of the curve the delta computation is invalid
var pubKey = ec.keyFromPublic(toArray(pk, 'hex'));
console.log('Valid signature: ' + pubKey.verify(hashStr, sig));

// You can check that this hash should validate by consolidating openssl
const fs = require('fs');
fs.writeFile('msg.bin', new BN(msg, 16).toBuffer(), (err) => {
  if (err) throw err;
});
fs.writeFile('sig.bin', new BN(sig, 16).toBuffer(), (err) => {
  if (err) throw err;
});
fs.writeFile('cert.pem', pkPem, (err) => {
  if (err) throw err;
});

// To verify the correctness of the message signature and key one can run:
// openssl dgst -sha256 -verify cert.pem -signature sig.bin msg.bin
// Or run this python script
/*
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec


msg = '343236343739373234'
sig = '303502186f20676c0d04fc40ea55d5702f798355787363a91e97a7e50219009d1c8c171b2b02e7d791c204c17cea4cf556a2034288885b'
pk = '04cd35a0b18eeb8fcd87ff019780012828745f046e785deba28150de1be6cb4376523006beff30ff09b4049125ced29723'

p192 = ec.SECP192R1()
pk = ec.EllipticCurvePublicKey.from_encoded_point(p192, bytes.fromhex(pk))
pk.verify(bytes.fromhex(sig), bytes.fromhex(msg), ec.ECDSA(hashes.SHA256()))
*/

Remediation

There is no fixed version for elliptic.

References

high severity

AGPL-3.0 license

  • Module: standard-error
  • Introduced through: @solid/oidc-auth-manager@0.24.5 and solid-auth-client@2.5.6

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 @solid/oidc-auth-manager@0.24.5 @solid/oidc-rp@0.11.10 standard-http-error@2.0.1 standard-error@1.1.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 solid-auth-client@2.5.6 @solid/oidc-rp@0.11.10 standard-http-error@2.0.1 standard-error@1.1.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 @solid/oidc-auth-manager@0.24.5 @solid/solid-multi-rp-client@0.6.6 @solid/oidc-rp@0.11.10 standard-http-error@2.0.1 standard-error@1.1.0

AGPL-3.0 license

high severity

AGPL-3.0 license

  • Module: standard-http-error
  • Introduced through: @solid/oidc-auth-manager@0.24.5 and solid-auth-client@2.5.6

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 @solid/oidc-auth-manager@0.24.5 @solid/oidc-rp@0.11.10 standard-http-error@2.0.1
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 solid-auth-client@2.5.6 @solid/oidc-rp@0.11.10 standard-http-error@2.0.1
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 @solid/oidc-auth-manager@0.24.5 @solid/solid-multi-rp-client@0.6.6 @solid/oidc-rp@0.11.10 standard-http-error@2.0.1

AGPL-3.0 license

medium severity

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: glob@7.2.3, express-handlebars@5.3.5 and others

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 glob@7.2.3 inflight@1.0.6
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 express-handlebars@5.3.5 glob@7.2.3 inflight@1.0.6
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 nyc@15.1.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 nyc@15.1.0 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 nyc@15.1.0 test-exclude@6.0.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 nyc@15.1.0 istanbul-lib-processinfo@2.0.3 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 nyc@15.1.0 spawn-wrap@2.0.0 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6

Overview

Affected versions of this package are vulnerable to Missing Release of Resource after Effective Lifetime via the makeres function due to improperly deleting keys from the reqs object after execution of callbacks. This behavior causes the keys to remain in the reqs object, which leads to resource exhaustion.

Exploiting this vulnerability results in crashing the node process or in the application crash.

Note: This library is not maintained, and currently, there is no fix for this issue. To overcome this vulnerability, several dependent packages have eliminated the use of this library.

To trigger the memory leak, an attacker would need to have the ability to execute or influence the asynchronous operations that use the inflight module within the application. This typically requires access to the internal workings of the server or application, which is not commonly exposed to remote users. Therefore, “Attack vector” is marked as “Local”.

PoC

const inflight = require('inflight');

function testInflight() {
  let i = 0;
  function scheduleNext() {
    let key = `key-${i++}`;
    const callback = () => {
    };
    for (let j = 0; j < 1000000; j++) {
      inflight(key, callback);
    }

    setImmediate(scheduleNext);
  }


  if (i % 100 === 0) {
    console.log(process.memoryUsage());
  }

  scheduleNext();
}

testInflight();

Remediation

There is no fixed version for inflight.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: serialize-javascript
  • Introduced through: mashlib@1.11.1

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 activitystreams-pane@0.7.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 chat-pane@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 folder-pane@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 activitystreams-pane@0.7.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 profile-pane@1.2.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 activitystreams-pane@0.7.1 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 chat-pane@2.5.1 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 contacts-pane@2.7.1 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 folder-pane@2.5.1 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 issue-pane@2.6.1 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 meeting-pane@2.5.1 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 profile-pane@1.2.1 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 source-pane@2.3.1 solid-ui@2.6.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 activitystreams-pane@0.7.1 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 chat-pane@2.5.1 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 contacts-pane@2.7.1 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 folder-pane@2.5.1 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 issue-pane@2.6.1 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 meeting-pane@2.5.1 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 profile-pane@1.2.1 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 mashlib@1.11.1 solid-panes@3.7.3 source-pane@2.3.1 solid-ui@2.6.1 pane-registry@2.5.1 solid-logic@3.1.1 @inrupt/solid-client-authn-browser@3.1.1 @inrupt/oidc-client-ext@3.1.1 @inrupt/oidc-client@1.11.6 serialize-javascript@4.0.0

Overview

serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to unsanitized URLs. An Attacker can introduce unsafe HTML characters through non-http URLs.

PoC

const serialize = require('serialize-javascript');

let x = serialize({
    x: new URL("x:</script>")
});

console.log(x)

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade serialize-javascript to version 6.0.2 or higher.

References

medium severity

Cross-site Scripting

  • Vulnerable module: bootstrap
  • Introduced through: bootstrap@3.4.1

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 bootstrap@3.4.1
    Remediation: Upgrade to bootstrap@4.0.0.

Overview

bootstrap is a popular front-end framework for faster and easier web development.

Affected versions of this package are vulnerable to Cross-site Scripting through the data-loading-text attribute in the button component. An attacker can execute arbitrary JavaScript code by injecting malicious scripts into this attribute.

Note:

This vulnerability is under active investigation and it may be updated with further details.

PoC

<input 
  id="firstName" 
  type="text" 
  value="<script>alert('XSS Input Success')</script><span>Loading XSS</span>"
/>
<button
  class="btn btn-primary input-test"
  data-loading-text="<span>I'm Loading</span>"
  type="button"
>
  Click Me
</button>

<script>
$(function () {
  $('.input-test').click(function () {
    var inputValue = $('#firstName').val();
    $(this).data('loadingText', inputValue);
    $(this).button('loading', inputValue);
  });
});
</script>

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade bootstrap to version 4.0.0 or higher.

References

medium severity

MPL-2.0 license

  • Module: express-accept-events
  • Introduced through: express-accept-events@0.3.0

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 express-accept-events@0.3.0

MPL-2.0 license

medium severity

MPL-2.0 license

  • Module: express-negotiate-events
  • Introduced through: express-negotiate-events@0.3.0

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 express-negotiate-events@0.3.0

MPL-2.0 license

medium severity

MPL-2.0 license

  • Module: express-prep
  • Introduced through: express-prep@0.6.4

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 express-prep@0.6.4

MPL-2.0 license

medium severity

MPL-2.0 license

  • Module: structured-field-utils
  • Introduced through: express-accept-events@0.3.0 and express-prep@0.6.4

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 express-accept-events@0.3.0 structured-field-utils@1.2.0-nested-sf.0
  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 express-prep@0.6.4 structured-field-utils@1.2.0-nested-sf.0

MPL-2.0 license

low severity

Cross-site Scripting (XSS)

  • Vulnerable module: bootstrap
  • Introduced through: bootstrap@3.4.1

Detailed paths

  • Introduced through: solid-server@solid/node-solid-server#7828cb617c1dc4e142b79bbf711dafb8f16bfa66 bootstrap@3.4.1
    Remediation: Upgrade to bootstrap@4.0.0.

Overview

bootstrap is a popular front-end framework for faster and easier web development.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the Tooltip and Popover components due to improper neutralization of input during web page generation. An attacker can manipulate the output of web pages by injecting malicious scripts into the title attribute.

Note:

The Bootstrap 3 version is End-of-Life and will not receive any updates to address this issue.

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade bootstrap to version 4.0.0 or higher.

References