Share
## https://sploitus.com/exploit?id=35A57452-9518-5E16-9650-049E1F33AEFA
![Kali Linux](https://img.shields.io/badge/Kali_Linux-557C94?style=for-the-badge&logo=kalilinux&logoColor=white)
![Docker](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white)
![Wireshark](https://img.shields.io/badge/Wireshark-1679A7?style=for-the-badge&logo=wireshark&logoColor=white)
![Nmap](https://img.shields.io/badge/Nmap-214478?style=for-the-badge&logo=nmap&logoColor=white)
![GitHub](https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white)



> **A controlled cybersecurity lab for simulating, capturing, and analyzing common web attack traffic using DVWA, Wireshark, Nmap, and Gobuster.**



---

## ๐Ÿ“Œ Overview

This project is a hands-on **Web Attack Detection & Traffic Analysis Lab** built on **Kali Linux**. It simulates real-world web attack scenarios โ€” SQL Injection, XSS, Port Scanning, and Directory Enumeration โ€” in a safe, isolated Docker environment.

Captured network packets are analyzed using **Wireshark** to study how each attack manifests in traffic and how it can be detected through patterns and filters.

---

## ๐ŸŽฏ Objectives

- Deploy a deliberately vulnerable web app (DVWA) using Docker
- Generate both normal and malicious HTTP/TCP traffic
- Capture and inspect packets using Wireshark
- Identify and document attack signatures and detection techniques
- Build a reproducible lab for security learning and demonstration

---

## ๐Ÿ› ๏ธ Tools & Technologies

| Tool | Role |
|------|------|
| ๐Ÿ‰ **Kali Linux** | Penetration testing OS |
| ๐Ÿณ **Docker** | Container runtime for DVWA |
| ๐ŸŒ **DVWA** | Deliberately Vulnerable Web App |
| ๐Ÿ“ก **Wireshark** | Network packet capture & analysis |
| ๐Ÿ” **Nmap** | Port scanning & service detection |
| ๐Ÿš€ **Gobuster** | Directory & file enumeration |
| ๐Ÿ“ **Git & GitHub** | Version control & documentation |

---

## โš™๏ธ Setup & Installation

### Prerequisites

```bash
sudo apt update && sudo apt upgrade -y
sudo apt install docker.io wireshark nmap gobuster git -y
```

### Start Docker

```bash
sudo systemctl start docker
sudo systemctl enable docker
```

### Deploy DVWA

```bash
# Pull the DVWA image
sudo docker pull vulnerables/web-dvwa

# Run DVWA on port 8080
sudo docker run -d -p 8080:80 vulnerables/web-dvwa
```

### Access the Application

Open your browser and navigate to:

```
http://127.0.0.1:8080
```

| Field | Value |
|-------|-------|
| Username | `admin` |
| Password | `password` |
| Security Level | `Low` |

> After login, click **"Create / Reset Database"** on the setup page, then log in again.

---

## ๐Ÿ”ฅ Attacks Simulated

### 1. ๐Ÿ” Port Scanning โ€” Nmap

```bash
nmap -sV 127.0.0.1
```

**What it does:** Discovers open ports and identifies running services on the target host.  
**Traffic signature:** Burst of TCP SYN packets across multiple ports.

---

### 2. ๐Ÿ’‰ SQL Injection

Navigate to: `DVWA โ†’ SQL Injection`

```sql
' OR 1=1#
```

**What it does:** Bypasses authentication or leaks database contents by injecting SQL logic.  
**Traffic signature:** HTTP GET/POST requests with encoded SQL characters (`%27`, `OR`, `=`, `#`).

---

### 3. ๐Ÿงจ Cross-Site Scripting (XSS)

Navigate to: `DVWA โ†’ XSS (Reflected)`

```html
alert('XSS')
```

**What it does:** Injects executable JavaScript into a web page response.  
**Traffic signature:** HTTP requests containing `` tags or encoded JS payloads.

---

### 4. ๐Ÿ“‚ Directory Enumeration โ€” Gobuster

```bash
gobuster dir -u http://127.0.0.1:8080 -w /usr/share/wordlists/dirb/common.txt
```

**What it does:** Brute-forces hidden directories and files on the web server.  
**Traffic signature:** Hundreds of rapid HTTP GET requests with 404/403/200 responses.

---

## ๐Ÿ“Š Wireshark Traffic Analysis

### Starting a Capture

```bash
# Capture on loopback interface
sudo wireshark &
# Select interface: lo (loopback)
```

### Key Filters Used

| Purpose | Wireshark Filter |
|---------|-----------------|
| All HTTP traffic | `http` |
| TCP traffic | `tcp` |
| SYN scan detection | `tcp.flags.syn==1 && tcp.flags.ack==0` |
| SQL injection patterns | `http contains "OR" && http contains "="` |
| XSS payloads | `http contains "script"` |
| Specific target IP | `ip.addr == 127.0.0.1` |
| High request volume | `http.request.method == "GET"` |

### Traffic Observations

| Attack | Observable Pattern |
|--------|-------------------|
| Nmap Scan | Rapid SYN packets to sequential ports, no full handshake |
| SQL Injection | URL-encoded characters: `%27`, `%20OR%20`, `%23` |
| XSS | `` tags visible in HTTP payload |
| Gobuster | Hundreds of requests/sec, high 404 rate, uniform User-Agent |

---

## ๐Ÿ“ Repository Structure

```
web-attack-detection/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ pcaps/
โ”‚   โ””โ”€โ”€ README.md                   # Instructions for pcap files
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ reports/
โ”‚   โ””โ”€โ”€ findings.md                 # Detailed findings & analysis
โ”‚
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ CONTRIBUTING.md
โ””โ”€โ”€ README.md
```

---

## ๐Ÿ” Key Findings

- **Nmap SYN scans** produced a distinct burst of TCP SYN packets with no corresponding ACK โ€” a classic half-open scan fingerprint.
- **Gobuster enumeration** generated an abnormally high volume of sequential GET requests with a near-identical User-Agent string โ€” easily detectable as automated.
- **SQL Injection payloads** appeared as URL-encoded parameters in HTTP traffic (e.g., `id=%27+OR+1%3D1%23`).
- **XSS payloads** were visible as raw `` content within HTTP response bodies when security level was set to Low.
- Attack traffic was **clearly distinguishable** from normal browsing through packet rate, payload content, and response code distribution.

---

## ๐Ÿš€ Skills Demonstrated

- Network Packet Capture & Inspection
- Web Application Penetration Testing
- Attack Pattern Recognition & Documentation
- Linux System Administration
- Docker Container Management
- Cybersecurity Reporting

---

## โš ๏ธ Disclaimer

> This project was conducted entirely in a **controlled, isolated lab environment** for **educational purposes only**.  
> All attacks were performed against a local, intentionally vulnerable application (DVWA).  
> **Never perform security testing on systems you do not own or have explicit written permission to test.**  
> The author holds no responsibility for any misuse of the techniques demonstrated here.

---



โญ **Star this repo if it helped you learn something!**

[![GitHub stars](https://img.shields.io/github/stars/Debasish-Nayak-656/web-attack-detection?style=social)](https://github.com/Debasish-Nayak-656/web-attack-detection)