← All lessons Stage 0 · Lesson 3
15 min

HTTP: the conversation behind every page

Stage 0 · Lesson 3 · 15 minutes · Requires Lessons 1–2


The one-line answer

HTTP is a text-based conversation: your browser asks for something, the server answers. Every web vulnerability lives inside that exchange.


Why you should care

This is the most important lesson in Stage 0.

Every web attack you will ever learn — SQL injection, XSS, IDOR, broken authentication, SSRF — is fundamentally about sending an HTTP request the developer didn't expect.

If you can read an HTTP request and response comfortably, web security becomes learnable. If you can't, it stays magic. Take your time here.


How it actually works

When you visit a website, your browser sends a request. The server sends back a response. That's it. Both are plain text.

A request

GET /profile?id=42 HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
Cookie: session=a8f3d9e2b1
Accept: text/html

Line by line:

  • GET — the method. What you want to do.
  • /profile?id=42 — the path and query string. What you want.
  • HTTP/1.1 — the protocol version.
  • Host: — which site, since one server can host many.
  • User-Agent: — what browser you claim to be.
  • Cookie: — your session, i.e. proof of who you are.

A response

HTTP/1.1 200 OK
Content-Type: text/html
Server: nginx/1.18.0
Set-Cookie: session=a8f3d9e2b1; HttpOnly

<html>
  <h1>Welcome back, Priya</h1>
</html>

Status line, headers, blank line, then the body.

The methods that matter

MethodPurposeSecurity relevance
GETRetrieve somethingParameters visible in URL and logs
POSTSubmit dataBody isn't logged as readily
PUTCreate or replaceOften under-tested
DELETERemoveAuthorisation frequently missing
PATCHPartial updateMass assignment territory
OPTIONSAsk what's allowedReveals available methods

A classic finding: an application carefully checks permissions on GET /admin but forgets to check them on DELETE /admin/user/5.

Status codes

You only need the shape of them:

  • 2xx — success. 200 OK, 201 Created
  • 3xx — redirect. 301 permanent, 302 temporary
  • 4xx — your fault. 400 bad request, 401 not authenticated, 403 authenticated but not allowed, 404 not found, 429 rate limited
  • 5xx — server's fault. 500 internal error, 502 bad gateway

The 401 vs 403 distinction is genuinely useful. 401 means "who are you?" 403 means "I know who you are, and no." When probing for hidden resources, a 403 often confirms something exists that a 404 would have hidden.

Headers worth knowing early

