03 [Cybersecurity hands-on](https://logicpacks.io/learn/cyber) · Lesson 3 of 10 · lab

# Web app basics and an intercepting proxy

Requests, responses, headers and cookies, then watch traffic through mitmproxy and scan with nikto.

Roman Urdu: Web request, response, headers aur cookies samjho, phir mitmproxy se traffic dekho aur nikto se scan kro.

## Video transcript

Every click in a web app is a request. Most real bugs live in how the app handles those requests. A proxy lets you read them.

When you click, your browser sends a request: a method, a path, and some headers. The server sends back a response: a status code, headers, and the page.

After you log in, the server hands your browser a session cookie. The browser sends it back with every request. To the server, whoever holds that cookie is you. That is why attackers want it.

An intercepting proxy sits between your browser and the server. Every request stops there first. You can read it, pause it, change it, and send it again.

The lesson for builders: anything the browser sends can be changed. Hidden fields. Prices. Account numbers. A check that only runs in the page can be skipped. So the server must check everything itself.

So: read the request, then question it. In the lab, you read a raw exchange, find the session cookie, record traffic through the proxy, and run a web scanner. Only intercept traffic to apps you own, or are allowed to test.

[Video file (MP4, 1 min 16 s, 3.1 MB)](https://logicpacks.io/learn/media/cyber/web-basics-and-proxy/lesson.mp4) · [Captions (WebVTT)](https://logicpacks.io/learn/media/cyber/web-basics-and-proxy/lesson.vtt)

Rules: Only test systems you own or have written permission to test. Everything in this track runs against practice targets inside your own machine. Scanning or attacking anyone else’s system without permission is a crime in most countries.

## Goal

Read a raw HTTP exchange, find the session cookie, record traffic through an intercepting proxy and run a web scanner.

## Why it matters

Most real bugs live in how a web app handles requests. A proxy lets you see and change every request a browser sends.

## Your machine · learn-cyber · lab cyber-03

First time: make your course machine from any terminal (Mac, Linux and Windows 10+ all have ssh). Your ssh key is your login; a new key picks a handle and accepts the terms first.

```sh
ssh -t -p 2200 m.logicpacks.io new cyber --name learn-cyber
```

After that, come back to the same machine any time. Your files are still there:

```sh
ssh -t -p 2200 learn-cyber@m.logicpacks.io
```

To use the terminal in this page, sign this browser in once: run this and open the link it prints.

```sh
ssh -p 2200 m.logicpacks.io web
```

All your machines in the browser: [logicpacks.io/m](https://logicpacks.io/m). A guest key gets one machine: if you already use it for something else, `rm` that one or link a free account (3 machines). How machines work, credits and terms: [logicpacks.io/machines](https://logicpacks.io/machines)

## Step by step

1.  Start the practice targets (about 20 seconds; Juice Shop is the slowest).
    
    ```sh
    lab start
    ```
    
    ```sh
    lab status
    ```
    
    Diagram: an intercepting proxy on your machine sits between your browser and the server. Each request stops at the proxy, where you can read it, pause it, change it and send it again.
    
    Every request stops at the proxy first, so anything the browser sends can be read and changed. The server has to check it all.
    
2.  Read the response headers from DVWA. Find the Set-Cookie line: that is your session.
    
    ```sh
    curl -si http://dvwa.lab/login.php | head -20
    ```
    
3.  Start mitmdump, an intercepting proxy, on port 8080 and save every request it sees. It takes about 15 seconds to start on a small machine.
    
    ```sh
    mkdir -p ~/scans && mitmdump -p 8080 -w ~/scans/dvwa.flows > /dev/null 2>&1 &
    ```
    
    ```sh
    sleep 15
    ```
    
4.  Send requests through it, then read them back.
    
    ```sh
    curl -s -x http://127.0.0.1:8080 http://dvwa.lab/login.php -o /dev/null -w "%{http_code}\n"
    ```
    
    ```sh
    mitmdump -nr ~/scans/dvwa.flows
    ```
    
5.  Run a one-minute web scan and read what it says about headers and files.
    
    ```sh
    nikto -h http://dvwa.lab -maxtime 60s -o ~/scans/nikto-dvwa.txt
    ```
    
6.  Prefer Burp or ZAP? Run it on your own computer and reach the targets through ssh: then open http://localhost:8080.
    
    ```sh
    ssh -p 2200 -L 8080:dvwa.lab:80 -L 3000:juice.lab:3000 m.logicpacks.io
    ```
    

## Check my work

Run this in your machine. It checks your work and prints PASS, or FAIL with a hint about what is missing.

```sh
lab check cyber-03
```

[Previous : Networking basics and nmap against the lab](https://logicpacks.io/learn/cyber/networking-and-nmap) [Next : SQL injection on DVWA, by hand and with sqlmap](https://logicpacks.io/learn/cyber/sql-injection-dvwa)

---

Canonical URL: https://logicpacks.io/learn/cyber/web-basics-and-proxy

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](https://logicpacks.io/llms.txt). Plain facts: [/about.md](https://logicpacks.io/about.md). Safety: [/safety.md](https://logicpacks.io/safety.md).
