BCS453 - Cyber Security Workshop Lab Manual
BCS453 - Cyber Security Workshop Lab Manual
BCS453 - Cyber Security Workshop Lab Manual
List of Experiments
S. No Experiments
Module 1: Packet Analysis using Wire shark
Basic Packet Inspection: Capture network traffic using Wire shark and
analyze basic protocols like HTTP (Hyper Text Transfer Protocol), DNS
1
(Domain Name System),
and SMTP (Simple Mail Transfer Protocol) to understand how data is
transmitted andreceived.
Detecting Suspicious Activity: Analyze network traffic to identify suspicious
2 patterns, such as repeated connection attempts or unusual communication
between hosts.
Malware Traffic Analysis: Analyze captured traffic to identify signs of
3 malware communication, such as command-and-control traffic or data
infiltration.
Password Sniffing: Simulate a scenario where a password is transmitted in
4 plaintext. Use Wireshark to capture and analyze the packets to demonstrate
the vulnerability and the importance of encryption.
ARP Poisoning Attack: Set up an ARP poisoning attack using tools like
Ettercap. Analyze the captured packets to understand how the attack can lead
5 to a Man-in-the- Middle scenario.
Introduction to Wireshark
Wireshark is a network packet analyzer. A network packet analyzer presents captured packet
data in asmuch detail as possible.
You could think of a network packet analyzer as a measuring device for examining what’s
happening inside a network cable, just like an electrician uses a voltmeter for examining what’s
happening inside an electric cable (but at a higher level, of course)
Downloading Steps:
1. Your first step is to head to the Wireshark download page and locate the Windows installer.
Once your file is downloaded, you can open the file from your Download folder.
2. You will be presented with the Wireshark wizard to guide you through the
installation. Click “Next.”
3. Next, you can review, agree to the license agreement, and click “Noted” to continue.
4. The next screen will ask if you want to donate to the Wireshark Foundation to help
supportWireshark and Sharkfest at https://wiresharkfoundation.org/. Click “Next”
when finished.
5. Next, you will be asked what components you want to install. You can make your choice
and then click “Next.”
6. The following screen will ask if you want to create any shortcuts and if you want to
associate trace file extensions with Wireshark (recommended).
7. Now you must install Ncap (an open-source library for packet capture and network
analysis). It’s a library allowing Wireshark to capture and analyze network traffic
effectively. It enhances Wireshark's capabilities by providing optimized packet capture.
8. Wireshark will now begin the installation process.
Experiment 1
Objective:
Basic Packet Inspection: Capture network traffic using Wire shark and analyze basic protocols like
HTTP, DNS, and SMTP to understand how data is transmitted and received.
Tool Used: Wireshark
DNS observation
Step 1: Start capturing via Wireshark
Step 2: ping nptel.ac.in (command
prompt) Step 3: Apply dns protocol filter
in wireshark Step 4: Observe the data in
the given table:
Objective : Detecting Suspicious Activity: Analyze network tra8ic to identify suspicious patterns,
such as repeated connection attempts or unusual communication between hosts.
Sec-sick client.pcapng
Aurora.pcap
Arp_poison.pcap
Step 1: Check the normal activity of di8erent protocol on the network by checking protocol
hierarchy and find the normal information being transferred under di8erent protocols susch as TCP
and UDP.
Protocol heirarchy:
Step 2: Open sec-sickclient.pcapng and observer the suspisious data being trasnferred in TCP
protocol and observe the path of the same.
Step 3: Load the other package “Aurora.pcap”- Spear Phishing attack and observe the line no 6 for
iframe attack
Line 21 :
Step 5: Check the TCP data by following TCP stream of the same and observe that the hacker is
trying to access the adming control by getting password and other credentials.
Step 6: Observe the suspicious activity by loading the package “ arp_poison.pcap” and check that
there is man in the middle attack is being happened in line no. 54, 55,56 and 57.
Experiment 3
Objective: Malware Traffic Analysis: Analyze captured traffic to identify signs of malware
communication, such as command-and-control traffic or data infiltration.
Package: 2014-11-16-traffic-analysis-exercise.pcp
To get the better understanding of destination: Right Click on host user HTTP
172.16.165.165
K34EN6W3N-PC
f0:19:af:02:9b:f1
EXPERIMENT 4
Objective 1: Simulate a scenario where a password is transmitted in plaintext. Use wire shark to capture and
analyze the packets to demonstrate the vulnerability and the importance of encryption.
Password Capturing/Sniffing
Wireshark can capture not only passwords but any type of information transmitted over the network:
usernames, email addresses, personal information, etc. As long as we can capture network traffic, Wireshark
can sniff passing passwords.
In sniffing can include passwords for various protocols such as HTTP, FTP, Telnet, etc. the captured data
can be used to troubleshoot network problems, but can also be used maliciously to gain unauthorized access
to sensitive information.
So, here we will see how we can capture the password using the Wireshark network capture analyzer. and
see the outputs of the following steps.
Step 1: First of all, open your Wireshark tool in your window or in Linux virtual machine. and start
capturing the network. suppose I am capturing my wireless fidelity.
Step 2: After starting the packet capturing we will go to the website and login the credential on that website
as you can see in the image.
2
Step 3: Now after completing the login credential we will go and capture the password in Wireshark. for that
we have to use some filter that helps to find the login credential through the packet capturing.
Step 4: Wireshark has captured some packets but we specifically looking for HTTP packets. so in the
display filter bar we use some command to find all the captured HTTP packets. as you can see in the below
image the green bar where we apply the filter.
http
3
Step 5: So there are some HTTP packets are captured but we specifically looking for form data that the user
submitted to the website. for that, we have a separate filter
As we know that there are main two methods used for submitting form data from web pages like login forms
to the server. the methods are-
GET
POST
Step 6: So firstly for knowing the credential we use the first method and apply the filter for the GET
methods as you can see below.
http.request.method == "GET"
GET method
As you can see in the image there are two packets where the login page was requested with a GET request as
well, but there is no form data submitted with a GET request.
Step 7: Now after checking the GET method if we didn’t find the form data, then we will try the POST
method for that we will apply the filter on Wireshark as you can see.
http.request.method == "POST"
4
As you can see we have a packet with form data click on the packet with user info and the application URL
encoded. and click on the down-
HTML form URL Encoded where the login credential is found. login credential as it is the same that we
filed on the website in step 2.
Form item: "uname" = "Tonystark_44"
Form item: "pass" = "tony@1234"
Experiment 5
Objective: ARP Poisoning Attack: Set up an ARP poisoning attack using tools like Ettercap. Analyze
the captured packets to understand how the attack can lead to a Man-in-the-Middle scenario.
Copy MAC address from above and run command in wireshark @kali
Aim is to capture the traffic between Target and default gate way on same line.
OR
SQL Injection: Use DVWA to practice SQL injection attacks. Demonstrate how an attacker can
manipulate input fields to extract, modify, or delete database information.
Setting Up DVWA
1. Install DVWA:
You can set up DVWA on your local machine using XAMPP or Docker.
Go to the DVWA Security tab and set the security level to "Low" for simplicity in
this demonstration.
You will see an input field where you are asked to enter a user ID to fetch
information from the database.
In the input field, enter a simple SQL injection payload, such as 1' OR '1'='1. This
input attempts to manipulate the SQL query behind the scenes.
Click "Submit".
If the application is vulnerable, it should return all user information from the
database, because the condition 1' OR '1'='1 is always true.
This payload comments out the rest of the SQL query, causing the database to
return all records.
To extract specific information, you can tailor your query. For example: 1'
UNION SELECT user, password FROM users--.
This payload combines the results from the user ID query with a UNION
statement that fetches all usernames and passwords from the users table.
1. Altering Data:
SQL injection can also be used to modify database entries. For example: 1';
UPDATE users SET password='hacked' WHERE user_id=1--.
This payload attempts to change the password of the user with user_id=1 to
'hacked'.
1. Deleting Data:
An attacker can delete records with a similar approach. For example: 1'; DELETE
FROM users WHERE user_id=1--.
This payload deletes the user with user_id=1 from the database.
1. Use Prepared Statements: Prepared statements with parameterized queries ensure that
SQL code is passed separately from data.
2. Validate and Sanitize Input: Always validate and sanitize user inputs.
3. Use ORM Libraries: Object-Relational Mapping (ORM) libraries abstract away the SQL
queries.
4. Least Privilege Principle: Grant the minimum necessary database privileges to your
application.
Conclusion
Practicing SQL injection on DVWA provides hands-on experience on how attackers exploit
vulnerabilities in web applications. By understanding these attacks, developers can better secure
their applications against such threats. Always ensure you have permission to test and attack
systems and never use these skills maliciously.
Experiment No. 7
Cross-Site Scripting (XSS): Exploit XSS vulnerabilities in DVWA to inject malicious scripts
into web pages. Show the potential impact of XSS attacks, such as stealing cookies or defacing
websites.
1. Setup DVWA
Install DVWA: Install DVWA on your local machine or a virtual environment. Ensure
you have a web server (e.g., Apache) and a database server (e.g., MySQL) set up.
Configure DVWA: Modify the config/config.inc.php file with your database credentials
and other necessary configurations.
2. Log in to DVWA
1. Navigate to the XSS (Stored) section: This section allows you to inject scripts that will
be stored and executed whenever the affected page is loaded.
4. Verify Cookie Theft: On the attacker's server, verify that the cookies have been
received. This can be done by checking the logs or the steal.php script designed to log
cookies.
1. Navigate to the XSS (Reflected) section: This section reflects input back to the user,
providing an opportunity to inject and execute scripts.
4. Verify Defacement: The web page should now display "Hacked by Attacker" instead of
its original content.
1. Stealing Cookies:
Example: If an attacker steals a session cookie from a logged-in user, they can
impersonate that user on the website.
2. Website Defacement:
Attackers can alter the appearance of web pages, causing reputational damage to
the website.
Example: Changing the content of a homepage to display offensive messages or
propaganda.
3. Phishing Attacks:
Example: Injecting a fake login form that sends user credentials to the attacker.
4. Malware Distribution:
Attackers can inject scripts that redirect users to malicious sites or download
malware.
1. Input Validation: Sanitize and validate all user inputs to ensure they do not contain
malicious scripts.
2. Output Encoding: Encode outputs to ensure that any potentially malicious code is
rendered harmless.
3. Content Security Policy (CSP): Implement CSP to restrict the sources from which
scripts can be loaded.
4. Use Security Libraries: Utilize libraries and frameworks that offer built-in protection
against XSS.