TCP "XMas" Port Scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/portscan/xmas metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: TCP "XMas" Port Scanner
Module: auxiliary/scanner/portscan/xmas
Source code: modules/auxiliary/scanner/portscan/xmas.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): -
List of CVEs: -
Enumerate open|filtered TCP services using a raw "XMas" scan; this sends probes containing the FIN, PSH and URG flags.
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
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/portscan/xmas
msf auxiliary(xmas) > show options
... show and set options ...
msf auxiliary(xmas) > set RHOSTS ip-range
msf auxiliary(xmas) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(xmas) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(xmas) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(xmas) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Description
This module is used to determine if the ports on target machine are closed. It sends probes containing the FIN, PSH and URG flags. Scan is faster and stealthier compared to some other scans. Following action are performed depending on the state of ports -
OPEN|FILTERED Port:
Detects open|filtered port via no response to the segment
Closed Port:
Detects a closed port via a RST received in response to the FIN
Required Permissions
XMAS scan requires the use of raw sockets, and thus cannot be performed from some Windows systems (Windows XP SP 2, for example). On Unix and Linux, raw socket manipulations require root privileges.
Options
PORTS
This is the list of TCP ports to test on each host.
Formats like 1-3
, 1,2,3
, 1,2-3
, etc. are all supported. Default
options is to scan 1-10000
ports.
Timeout
This options states the reply read timeout in milliseconds. Default value if 500
.
RHOSTS
The target address range is defined in this option.
VERBOSE
Gives detailed message about the scan of all the ports. It also shows the ports that were not open/filtered.
Verification Steps
- Do:
use auxiliary/scanner/portscan/xmas
- Do:
set RHOSTS [IP]
- Do:
set PORTS [PORTS]
- Do:
run
- The open/filtered ports will be discovered, status will be printed indicating as such.
Scenarios
Metaspliotable 2
msf > use auxiliary/scanner/portscan/xmas
msf auxiliary(xmas) > set rhosts 192.168.45.159
rhosts => 192.168.45.159
msf auxiliary(xmas) > set ports 1-100
ports => 1-100
msf auxiliary(xmas) > run
[*] TCP OPEN|FILTERED 192.168.45.159:1
[*] TCP OPEN|FILTERED 192.168.45.159:3
[*] TCP OPEN|FILTERED 192.168.45.159:5
[*] TCP OPEN|FILTERED 192.168.45.159:8
[*] TCP OPEN|FILTERED 192.168.45.159:12
[*] TCP OPEN|FILTERED 192.168.45.159:14
[*] TCP OPEN|FILTERED 192.168.45.159:16
[*] TCP OPEN|FILTERED 192.168.45.159:19
[*] TCP OPEN|FILTERED 192.168.45.159:21
[*] TCP OPEN|FILTERED 192.168.45.159:37
[*] TCP OPEN|FILTERED 192.168.45.159:39
[*] TCP OPEN|FILTERED 192.168.45.159:41
[*] TCP OPEN|FILTERED 192.168.45.159:43
[*] TCP OPEN|FILTERED 192.168.45.159:49
[*] TCP OPEN|FILTERED 192.168.45.159:52
[*] TCP OPEN|FILTERED 192.168.45.159:53
[*] TCP OPEN|FILTERED 192.168.45.159:55
[*] TCP OPEN|FILTERED 192.168.45.159:57
[*] TCP OPEN|FILTERED 192.168.45.159:59
[*] TCP OPEN|FILTERED 192.168.45.159:61
[*] TCP OPEN|FILTERED 192.168.45.159:63
[*] TCP OPEN|FILTERED 192.168.45.159:65
[*] TCP OPEN|FILTERED 192.168.45.159:67
[*] TCP OPEN|FILTERED 192.168.45.159:69
[*] TCP OPEN|FILTERED 192.168.45.159:73
[*] TCP OPEN|FILTERED 192.168.45.159:89
[*] TCP OPEN|FILTERED 192.168.45.159:91
[*] TCP OPEN|FILTERED 192.168.45.159:93
[*] TCP OPEN|FILTERED 192.168.45.159:95
[*] TCP OPEN|FILTERED 192.168.45.159:97
[*] TCP OPEN|FILTERED 192.168.45.159:99
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Go back to menu.
Msfconsole Usage
Here is how the scanner/portscan/xmas auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/portscan/xmas
msf6 auxiliary(scanner/portscan/xmas) > show info
Name: TCP "XMas" Port Scanner
Module: auxiliary/scanner/portscan/xmas
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
kris katterjohn <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
BATCHSIZE 256 yes The number of hosts to scan per set
DELAY 0 yes The delay between connections, per thread, in milliseconds
INTERFACE no The name of the interface
JITTER 0 yes The delay jitter factor (maximum value by which to +/- DELAY) in milliseconds.
PORTS 1-10000 yes Ports to scan (e.g. 22-25,80,110-900)
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
SNAPLEN 65535 yes The number of bytes to capture
THREADS 1 yes The number of concurrent threads (max one per host)
TIMEOUT 500 yes The reply read timeout in milliseconds
Description:
Enumerate open|filtered TCP services using a raw "XMas" scan; this
sends probes containing the FIN, PSH and URG flags.
Module Options
This is a complete list of options available in the scanner/portscan/xmas auxiliary module:
msf6 auxiliary(scanner/portscan/xmas) > show options
Module options (auxiliary/scanner/portscan/xmas):
Name Current Setting Required Description
---- --------------- -------- -----------
BATCHSIZE 256 yes The number of hosts to scan per set
DELAY 0 yes The delay between connections, per thread, in milliseconds
INTERFACE no The name of the interface
JITTER 0 yes The delay jitter factor (maximum value by which to +/- DELAY) in milliseconds.
PORTS 1-10000 yes Ports to scan (e.g. 22-25,80,110-900)
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
SNAPLEN 65535 yes The number of bytes to capture
THREADS 1 yes The number of concurrent threads (max one per host)
TIMEOUT 500 yes The reply read timeout in milliseconds
Advanced Options
Here is a complete list of advanced options supported by the scanner/portscan/xmas auxiliary module:
msf6 auxiliary(scanner/portscan/xmas) > show advanced
Module advanced options (auxiliary/scanner/portscan/xmas):
Name Current Setting Required Description
---- --------------- -------- -----------
GATEWAY_PROBE_HOST 8.8.8.8 yes Send a TTL=1 random UDP datagram to this host to discover the default gateway's MAC
GATEWAY_PROBE_PORT no The port on GATEWAY_PROBE_HOST to send a random UDP probe to (random if 0 or unset)
SECRET 1297303073 yes A 32-bit cookie for probe requests.
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
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 scanner/portscan/xmas module can do:
msf6 auxiliary(scanner/portscan/xmas) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/portscan/xmas auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/portscan/xmas) > 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.
PORTS
Here is a relevant code snippet related to the "PORTS" error message:
46:
47: pcap = self.capture
48:
49: ports = Rex::Socket.portspec_crack(datastore['PORTS'])
50: if ports.empty?
51: raise Msf::OptionValidateError.new(['PORTS'])
52: end
53:
54: jitter_value = datastore['JITTER'].to_i
55: if jitter_value < 0
56: raise Msf::OptionValidateError.new(['JITTER'])
JITTER
Here is a relevant code snippet related to the "JITTER" error message:
51: raise Msf::OptionValidateError.new(['PORTS'])
52: end
53:
54: jitter_value = datastore['JITTER'].to_i
55: if jitter_value < 0
56: raise Msf::OptionValidateError.new(['JITTER'])
57: end
58:
59: delay_value = datastore['DELAY'].to_i
60: if delay_value < 0
61: raise Msf::OptionValidateError.new(['DELAY'])
DELAY
Here is a relevant code snippet related to the "DELAY" error message:
56: raise Msf::OptionValidateError.new(['JITTER'])
57: end
58:
59: delay_value = datastore['DELAY'].to_i
60: if delay_value < 0
61: raise Msf::OptionValidateError.new(['DELAY'])
62: end
63:
64: to = (datastore['TIMEOUT'] || 500).to_f / 1000.0
65:
66: # we copy the hosts because some may not be reachable and need to be ejected
Error
Here is a relevant code snippet related to the "Error" error message:
97: :type => "TCP OPEN|FILTERED #{dhost}:#{dport}",
98: :data => "TCP OPEN|FILTERED #{dhost}:#{dport}"
99: )
100:
101: rescue ::Exception
102: print_error("Error: #{$!.class} #{$!}")
103: end
104: end
105: end
106:
107: close_pcap
Go back to menu.
Related Pull Requests
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #6317 Merged Pull Request: Add capability for delays (+/- jitter) to all auxiliary scanner modules & implement in portscan modules
- #6010 Merged Pull Request: Fix #6008, incorrect usage of capture_sendto
- #5059 Merged Pull Request: Yard doc corrections
- #2779 Merged Pull Request: Raise Msf::OptionValidateError when the PORTS option is invalid
- #2525 Merged Pull Request: Change module boilerplate
- #1228 Merged Pull Request: MSFTIDY cleanup #1 - auxiliary
Go back to menu.
See Also
Check also the following modules related to this module:
- auxiliary/scanner/natpmp/natpmp_portscan
- auxiliary/scanner/portscan/ack
- auxiliary/scanner/portscan/ftpbounce
- auxiliary/scanner/portscan/syn
- auxiliary/scanner/portscan/tcp
- auxiliary/scanner/sap/sap_router_portscanner
- exploit/windows/ftp/xlink_client
- exploit/windows/nfs/xlink_nfsd
Authors
kris katterjohn
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.