exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

URGENT/11 Scanner, Based On Detection Tool By Armis

URGENT/11 Scanner, Based On Detection Tool By Armis
Posted Aug 31, 2024
Authored by wvu, Brent Cook, Ben Seri | Site metasploit.com

This Metasploit module detects VxWorks and the IPnet IP stack, along with devices vulnerable to CVE-2019-12258.

tags | exploit
advisories | CVE-2019-12258
SHA-256 | 6f4e528ea0cb7372e3bdf497488748f966e28e300b72e0d74701650b47070ef8

URGENT/11 Scanner, Based On Detection Tool By Armis

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Auxiliary::Scanner
include Msf::Exploit::Capture

def initialize(info = {})
super(update_info(info,
'Name' => 'URGENT/11 Scanner, Based on Detection Tool by Armis',
'Description' => %q{
This module detects VxWorks and the IPnet IP stack, along with devices
vulnerable to CVE-2019-12258.
},
'Author' => [
'Ben Seri', # Upstream tool
'Brent Cook', # Metasploit module
'wvu' # Metasploit module
],
'References' => [
['CVE', '2019-12258'],
['URL', 'https://armis.com/urgent11'],
['URL', 'https://github.com/ArmisSecurity/urgent11-detector']
],
'DisclosureDate' => '2019-08-09', # NVD entry publication
'License' => MSF_LICENSE,
'Notes' => {'Stability' => [CRASH_SAFE]}
))

register_options([
OptString.new('RPORTS', required: true, default: "21 22 23 80 443", desc: 'Target ports for TCP detections')
])

register_advanced_options([
OptInt.new('RetransmissionRate', required: true, default: 3, desc: 'Send n TCP packets')
])

deregister_options('PCAPFILE', 'FILTER')
end

#
# Utility methods
#

def rports
datastore['RPORTS'].split(/[\s,]/).collect{|i| (i.to_i.to_s == i) ? i.to_i : nil}.compact
end

def filter(ip)
"src host #{ip} and dst host #{Rex::Socket.source_address(ip)}"
end

#
# Scanner methods
#

def run_host(ip)
# XXX: Configuring Ethernet and IP headers sends a UDP packet!
@config = PacketFu::Utils.whoami?(target: ip)

open_pcap
capture.setfilter(filter(ip))

port_open = false
rports.each do |rport|
port_open |= run_detections(ip, rport)
end
raise RuntimeError.new("No ports open on #{ip} from #{datastore['RPORTS']}") if !port_open
rescue RuntimeError => e
fail_with(Failure::BadConfig, e.message)
ensure
close_pcap
end

def detections
%w[
tcp_dos_detection
tcp_malformed_options_detection
icmp_code_detection
icmp_timestamp_detection
]
end

def run_detections(ip, port)
print_status("#{ip}:#{port} being checked")

final_ipnet_score = 0
final_vxworks_score = 0
affected_vulnerabilities = []

begin
sock = Rex::Socket::Tcp.create(
'PeerHost' => ip,
'PeerPort' => port
)
rescue
vprint_bad("Could not connect to #{ip}:#{port}, cannot verify vulnerability")
return false
end

detections.each do |detection|
@ipnet_score = 0
@vxworks_score = 0
@vulnerable_cves = []

detection_name = detection.camelize

begin
send(detection, sock, ip, port)
rescue StandardError => e
vprint_error("#{detection_name} failed: #{e.message}")
next
end

vprint_status(
"\t#{detection_name.ljust(30)}" \
"\tVxWorks: #{@vxworks_score}" \
"\tIPnet: #{@ipnet_score}"
)

final_ipnet_score += @ipnet_score
final_vxworks_score += @vxworks_score
affected_vulnerabilities += @vulnerable_cves
end

sock.close

if final_ipnet_score > 0
vprint_good("#{ip}:#{port} detected as IPnet")
elsif final_ipnet_score < 0
vprint_error("#{ip}:#{port} detected as NOT IPnet")
end