Request side:

  • Cookie — session identity
  • Authorization — tokens, often Bearer eyJhbGc...
  • Referer — where you came from (yes, it's misspelled in the standard)
  • X-Forwarded-For — original client IP, and frequently trusted when it shouldn't be

Response side:

  • Set-Cookie — issues a session. Look for HttpOnly and Secure flags
  • Content-Type — what kind of data this is
  • Server / X-Powered-By — version disclosure, a free gift to attackers
  • Strict-Transport-Security — forces HTTPS
  • Content-Security-Policy — a major defence against XSS

Stateless — and why sessions exist

HTTP has no memory. Each request is completely independent; the server doesn't inherently know that the request that just arrived is from the same person who logged in a moment ago.

That's why cookies exist. On login, the server issues a session identifier. Your browser sends it with every subsequent request. That cookie is your identity as far as the server is concerned.

Which is precisely why stealing session cookies is such a prized attack — no password needed. Stage 1, Lesson 5 covers this in depth.


See it yourself

This is the most valuable 5 minutes of Stage 0. Do it now.

  1. Open any website
  2. Press F12 (or right-click → Inspect)
  3. Click the Network tab
  4. Reload the page

You're now watching every HTTP request the page makes. Click any one of them.

Look at:

  • Headers — the full request and response
  • Response — what the server actually sent
  • Cookies — what's identifying you

Now try this: find a request, right-click it, and choose Copy → Copy as cURL. Paste that into a terminal. You just replayed a browser request from the command line.

That single trick is the foundation of web testing. Once a request is in your hands as text, you can change anything in it — and that is where bugs are found.


How attackers abuse this

Parameter tampering. GET /invoice?id=1043 returns your invoice. What does id=1044 return? If it returns someone else's, that's IDOR — one of the most common serious bugs on the internet.

Header manipulation. Set X-Forwarded-For: 127.0.0.1 and some applications believe the request originated locally, bypassing IP restrictions.

Method switching. An endpoint blocks GET but permits PUT because nobody tested it.

Version disclosure. Server: Apache/2.4.29 tells an attacker exactly which CVEs to look up.

Verbose errors. A 500 response containing a stack trace can reveal file paths, framework versions, and sometimes database queries — a genuine map of the application's internals.

Cookie theft. A session cookie without the HttpOnly flag can be stolen by JavaScript, which is what makes XSS so severe.


Common mistakes

"HTTPS means the application is secure." HTTPS encrypts data in transit. The application logic behind it can be riddled with flaws. Encryption protects the channel, not the code.

"The browser controls what gets sent." The browser is just one client. Anyone can craft any HTTP request with any headers, any method, any values, using curl or Burp Suite. Never trust the client is the single most important principle in web security — and this is why.

"Hidden form fields are hidden." <input type="hidden" name="price" value="999"> is fully visible in the page source and fully editable before submission. If the server trusts it, you can buy things for ₹1.


Check yourself

  1. What's the practical difference between a 401 and a 403 when you're probing an application?
  2. Why is HttpOnly on a session cookie important?
  3. A form has a hidden field setting the item price. Why is that a serious bug, and what should the server do instead?
Answers
  1. 401 means you're not authenticated — the server doesn't know who you are. 403 means you are authenticated but lack permission. When probing, a 403 often confirms a resource exists, whereas a 404 would have concealed it — useful for mapping hidden functionality.
  2. HttpOnly prevents JavaScript from reading the cookie. Without it, any XSS vulnerability becomes full session theft — an attacker's injected script can read the cookie and impersonate the user without ever needing their password.
  3. Anything sent by the client can be modified before it reaches the server. An attacker changes the price to 1 and submits. The server must look up the authoritative price from its own database and ignore whatever the client claims.

Your lab

Challenge 02 — Read a URL like an attacker

You'll be given a URL with several parameters. Identify what each one does, and find the one that shouldn't be user-controlled.

→ Open Stage 0 labs


Summary in your language

தமிழ் சுருக்கம் (Tamil summary)

HTTP என்றால் என்ன?

HTTP என்பது browser-க்கும் server-க்கும் இடையிலான ஒரு text உரையாடல். Browser ஒரு request அனுப்புகிறது, server ஒரு response திருப்பி அனுப்புகிறது. ஒவ்வொரு web vulnerability-ம் இந்த உரையாடலுக்குள் தான் இருக்கிறது.

Request-ல் என்ன இருக்கும்?

  • Method — என்ன செய்ய வேண்டும்: GET (பெற), POST (அனுப்ப), PUT, DELETE
  • Path — என்ன வேண்டும்: /profile?id=42
  • Headers — Host, User-Agent, மற்றும் Cookie (நீங்கள் யார் என்பதற்கான அடையாளம்)

முக்கியமான status codes:

  • 2xx — வெற்றி (200 OK)
  • 3xx — வேறு இடத்துக்கு redirect
  • 4xx — உங்கள் பக்கத் தவறு: 401 = நீங்கள் யார் என்று தெரியவில்லை, 403 = தெரியும், ஆனால் அனுமதி இல்லை, 404 = இல்லை
  • 5xx — server பக்கத் தவறு

HTTP-க்கு நினைவாற்றல் இல்லை (stateless). அதனால் தான் login செய்த பிறகு server ஒரு cookie கொடுக்கிறது. அந்த cookie தான் உங்கள் அடையாளம் — அதைத் திருடினால் password இல்லாமலேயே உள்ளே நுழையலாம்.

மிக முக்கியமான பாடம்: Client-ஐ ஒருபோதும் நம்பக் கூடாது.

Request-ல் உள்ள அனைத்தையும் — parameters, headers, hidden fields — பயனர் மாற்ற முடியும். உதாரணமாக id=1043-ஐ id=1044 என்று மாற்றும்போது வேறொருவரின் தரவு தெரிந்தால், அது IDOR என்ற bug. அதனால் server ஒவ்வொரு request-ஐயும் தானே சரிபார்க்க வேண்டும்.

இப்போதே செய்யுங்கள்: ஏதாவது website-ல் F12 → Network tab → page-ஐ reload செய்யுங்கள். ஒவ்வொரு HTTP request-ஐயும் பார்க்கலாம்.

கவனிக்க: உங்களுக்குச் சொந்தமில்லாத website-களில் parameters-ஐ மாற்றி மற்றவர்களின் தரவை அணுகுவது சட்டவிரோதம். பயிற்சிக்கு எங்கள் labs-ஐ மட்டும் பயன்படுத்துங்கள்.

हिंदी सारांश (Hindi summary)

HTTP क्या है?

HTTP browser और server के बीच एक text में होने वाली बातचीत है। Browser एक request भेजता है, server एक response वापस भेजता है। हर web vulnerability इसी बातचीत के अंदर छिपी होती है।

Request में क्या होता है?

  • Method — क्या करना है: GET (लेना), POST (भेजना), PUT, DELETE
  • Path — क्या चाहिए: /profile?id=42
  • Headers — Host, User-Agent, और Cookie (आप कौन हैं, इसकी पहचान)

ज़रूरी status codes:

  • 2xx — सफल (200 OK)
  • 3xx — किसी और जगह redirect
  • 4xx — आपकी तरफ़ की ग़लती: 401 = आप कौन हैं पता नहीं, 403 = पता है, लेकिन अनुमति नहीं, 404 = मौजूद नहीं
  • 5xx — server की तरफ़ की ग़लती

HTTP की कोई याददाश्त नहीं होती (stateless)। इसीलिए login के बाद server एक cookie देता है। वही cookie आपकी पहचान है — उसे चुरा लिया जाए तो बिना password के अंदर पहुँचा जा सकता है।

सबसे ज़रूरी सबक: Client पर कभी भरोसा मत करो।

Request की हर चीज़ — parameters, headers, hidden fields — user बदल सकता है। जैसे id=1043 को id=1044 करने पर किसी और का data दिख जाए, तो यह IDOR नाम का bug है। इसलिए server को हर request ख़ुद जाँचनी चाहिए।

अभी करके देखें: किसी भी website पर F12 → Network tab → page reload करें। आपको हर HTTP request दिखेगी।

ध्यान दें: जो websites आपकी नहीं हैं, उन पर parameters बदलकर किसी और का data देखना ग़ैरक़ानूनी है। अभ्यास के लिए सिर्फ़ हमारे labs का इस्तेमाल करें।

Want this summary in Malayalam, Telugu, Kannada or another language? Tell us — the most requested languages get added next.


What's next

You can read the conversation. But how did example.com become an IP address in the first place? DNS — the internet's phone book, and a surprisingly rich source of both recon and attacks.

→ Lesson 4: DNS in plain English