Skip to content

Commit 5fccf98

Browse files
committed
Catch ACCESS_DENIED
1 parent 2c9209f commit 5fccf98

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/msf/core/exploit/smb/psexec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ def psexec(command, disconnect=true)
121121
service_exists = true
122122
print_warning("#{peer} - Service already exists, opening a handle...")
123123
svc_handle = dce_openservicew(dcerpc, scm_handle, service_name)
124+
when ERROR_ACCESS_DENIED
125+
print_error("#{peer} - Unable to create service, ACCESS_DENIED, did AV gobble your binary?")
126+
return false
124127
else
125128
print_error("#{peer} - Failed to create service, ERROR_CODE: #{svc_status}")
126129
return false
@@ -144,6 +147,8 @@ def psexec(command, disconnect=true)
144147
print_good("#{peer} - Service started successfully...")
145148
when ERROR_FILE_NOT_FOUND
146149
print_error("#{peer} - Service failed to start - FILE_NOT_FOUND")
150+
when ERROR_ACCESS_DENIED
151+
print_error("#{peer} - Service failed to start - ACCESS_DENIED")
147152
when ERROR_SERVICE_REQUEST_TIMEOUT
148153
print_good("#{peer} - Service start timed out, OK if running a command or non-service executable...")
149154
else

0 commit comments

Comments
 (0)