File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
modules/exploits/linux/local Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -67,17 +67,21 @@ def executable_path
67
67
end
68
68
69
69
def check
70
- version = cmd_exec ( 'pkexec --version' )
71
- if version . nil?
72
- print_error "Policykit is not installed"
73
- return CheckCode ::Safe
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
74
77
end
75
78
76
- if Gem ::Version . new ( version . split ( '.' ) [ 1 ] ) <= 0.101
79
+ if Gem ::Version . new ( version ) <= Gem ::Version . new ( '0.101' )
80
+ vprint_good ( "pkexec #{ version } found" )
77
81
return CheckCode ::Appears
78
82
end
79
83
80
- CheckCode ::Unknown
84
+ CheckCode ::Safe
81
85
end
82
86
83
87
def exploit
You can’t perform that action at this time.
0 commit comments