Day 2 of 760 minCipher CadetHands-on lab
Day 2: Reading a Web App From the Outside
Taught by Mr Elite Updated
By the end of today you can
- Explain a request and a response in plain words
- Open developer tools and find the Network tab, headers and page source
- Pick out details a defender would care about
- Record observations in a notes file without attacking anything
Warm-up
Answer from memory first, then tap to check. Recalling yesterday is what makes it stick.
What is scope, and what do you do with anything that is not on it?
Scope is a written list of what you may touch. Anything not on it is off limits.
What is the difference between > and >> when saving command output?
> saves output to a file, replacing what was there. >> adds the output to the end of the file.
Imagine you built a small web shop. You have never looked at it the way a stranger does. A stranger can see the page, but their browser also receives a pile of extra information along the way: file names, server labels, form fields, comments left in the code. None of it needs hacking. It is simply handed over to every visitor.
Today I will show you how to see that pile of information with the tools already built into your browser. This is the first real recon skill. You learn to read what a site says about itself, and you learn which parts a defender should care about.
Pages, requests and responses
When you type an address into your browser, it sends a request. That is a short message asking a server for something, such as a page or an image. The server sends back a response. The response has a status code, some headers, and usually a body.
One page is rarely one request. The first response is HTML, the text that describes the page. Your browser reads it, then makes more requests for the style files, scripts and pictures it mentions. A busy page can make dozens.
Your browser builds requests for you, so you never type them. Still, seeing one as plain text makes the Network tab much easier to read later. The example below is invented for illustration. It is not output from any real site.
GET /search?q=book HTTP/1.1
Host: bookshop.example
User-Agent: Mozilla/5.0
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Server: nginx
Set-Cookie: session=abc123; HttpOnly
<html> ...page body... </html>Look at the path /search?q=book. Everything after the question mark is the query string. Here q is the parameter name and book is its value. This is how a page passes your input to the server through the address. Parameters matter because they are places where the app accepts data from a visitor.
- Request
- A message from your browser asking a server for something.
- Response
- The server's reply: a status code, headers and a body.
- Status code
- A number saying how it went. 200 means fine, 404 means not found, 302 means redirected.
- Header
- A labelled line of extra information sent with a request or response.
- HTML source
- The raw text of the page before your browser draws it.
- Parameter
- A named value in the address after the ?, such as q=book, that the app reads as input.
Quick check
You load one web page and see 30 entries in the network list. What is the most likely reason?
One HTML page usually links to styles, scripts and images, and each one is its own request.
Watch me do it: open the developer tools
I will do this on a page you are allowed to look at. For this walkthrough, use the SecurityElites practice lab from the lab section below, or a local page of your own. Do not do this on a site you have no permission to examine closely. Looking at your own browser's traffic is harmless, but keep to scope.
Any modern browser works. Chrome, Edge and Firefox all have the same tools with slightly different layouts. I describe the common names, so if a tab sits in a different place on your screen, look along the top row of the panel.
Here is what you are aiming to have in front of you after those steps. The values will differ in the lab. The shape is what matters.
Request URL: https://<lab-address>/?q=book
Request Method: GET
Status Code: 200 OK
Response Headers
Content-Type: text/html; charset=utf-8
Server: (a name, or missing)
Set-Cookie: (maybe present)What a defender cares about
You now have raw material. The skill is deciding what matters. I look at it in four groups, and you can use the same ones for your notes.
- URLs and paths
- Page addresses and parameters like ?q=. They show how the app takes input.
- Headers
- Server and framework labels, cookie settings, and security headers that are present or missing.
- Form fields
- Every input is a place where a visitor can send data to the app.
- Technology hints
- Script names, version numbers, generator tags and comments that reveal what the app is built with.
For a defender, each of these answers a question. Does the site announce an exact software version it should keep quiet? Are cookies marked so scripts cannot read them? Is a forgotten comment leaking an internal name? You are not attacking anything. You are reading what is already public and judging whether it should be.
Security headers deserve a closer look because their absence is a finding in itself. These are response headers that tell the browser to apply extra protections. You will meet them again, so here are three to recognise now.
- Content-Security-Policy
- Tells the browser which sources of scripts and other content the page may load. It limits the damage if bad content slips in.
- Strict-Transport-Security
- Tells the browser to use encrypted HTTPS only for this site, even if someone types a plain http address.
- X-Content-Type-Options
- Stops the browser guessing a file type, which closes off some tricks with disguised files.
A practice lab may well lack some of these. Do not read that as a mistake in your method. Note it, and ask what a real shop should have. That habit of asking what is missing is half of defensive recon.
Quick check
Which of these is a form field observation, not a header observation?
Form fields are inputs in the page HTML. The others are values sent in headers or status lines.
Your turn: the practice lab
Now you do the same on the lab. The lab is built around a search box, which is why it is a good place to practise observing input. Today we only look. We will not try to break anything.
Taking notes you can reuse
Loose notes are hard to use later. In Day 1 you made a recon-course folder. Add a notes file there so tomorrow's work can build on it.
cd recon-course
touch day2-notes.txt
echo "Target: BookShop practice lab (in scope)" >> day2-notes.txt
cat day2-notes.txtYou should see the single line starting with Target. On Windows PowerShell, use New-Item day2-notes.txt instead of touch. If cd says the folder does not exist, run pwd or ls to check where you are, then move to the folder you made on Day 1.
Add one line per observation using the same echo pattern, or type them in VS Code. Start each line with its category in square brackets, then say what you saw and where. Two example lines follow, using placeholders in place of real lab values.
echo "[header] Server: <value> seen on first request" >> day2-notes.txt
echo "[form] search input named <name>, method <GET or POST>" >> day2-notes.txtRun cat day2-notes.txt again. Every line you added should appear in order, with the Target line first. Keep the quotes around your text, otherwise the shell may mangle punctuation. Tomorrow you will compare these hand-made notes with what a command line tool collects.
Your turn
Reflected XSS
The BookShop lab gives you a real search box and a real set of requests to read. Use it today only as a page to observe. Recon comes before testing, and a clear picture of how the search input works will help you on later days.
What to try
What to notice
- How your search word travels in the URL and where it comes back on the page
- Which headers are present, and which common security headers you do not see
- Whether the page source contains anything the visitor was not meant to read
If it did not work
Opening the Network tab after the page has loaded and seeing nothing.
The tab only records while open. Keep it open and press F5 to reload.
Treating the Elements tab as the raw source.
Use Ctrl+U for what the server actually sent. Elements shows the page after the browser changed it.
Testing the search box with attack text because the lab mentions it.
Today is observation only. Use plain words and save testing for the day that calls for it.
Writing vague notes like 'headers look normal'.
Record the exact header name and value, and where you saw it, so the note is useful later.
Recap
- A page load is a request followed by a response, and one page triggers many requests.
- Developer tools are built into your browser and show what any visitor receives.
- The Network tab shows requests and headers. View source shows the raw HTML.
- Useful groups for notes: URLs, headers, form fields and technology hints.
- A defender reads these to find what the app reveals that it should not.
- Observation comes first. Today involves no attacks.
Cheat sheet
F12 / Ctrl+Shift+I- Open developer tools (Cmd+Option+I on macOS)
Network tab- Lists every request the page makes; reload with F5 to fill it
Ctrl+U- View raw page source (Cmd+Option+U on macOS)
Response Headers- Labelled lines the server sends back, such as Server and Set-Cookie
200 / 302 / 404- OK / redirected / not found
echo "text" >> file- Append a line to a notes file
Before the next day
Mission: Five observations and a screenshot
In the BookShop practice lab, record five observations about how the app presents itself to a visitor. This gives you a first structured note that you will turn into data in the coming days. Observe only. Do not attempt any attack.
About 30 min
You are done when: day2-notes.txt with five categorised observations in your recon-course folder, plus one Network tab screenshot.
Want more? Add a sixth note listing one security header you expected but did not see, and one sentence on why a defender would want it.
Quiz
4 questions. Your score is saved with your progress.
1. What does the server send back after your browser asks for a page?
The server replies with a response. The browser is the one that sends requests.
2. You want to see the exact text the server sent, before your browser changed anything. What do you use?
View source shows the raw HTML. Elements shows the page after the browser has processed it.
3. Why does a defender care that a response header shows an exact software version?
Version details are public to every visitor and can guide an attacker, so a defender may choose to hide them.
4. The lab description mentions running JavaScript. What is correct for today?
Today's task is observation. Testing comes only when a lesson calls for it, and only inside the practice lab.
Finish the day
Mark the day complete to save your progress.
Next: On Day 3 we stop clicking and start collecting. You will use curl and a short Python script to fetch headers and page content from a local target and save them to files, building on the observations you made by hand today.
Your notes
Private to this device. Write what you want to remember from today.