Man-in-the-Middle (MitM) Affecting https-proxy-agent package, versions <2.2.3


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept

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 SNYK-JS-HTTPSPROXYAGENT-469131
  • published 2 Oct 2019
  • disclosed 25 Sep 2019
  • credit Kris Adler

Introduced: 25 Sep 2019

CVE NOT AVAILABLE CWE-300 Open this link in a new tab

How to fix?

Upgrade https-proxy-agent to version 2.2.3 or higher.

Overview

https-proxy-agent is a module that provides an http.Agent implementation that connects to a specified HTTP or HTTPS proxy server, and can be used with the built-in https module.

Affected versions of this package are vulnerable to Man-in-the-Middle (MitM). When targeting a HTTP proxy, https-proxy-agent opens a socket to the proxy, and sends the proxy server a CONNECT request. If the proxy server responds with something other than a HTTP response 200, https-proxy-agent incorrectly returns the socket without any TLS upgrade. This request data may contain basic auth credentials or other secrets, is sent over an unencrypted connection. A suitably positioned attacker could steal these secrets and impersonate the client.

PoC by Kris Adler

var url = require('url');
var https = require('https');
var HttpsProxyAgent = require('https-proxy-agent');

var proxyOpts = url.parse('http://127.0.0.1:80&#39;); var opts = url.parse('https://www.google.com&#39;); var agent = new HttpsProxyAgent(proxyOpts); opts.agent = agent; opts.auth = 'username:password'; https.get(opts);

CVSS Scores

version 3.1
Expand this section

Snyk

6.1 medium
  • Attack Vector (AV)
    Adjacent
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Changed
  • Confidentiality (C)
    High
  • Integrity (I)
    None
  • Availability (A)
    None