Access Restriction Bypass Affecting xmlhttprequest-ssl package, versions <1.6.1

  • Exploit Maturity

    Proof of concept

  • Attack Complexity


Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • snyk-id


  • published

    26 Apr 2021

  • disclosed

    21 Apr 2021

  • credit

    Wes Garland

How to fix?

Upgrade xmlhttprequest-ssl to version 1.6.1 or higher.


xmlhttprequest-ssl is a fork of xmlhttprequest.

Affected versions of this package are vulnerable to Access Restriction Bypass. The package disables SSL certificate validation by default, because rejectUnauthorized (when the property exists but is undefined) is considered to be false within the https.request function of Node.js. In other words, no certificate is ever rejected.


const XMLHttpRequest = require('xmlhttprequest-ssl');

var xhr = new XMLHttpRequest();        /* pass empty object in version 1.5.4 to work around bug */"GET", "");
xhr.addEventListener('readystatechange', () => console.log('ready state:', xhr.status));
xhr.addEventListener('loadend', loadend);

function loadend()
  console.log('loadend:', xhr);
  if (xhr.status === 0 && xhr.statusText.code === 'DEPTH_ZERO_SELF_SIGNED_CERT')
    console.log('test passed: self-signed cert rejected');
    console.log('*** test failed: self-signed cert used to retrieve content');