Skip to content

Commit eca4b73

Browse files
committed
Land rapid7#7499, check method for pkexec exploit
2 parents 5169341 + 1c746c0 commit eca4b73

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

modules/exploits/linux/local/pkexec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@ def executable_path
6666
@executable_path
6767
end
6868

69+
def check
70+
# version can be nil
71+
version = cmd_exec('pkexec --version').split.last
72+
73+
# version can be a string, so we check it
74+
if version.nil? || !Gem::Version.correct?(version)
75+
vprint_error('pkexec not found or version incorrect')
76+
return CheckCode::Unknown
77+
end
78+
79+
if Gem::Version.new(version) <= Gem::Version.new('0.101')
80+
vprint_good("pkexec #{version} found")
81+
return CheckCode::Appears
82+
end
83+
84+
CheckCode::Detected
85+
end
86+
6987
def exploit
7088
main = %q^
7189
/*

0 commit comments

Comments
 (0)