Understand exactly what happens from the moment you type a URL to the instant a page renders. Every critical bypass, injection flaw, and logic vulnerability you will ever discover lives inside this transactional chain. This module builds the mental model that powers all future attack thinking.
When you type https://example.com/login and press Enter, the system executes a precise multi-layer sequence. Understanding this at a technical depth is non-negotiable — every attack class maps directly to one or more steps in this chain.
example.com into a routable IP address (e.g., 93.184.216.34). See the DNS deep-dive below.SYN → server responds SYN-ACK → client completes with ACK. This establishes a reliable transport channel on port 443.HTTP
GET /profile HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
Cookie: session_id=xyz123
Accept: text/html
As a security analyst, you operate almost entirely inside Steps 5 and 6. This is where parameter mutation, header injection, cookie tampering, and business logic subversions are deployed. Steps 2 and 4 matter for subdomain takeover and certificate pinning bypass research.
DNS is the internet's phone book. It resolves human-readable domain names to machine-routable IP addresses. Understanding this process reveals multiple attack surfaces: DNS Hijacking, Subdomain Takeover, DNS Cache Poisoning.
| Record | Purpose | Security Relevance |
|---|---|---|
A |
Maps domain → IPv4 address | Primary attack surface for DNS hijacking |
AAAA |
Maps domain → IPv6 address | Same as A; IPv6 often overlooked in WAF rules |
CNAME |
Alias — maps subdomain to another domain | High Subdomain takeover if CNAME target is unclaimed |
MX |
Mail exchange server for domain | Email spoofing attacks; SPF/DKIM/DMARC bypass research |
TXT |
Free-form text (SPF, DKIM, site verification) | Often leaks internal tooling info (Google, AWS verify tokens) |
NS |
Points to authoritative nameservers | Entire domain takeover if NS provider account is unregistered |
PTR |
Reverse DNS — IP → domain | Useful in recon to map server infrastructure |
A company creates a CNAME record: staging.example.com → somecompany.github.io. Later they delete the GitHub Pages project but forget to remove the DNS record. An attacker claims somecompany.github.io and now controls content served at staging.example.com. This is a legitimate, often critical bug bounty finding.
Tool: subjack, nuclei -t takeovers/, or manual CNAME resolution → check if target is unclaimed.
Before any HTTP data is exchanged, the transport layer must be established. For HTTPS, this is a two-part process: TCP establishes the connection, TLS secures it.
TCP Handshake DiagramClient Server
| |
|──── SYN (seq=x) ────────────>| "I want to connect"
| |
|<─── SYN-ACK (seq=y,ack=x+1)─| "Acknowledged, here's my seq"
| |
|──── ACK (ack=y+1) ──────────>| "Connected."
| |
| [Connection Established] |
Certificate validation failures are real vulnerabilities. Apps that accept any certificate (common in mobile apps) are vulnerable to man-in-the-middle attacks. When bug hunting on mobile targets, check if the app implements certificate pinning — bypassing it (via Frida/Objection) is often the first step to intercepting traffic.
Secure cannot be sent over HTTPHTTPS does not mean a site is "safe" or "legitimate." It only means the connection between your browser and the server is encrypted. A phishing site on a valid domain with a TLS certificate is fully HTTPS. As a hunter, you also care about what happens inside the encrypted channel — that's where all the bugs live.
Ports are logical endpoints on a host. A server can run multiple services on one IP by using different ports. During recon, an open port is a potential attack surface. Know these by heart.
Every outbound request intercepted inside a proxy follows this precise architectural template. You need to be able to read and modify every line fluently.
Raw HTTP Request — AnnotatedPOST /api/v1/login HTTP/1.1 ← [1] Method + Path + Version
Host: app.example.com ← [2] Target virtual host
User-Agent: Mozilla/5.0 (Windows NT 10.0) ← [3] Client identification
Accept: application/json ← [4] Expected response format
Content-Type: application/json ← [5] Body format declaration
Content-Length: 47 ← [6] Body size in bytes
Authorization: Bearer eyJhbGc... ← [7] Auth token (JWT here)
Cookie: session=abc123; csrftoken=xyz ← [8] State / CSRF tokens
X-Forwarded-For: 127.0.0.1 ← [9] Custom header (often trusted blindly)
Connection: keep-alive ← [10] Persistent connection
← [11] Blank line separates headers/body
{"username":"admin","password":"secret"} ← [12] Request body (POST data)
| Header | Purpose | Attack / Bypass Potential |
|---|---|---|
Host |
Specifies target virtual host | High Host Header Injection → password reset poisoning, cache poisoning |
User-Agent |
Client software identification | WAF bypass by spoofing known bot scanners or older browsers |
Referer |
Which page triggered the request | Access control checks that rely solely on Referer are bypassable by removing/changing it |
X-Forwarded-For |
Client IP in proxy chains | High IP allowlist bypass by spoofing 127.0.0.1 or internal ranges |
Origin |
Source origin of the request | CORS misconfiguration → cross-origin data theft |
Authorization |
Carries auth credentials / tokens | JWT algorithm confusion, token leakage via Referer, weak secrets |
Content-Type |
Declares body format | Switching application/json ↔ application/x-www-form-urlencoded can bypass WAF rules or CSRF protections |
Cookie |
Session identifiers, state | Session hijacking, CSRF, cookie scope escalation |
Accept-Language |
Preferred response language | Parameter pollution; some apps have language-specific logic paths with fewer controls |
Methods declare what action is being requested on a target resource. Servers frequently misconfigure access control validation on non-standard methods.
| Method | Standard Function | Security Implication | Notes |
|---|---|---|---|
GET |
Fetch a resource. Should be read-only. | Parameters exposed in URL → logged in server logs, browser history, Referer headers | Never use GET for state-changing operations |
POST |
Submit data. Triggers state changes. | Primary vector for form-based injection, CSRF, and mass assignment | Body not logged by default (unlike GET params) |
PUT |
Create or fully replace a resource. | Critical Unauthenticated PUT → arbitrary file upload, page defacement, RCE | Check with OPTIONS if allowed |
PATCH |
Partially update a resource. | Mass assignment → updating fields the API didn't intend to expose (e.g., role, isAdmin) |
Test sending unexpected fields in body |
DELETE |
Remove a resource. | IDOR → deleting other users' resources without authorization | Should require auth + ownership check |
OPTIONS |
Query allowed methods on endpoint. | Reveals attack surface. CORS preflight — misconfiguration exposes cross-origin access | First recon step on new endpoints |
HEAD |
Like GET but returns headers only. | Fingerprint server, check resource existence without retrieving body | Useful for stealthy recon |
TRACE |
Debug — echoes request back. | Medium Cross-Site Tracing (XST) — can expose HttpOnly cookies in some configs |
Should always be disabled |
Many frameworks support method override headers: X-HTTP-Method-Override: DELETE or _method=DELETE in form data. This allows tunneling any method inside a POST request — useful when firewalls block PUT/DELETE, or when testing method-based access control logic that only validates the outer method.
Also try: switching from POST /api/user/delete to GET /api/user/delete. Poorly written authorization sometimes only validates one variant.
The server's answer carries both metadata (headers) and content (body). The headers are often more interesting than the body from a security perspective.
Raw HTTP Response — AnnotatedHTTP/1.1 200 OK ← [1] Version + Status
Date: Mon, 01 Jan 2025 12:00:00 GMT ← [2] Server timestamp
Server: nginx/1.18.0 ← [3] ⚠ Version disclosure
Content-Type: application/json; charset=UTF-8 ← [4] Body content type
Content-Length: 312 ← [5] Body size
Set-Cookie: session=abc123; Secure; HttpOnly; SameSite=Strict ← [6] Cookie flags
X-Content-Type-Options: nosniff ← [7] MIME sniff protection
X-Frame-Options: DENY ← [8] Clickjacking protection
Content-Security-Policy: default-src 'self' ← [9] XSS mitigation header
Strict-Transport-Security: max-age=31536000 ← [10] HSTS — forces HTTPS
Access-Control-Allow-Origin: https://trusted.com ← [11] CORS policy
X-Powered-By: PHP/7.4.3 ← [12] ⚠ Tech stack leak
{"status":"ok","user":{"id":42,"role":"user"}} ← [13] Response body
| Header | When Present | When Missing — Finding? |
|---|---|---|
Content-Security-Policy |
Controls which scripts/resources can load. Mitigates XSS. | Medium Noted on reports; full XSS impact unmitigated |
X-Frame-Options / frame-ancestors |
Prevents page from being embedded in iframes. | Medium Clickjacking possible if sensitive actions present |
Strict-Transport-Security |
Forces HTTPS for specified duration. | Low SSL stripping possible on first visit |
X-Content-Type-Options: nosniff |
Prevents MIME-type sniffing. | Low Browser may execute uploaded files as scripts |
Set-Cookie: HttpOnly |
Cookie inaccessible to JavaScript. | High XSS can steal session cookies |
Set-Cookie: Secure |
Cookie only sent over HTTPS. | Medium Cookie transmitted over HTTP connections |
Set-Cookie: SameSite |
Controls cross-site cookie sending. | Medium CSRF attacks become viable |
Server / X-Powered-By |
— | Info Version disclosure aids targeted exploit selection |
| Code | Meaning | Hunter Significance |
|---|---|---|
200 OK |
Success. | Confirm payloads resolved as expected. Compare response body/length for blind injection signals. |
201 Created |
Resource was created. | API created something. Check if unauthorized users can trigger this. |
204 No Content |
Success, no response body. | Common on DELETE. If a 204 appears without auth, that's an IDOR. |
301 / 302 |
Permanent / Temporary Redirect. | May drop sensitive headers across domains. Location header can leak internal paths. Open redirect hunting. |
400 Bad Request |
Malformed input. | Backend parse error triggered. Probe for injection vectors — what broke the parser? |
401 Unauthorized |
Authentication required. | No valid session. Baseline for testing auth bypass — can you reach the resource without valid creds? |
403 Forbidden |
Authenticated, but denied. | Resource exists. Try: path traversal, case variation, HTTP method switching, adding headers like X-Original-URL. |
404 Not Found |
Resource not found. | Fuzz for adjacent paths. Sometimes 404 vs 403 tells you the resource exists vs. doesn't. |
405 Method Not Allowed |
HTTP method not supported. | Server is restricting methods — try others. Check the Allow: header in response. |
429 Too Many Requests |
Rate limit triggered. | Rate limiting exists. Test for bypasses: IP rotation, header manipulation, endpoint variation. |
500 Internal Server Error |
Application threw an exception. | Your input broke backend logic. High probability injection surface. Check for stack traces in body — information disclosure. |
502 Bad Gateway |
Upstream server failed. | Infrastructure misconfiguration. Might indicate internal service is exposed at non-standard paths. |
503 Service Unavailable |
Server overloaded or down. | DoS vector confirmed if triggered by your specific input. |
A 403 Forbidden is not a dead end — it is confirmation that the resource exists and the server made an authorization decision. Common bypass techniques: prepend /./ or /%2f to the path, add headers X-Original-URL: /admin or X-Rewrite-URL: /admin, try a different HTTP method, or append %20, .json, ;.css to the path. These bypass middleware that checks the path string before forwarding.
Every URL component is a potential attack surface. Understanding each part is foundational for injection testing, path traversal, and parameter manipulation.
| Component | Attack Surface |
|---|---|
Scheme https:// |
Scheme confusion attacks. Some apps behave differently on http:// vs https://. SSRF payloads often use file://, gopher://, dict:// |
Subdomain app. |
Subdomain enumeration surface. Different subdomains may run different software, less secured code. Takeover target. |
Path /api/v1/user/profile |
Path traversal (../../etc/passwd), path confusion (/api/v1/../v2/admin), endpoint discovery (fuzz this), IDOR when path contains IDs. |
Query Params ?id=42 |
Primary injection point. SQLi, XSS, SSRF, IDOR, open redirect, template injection. Every parameter is a hypothesis. |
Fragment #settings |
Never sent to server (client-side only). DOM-based XSS — JavaScript reads location.hash and renders it unsafely. |
Every location where user-controlled input interfaces with application logic is a potential vulnerability. The query string is the most obvious, but don't ignore: path segments, HTTP headers, the request body, cookie values, and even the HTTP method itself. Attackers control all of these. Developers often only sanitize the most obvious one.
Protocol version matters. Different versions have different performance characteristics and, critically, different security behaviours and attack surfaces.
| Version | Key Characteristics | Security Notes |
|---|---|---|
HTTP/1.0 |
One request per TCP connection. No persistent connections. | Largely obsolete. Downgrade attacks may force usage. |
HTTP/1.1 |
Persistent connections, chunked transfer, virtual hosting via Host header. |
Most web apps. HTTP Request Smuggling attacks work here. Head-of-line blocking. |
HTTP/2 |
Binary framing, multiplexing, header compression (HPACK), server push. | High HTTP/2 Request Smuggling via H2-to-H1 downgrade proxies. Header injection via pseudo-headers. |
HTTP/3 |
Built on QUIC (UDP-based). Eliminates TCP head-of-line blocking. TLS 1.3 built in. | Emerging attack surface. UDP firewall rules often more permissive. New smuggling research. |
When a front-end proxy speaks HTTP/2 to a back-end that only understands HTTP/1.1, protocol translation occurs. Discrepancies in how each server interprets the end of a request body (Content-Length vs Transfer-Encoding: chunked) allow an attacker to "smuggle" a hidden second request inside a legitimate one — poisoning the back-end's request queue and hijacking other users' responses. This is covered deeply in Chapter 10.
Understanding the render pipeline is critical for DOM-based XSS, CSP bypass, and understanding where JavaScript execution contexts exist.
<script> tag with no defer or async blocks parsing and executes immediately.HttpOnly), make fetch requests to APIs, and redirect the page. This is the primary XSS execution environment.DOM-Based XSS — Conceptual Example// Vulnerable JavaScript:
const name = location.hash.slice(1); // reads URL fragment
document.getElementById('msg').innerHTML = name; // ← sinks into innerHTML
// Attacker sends:
https://example.com/page#<img src=x onerror=alert(document.cookie)>
// Result: JavaScript executes in victim's browser context
// No server interaction required — purely client-side
In DOM-based vulnerabilities, data flows from a source (attacker-controlled input: location.hash, location.search, document.referrer, postMessage) to a sink (dangerous function: innerHTML, eval(), document.write(), location.href). If you can control the source and it reaches a dangerous sink without sanitization, you have DOM XSS. This mental model applies to all client-side injection classes.
The Same-Origin Policy (SOP) is the browser's primary isolation mechanism. Understanding it is foundational for XSS, CSRF, and CORS vulnerability classes.
Two URLs are the same origin if and only if they share the same: scheme + hostname + port.
Example: https://example.com:443 vs https://sub.example.com:443 → different origin (different hostname). https://example.com:443 vs http://example.com:80 → different origin (different scheme + port).
| URL A | URL B | Same Origin? | Reason |
|---|---|---|---|
https://example.com/a |
https://example.com/b |
✓ YES | Same scheme, host, port |
https://example.com |
http://example.com |
✗ NO | Different scheme |
https://example.com |
https://sub.example.com |
✗ NO | Different hostname |
https://example.com |
https://example.com:8443 |
✗ NO | Different port |
SOP restricts JavaScript from reading responses from cross-origin requests. CORS (Cross-Origin Resource Sharing) is the mechanism that selectively relaxes SOP. Misconfigured CORS is a high-severity finding — it allows attacker-controlled origins to read authenticated responses. This is covered in depth in Chapter 4.
Complete all five verification drills before advancing to Chapter 2. Each builds foundational muscle memory for proxy interception work.