In this lab, we will perform a few attacks including the Telnet session hijacking.

[10pts] Part 0: Setting the VM environments

Set up the VM environments by following the instructions given here.

Important!

Submit

Nothing to submit. However, I will see and check whether you did this by seeing the screen captures for the subsequent parts in your lab report.

[20pts] Part 1: UDP Spoofing using Scapy

Perform the UDP Spoofing using Scapy as instructed in the lecture notes on "Scapy and Reverse Shell". Fill out the omitted function hexshow().

Tips

Regarding writing hexshow(), we already did something similar (Part 2 of Lab 1 in IT430). Think of it as refreshing some of your coding skils. (If you don't remember how you wrote the code, read the tips there carefully.)

Submit

Show and explain your work possibly with a execution log or a screen capture in the lab report.

[20pts] Part 2: TCP Reset Attack

The TCP Reset Attack can terminate an established TCP connection between two victims.

Suppose that there is an established Telnet connection between two users A and B, attackers can spoof a RST packet from A to B, breaking this existing connection.

Telnet

Telnet is the predecessor of SSH. Telnet doesn't use encryption, and it's not secure. For this reason, Ubuntu doesn't install this service by default.

In our class, we will see that we can actually attack the Telnet protocol. To install the Telnet service:

 sudo apt install telnetd -y 
Now, you can use the Telnet command to log in to other machine. The usage is basically the same as ssh:
telnet 192.168.172.5

Crafting a packet

To succeed in this attack, attackers need to correctly construct the TCP Reset packet. In particular, You need to craft a packet that looks like the following:

# fill out the fields correctly 
ip = IP(src="xxx.xxx.xxx.xxx", dst="yyy.yyy.yyy.yyy")
tcp = TCP(sport=sssss, dport=ddddd, seq=zzzzzz, ack=aaaaa, flags="R")
pkt = ip/tcp
The flags "R" in the above means Reset.

Warning

Your Task

Submit

Show (with screen captures and code) and explain your work. Convince the instructor that the attack has been successful by showing the details of your work.

[35pts] Part 3: TCP Session Hijacking

In this part, we will show how we can set up a reverse shell if we can directly run a command on the victim machine (i.e. the server machine). In the TCP session hijacking attack, attackers cannot directly run a command on the victim machine, so their jobs is to run a reverse-shell command through the session hijacking attack.

Your task

  1. In it432a, login to it432b using Telnet.
  2. In it432c (the attacker machine), listen at TCP port 8000 using the nc command. The attacker will need to do this to receive a reverse shell session.
  3. Also, in it432c, sniff the TCP session. Recall sniffing the packets for the other hosts in a local network needs enabling the promiscuous mode. The following command will enable the promiscuous mode.
    sudo ifconfig ens160 promisc
  4. In it432c, inject a TCP packet (using Scapy) that contains a reverse shell toward it432c. Please read the documentation carefully to see how to craft and send the TCP packet.
Tips You need to craft a packet that looks like the following:

# fill out the fields correctly 
ip = IP(src="xxx.xxx.xxx.xxx", dst="yyy.yyy.yyy.yyy")
tcp = TCP(sport=sssss, dport=ddddd, seq=zzzzzz, ack=aaaaa, flags="A")
data  = b"\n/bin/bash -i ....???redirection???... \n" 
pkt = ip/tcp/data
Warning

Submit

Show (with screen captures and code) and explain your work. Convince the instructor that the attack has been successful by showing the details of your work.

[15pts] Part 4: Writing a Lab Report

Please explain and show your work. Write a lab report by using the provided template (check the lab ground rules). The writing quality of the lab report matters.
~/bin/submit -c=IT432 -p=lab02 lab02_report.doc