Assignment CSCI369 Spring 2024
Assignment CSCI369 Spring 2024
Assignment
Due: 11:55 pm 19 October 2024
Total Mark: 100 (30% of Final Mark)
- You must create a folder for each question. – Create folders named as
Q1,…,Q4.
- Your Python source codes or text, doc files for each question must be
saved in the folder you have created.
- You must install a VirtualBox on your laptop or desktop. In the VirtualBox,
you must have at least Kali, Ubuntu and Metasploitable2 virtual machines.
- You must use tools and Python modules specified in each question.
Important note: You should submit your Python source code with brief readme
files (for explaining how to run your program). Not doing so could result in a 20%
reduction in the marks.
In this task, you will write a Python program that allows you to perform
an ARP spoofing attack with a single command as follows:
Your program must use the scapy package. (Do not use subprocess to call
linux commands or other tools.) Also you can use the sys module to take
user input arguments (<Victim_IP> and <Router_IP>). Your program
must present a successful arp spoofing attack on Metasploitable2 (Meta
2) VM (victim) when the program is run on Kali VM (attacker).
In this task, you will write a Python program to steal a cookie when a web
site vulnerable to XSS reflected is injected by a Javascript code to send the
website user’s session cookie to the attacker’s server. As usual, the
attacker’s server is Kali VM and the vulnerable website is Meta2 VM’s
DVWA, which you can access at http://<Meta2 IP>/DVWA from Kali VM.
Set the DVMA security to “minimum”.
To store the stolen cookies in the Kali VM (server), you must use a
lightweight Python web application framework called Flask. To use Flask,
1
CSCI369 Ethical Hacking
This material is copyrighted. It must not be
C distributed without permission from
Joonsang Baek
Once the venv is installed, set up the Flask environment, referring to the
following web page
https://flask.palletsprojects.com/en/3.0.x/installation/#python-version
(Read it carefully. You can use the same folder name “myproject” to do
your task.)
You now 1) write a Python code importing the Flask module to receive a
current session cookie from the victim (Meta2 VM) and 2) a Javascript
code that needs to be put into the field “What’s your name”of “XSS
reflected” on DVWA. (Remember the DVWA security setting should be
“medium”.) The stolen cookies shouldhave a time stamp (use Python
datetime module) be saved in a file called “cookies.txt” on Kali VM.
Summing up, your submission should be the Python code (25 marks) to
perform 1) and 2) the Javascript code (5 marks) that should be inserted in
the XSS reflected field. (Please save this code snippet in a text file.)
Hints
– You can also refer to User’s Guide and API Reference on the left
panel of the Flask page:
https://flask.palletsprojects.com/en/3.0.x/# Focus on
“request.args” and “redirect”.
– For the Javascript code injection, refer to our lecture slides for
Week 8 on XSS.
4) The file key.txt will be encrypted using the attacker’s public key
generated in step 2)- We call this key_cipher.txt.(Remember the
format of the resulting ciphertext should be base64. )
5) The file key.txt will be deleted.
6) The file my_secrets.txt will be deleted
7) It will finally display a message for ransom payment: “Your file
important.txt is encrypted. To decrypt it, you need to pay me $1,000
and send key_cipher.txt to me.”
Write a Python program that does the above steps. You can use
subprocess and/or sys modules to do this task.
The gift voucher code has monetary value and is sent to the customer for
a certain period only. However, as a hacker, you discovered that the
server admin forgot to close the port for the service. You want to generate
valid gift voucher codes on your own using many client IDs you collected
from information gathering.
Create a text file called “Q4_answers” and write your answers there. You
must explain how you get the answers in detail. Answers without detailed
explanation may result in 0 mark (even if they are correct.)
How to submit
Put your folders Q1,…,Q4 to one folder named as your UOW student number, e.g.
5284611. Then, 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. Submit your (zip) file through Moodle.