Skip to content
ShankarStack

Networking for security testers

HTTP and HTTPS fundamentals

Hands-on lab linked to this lesson

Launch the xss sandbox

The web runs on HTTP, and the overwhelming majority of modern attack surface is HTTP-based. If you can read a request and response fluently — and understand how TLS secures them — you can reason about most web security questions.

HTTP is a simple conversation

HTTP is a request/response protocol: the client sends a request, the server returns a response. That's it. Everything on the web — logins, payments, APIs — is built on this simple exchange, which is exactly why reading it fluently is so powerful.

Anatomy of a request

POST /login HTTP/1.1
Host: shop.example.com
Content-Type: application/x-www-form-urlencoded
Cookie: session=abc123

username=ada&password=secret
  • Method (POST) — the action being requested.
  • Path (/login) — the resource.
  • Headers — metadata: which host, content type, cookies, auth tokens, user agent.
  • Body — the data being sent (here, form fields).

Anatomy of a response

HTTP/1.1 302 Found
Location: /dashboard
Set-Cookie: session=def456; HttpOnly; Secure; SameSite=Lax

(redirect — no body)
  • Status line — the result (here 302, a redirect).
  • Headers — including Set-Cookie, security headers, caching directives.
  • Body — the HTML, JSON or other content.

Methods and what they imply

  • GET — retrieve a resource. Should be safe (no side effects) and is often logged and cached, so it must never perform state changes.
  • POST — submit data / create. Has side effects.
  • PUT / PATCH — update. DELETE — remove.

An important security idea lives here: safe methods must be side-effect free. A state-changing action on a GET is a classic CSRF enabler.

Status codes

  • 2xx success (200 OK, 201 Created)
  • 3xx redirection (301, 302)
  • 4xx client error (401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests)
  • 5xx server error (500, 502)

Status codes are signals: a 403 where you expected 404 can reveal that a resource exists but is protected; a flood of 500s can indicate you've hit something fragile.

How state is carried

HTTP is stateless — each request is independent. Applications add state with cookies and tokens (in headers). The server uses these to recognise "who" is making each request. Understanding exactly how identity is carried is the foundation of testing authentication, sessions and access control.

The trust boundary — the single most important idea

Everything the client sends — URL, headers, cookies, body, even "hidden" fields and client-side validation — is fully under the user's control and can be changed. The server must therefore never trust any of it without verification. Most web vulnerabilities are, at heart, a server trusting something it shouldn't. Burn this into your thinking: the client is untrusted.

HTTPS and TLS

HTTPS is HTTP inside a TLS-encrypted channel. TLS provides three guarantees:

  1. Confidentiality — eavesdroppers can't read the traffic.
  2. Integrity — the traffic can't be silently altered in transit.
  3. Identity — the server proves who it is via a certificate signed by a trusted authority.

When you assess a site you'll check that TLS is enforced everywhere, that certificates are valid and current, and that weak, outdated protocol versions or ciphers aren't allowed.

Practise reading real traffic

Open your browser's developer tools (Network tab), or an intercepting proxy, and watch the requests a normal action produces. Notice how cookies and tokens travel, how the same endpoint responds differently to different inputs, and where the client is trusted. This habit makes every later web lesson faster and more intuitive.

Key takeaways

  • HTTP is a request/response conversation of methods, paths, headers and bodies.
  • Safe methods (GET) must have no side effects.
  • Status codes are signals worth reading carefully.
  • State is carried in cookies and tokens; the server identifies users from them.
  • The client is always untrusted — most web bugs are a server trusting client-controlled data.
  • HTTPS/TLS provides confidentiality, integrity and server identity.

Practice safely

Apply this in the xss lab — an isolated, sandboxed target created just for you. Only ever test systems you own or are explicitly authorised to assess.

Reporting mindset: for every observation, record what you did, what you saw, the business impact, and a clear, verifiable remediation. Evidence and clear writing are what turn testing into value.

This is a free preview. Sign in to track progress and unlock the full course.

Sign in