if final_vxworks_score > 100
vprint_good("#{ip}:#{port} detected as VxWorks")
elsif final_vxworks_score < 0
vprint_error("#{ip}:#{port} detected as NOT VxWorks")
end

affected_vulnerabilities.each do |vuln|
msg = "#{ip}:#{port} affected by #{vuln}"
print_good(msg)
report_vuln(
host: ip,
name: name,
refs: references,
info: msg
)
end
true
end

#
# TCP detection methods
#

def tcp_malformed_options_detection(sock, ip, port)
pkt = PacketFu::TCPPacket.new(config: @config)

# IP destination address
pkt.ip_daddr = ip

# TCP SYN with malformed options
pkt.tcp_dst = port
pkt.tcp_flags.syn = 1
pkt.tcp_opts = [2, 4, 1460].pack('CCn') + # MSS
[1].pack('C') + # NOP
[3, 2].pack('CC') + # WSCALE with invalid length
[3, 3, 0].pack('CCC') # WSCALE with valid length
pkt.recalc

res = nil

datastore['RetransmissionRate'].times do
pkt.to_w
res = inject_reply(:tcp)

break unless res
end

unless res
return @vxworks_score = 0,
@ipnet_score = 50
end

if res.tcp_flags.rst == 1 &&
res.tcp_dst == pkt.tcp_src && res.tcp_dst == pkt.tcp_src

return @vxworks_score = 100,
@ipnet_score = 100
end

return @vxworks_score = -100,
@ipnet_score = -100
end

def tcp_dos_detection(sock, ip, port)
pkt = PacketFu::TCPPacket.new(config: @config)

# IP destination address
pkt.ip_daddr = ip

# TCP SYN with malformed (truncated) WS option
pkt.tcp_src = sock.getlocalname.last
pkt.tcp_dst = sock.peerport
pkt.tcp_seq = rand(0xffffffff + 1)
pkt.tcp_ack = rand(0xffffffff + 1)
pkt.tcp_flags.syn = 1
pkt.tcp_opts = [3, 2].pack('CC') + # WSCALE with invalid length
[1, 0].pack('CC') # NOP + EOL
pkt.recalc

res = nil

datastore['RetransmissionRate'].times do
pkt.to_w
res = inject_reply(:tcp)

break unless res
end

unless res
return @vxworks_score = 0,
@ipnet_score = 0
end

if res.tcp_flags.rst == 1 &&
res.tcp_dst == pkt.tcp_src && res.tcp_dst == pkt.tcp_src

return @vxworks_score = 100,
@ipnet_score = 100,
@vulnerable_cves = ['CVE-2019-12258']
end

return @vxworks_score = 0,
@ipnet_score = 0
end

#
# ICMP detection methods
#

def icmp_code_detection(sock, ip, _port = nil)
pkt = PacketFu::ICMPPacket.new(config: @config)

# IP destination address
pkt.ip_daddr = ip

# ICMP echo request with non-zero code
pkt.icmp_type = 8
pkt.icmp_code = rand(0x01..0xff)
pkt.payload = capture_icmp_echo_pack
pkt.recalc

pkt.to_w
res = inject_reply(:icmp)

unless res
return @ipnet_score = 0
end

# Echo reply with zeroed code
if res.icmp_type == 0 && res.icmp_code == 0
return @ipnet_score = 20
end

@ipnet_score = -20
end

def icmp_timestamp_detection(sock, ip, _port = nil)
pkt = PacketFu::ICMPPacket.new(config: @config)

# IP destination address
pkt.ip_daddr = ip

# Truncated ICMP timestamp request
pkt.icmp_type = 13
pkt.icmp_code = 0
pkt.payload = "\x00" * 4
pkt.recalc

pkt.to_w
res = inject_reply(:icmp)

unless res
return @ipnet_score = 0
end

# Timestamp reply
if res.icmp_type == 14
return @ipnet_score = 90
end

@ipnet_score = -30
end

end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    0 Files
  • 8
    Nov 8th
    0 Files
  • 9
    Nov 9th
    0 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    0 Files
  • 12
    Nov 12th
    0 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close