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.
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
A terminal on your own cyber machine, right in this page. It keeps your files between lessons.
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.
$ ssh -t -p 2200 m.logicpacks.io new cyber --name learn-cyberAfter that, come back to the same machine any time. Your files are still there:
$ ssh -t -p 2200 learn-cyber@m.logicpacks.ioTo use the terminal in this page, sign this browser in once: run this and open the link it prints.
$ ssh -p 2200 m.logicpacks.io webAll your machines in the browser: 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
Step by step
Start the practice targets (about 20 seconds; Juice Shop is the slowest).
$ lab start$ lab statusEvery request stops at the proxy first, so anything the browser sends can be read and changed. The server has to check it all. Read the response headers from DVWA. Find the Set-Cookie line: that is your session.
$ curl -si http://dvwa.lab/login.php | head -20Start mitmdump, an intercepting proxy, on port 8080 and save every request it sees. It takes about 15 seconds to start on a small machine.
$ mkdir -p ~/scans && mitmdump -p 8080 -w ~/scans/dvwa.flows > /dev/null 2>&1 &$ sleep 15Send requests through it, then read them back.
$ curl -s -x http://127.0.0.1:8080 http://dvwa.lab/login.php -o /dev/null -w "%{http_code}\n"$ mitmdump -nr ~/scans/dvwa.flowsRun a one-minute web scan and read what it says about headers and files.
$ nikto -h http://dvwa.lab -maxtime 60s -o ~/scans/nikto-dvwa.txtPrefer Burp or ZAP? Run it on your own computer and reach the targets through ssh: then open http://localhost:8080.
$ 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.
$ lab check cyber-03