Skip to content
Tutorials Center
My learning

Topics

Lesson 30 of 38 ยท Web, Network and Cloud Testing

Web Testing Workflow, Proxies and Security Headers

Learn the intercepting-proxy workflow for web tests, and how to audit security headers, cookie flags and JWT tokens, with runnable stand-ins and clear fixes.

A web penetration test is mostly reading and replaying HTTP traffic. Every page load, form submit and API call is a request and a response. If you can see them, change them and send them again, you can test how the server really behaves instead of how the interface wants you to behave. Testers do this with an intercepting proxy, a program that sits between the browser and the application.

This lesson explains the workflow and then builds checkers for the things a tester inspects in nearly every response: security headers, cookie attributes and tokens. The proxy tools are described read-only (the site cannot run them); the checkers run on sample responses you can edit. For a tool tour, see the Burp Suite workflow lesson, and use any proxy only against targets you are authorized to test.

The proxy workflow

  1. Configure the browser to use the proxy (for example 127.0.0.1:8080) and install the proxy's test certificate in a test browser profile so it can read HTTPS traffic.
  2. Browse the whole application normally, with each role. The proxy builds a site map and history of every request.
  3. Send interesting requests to a repeater: change one parameter, resend, compare responses.
  4. Intercept when needed: pause a request, edit it, then forward it.
  5. Use automated attack tools carefully (parameter fuzzing, ID enumeration) with rate limits so you do not harm the app.
  6. Save evidence from the history: the raw request and response.
flowchart LR
    B["Browser"] --> P["Intercepting proxy<br/>127.0.0.1:8080"]
    P --> A["Application"]
    A --> P
    P --> B
    P --> H["History, repeater, site map"]

The proxy sees both directions, which lets you review and alter requests.

Keep a test browser profile just for proxying. Never route your normal browsing, banking or email through a testing proxy, and remove the proxy certificate when the engagement ends.

What to read in a response

A response has a status line, headers and a body. Several headers exist purely for security:

Header Purpose
Strict-Transport-Security (HSTS) Tell browsers to use HTTPS only
Content-Security-Policy Limit where scripts, styles and frames may load from
X-Content-Type-Options: nosniff Stop browsers guessing content types
X-Frame-Options or CSP frame-ancestors Prevent clickjacking by blocking framing
Referrer-Policy Limit what URL is leaked in the Referer header
Permissions-Policy Restrict browser features such as camera or geolocation
Cache-Control Keep sensitive pages out of shared caches
Server, X-Powered-By Information leaks: version numbers help attackers choose exploits

A missing header is usually a low or informational finding by itself. What matters is the combination and the app: a missing CSP on an application that also has XSS raises the importance of both.

Python Audit response security headers

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The audit reports four missing headers, two disclosure lines and a caching note. Notice that the stand-in only checks presence; a real review also reads the values (a CSP of script-src * offers little protection).

Cookies and sessions

Session cookies carry the user's identity, so their attributes matter:

  • Secure: sent only over HTTPS.
  • HttpOnly: not readable by JavaScript, limiting theft through XSS.
  • SameSite (Lax or Strict): limits cross-site sending, reducing cross-site request forgery (CSRF).
  • Expiry: short for sessions with sensitive data; the server must invalidate sessions on logout.
  • Name and value: session identifiers must be long and unpredictable, and change after login (preventing session fixation).
Python Check Set-Cookie attributes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Only cookies that carry identity or state are flagged hard; a theme cookie does not need the same protection. Findings should name the cookie and explain the consequence (for example "script injection could read this token").

Tokens and JWTs

Many modern applications use JSON Web Tokens (JWT): three Base64URL parts separated by dots (header.payload.signature). The header and payload are only encoded, not encrypted, so anyone can read them, and the server must verify the signature and check claims. Testers look for:

  • Sensitive data in the payload (it is readable by anyone).
  • The alg header: a token with "alg": "none" or a server that accepts it means signatures are not enforced.
  • Missing or very long exp (expiry), missing aud and iss checks.
  • Weak signing secrets for HS256 tokens, and tokens kept in localStorage where XSS can read them.
Python Inspect a JWT without verifying it

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The sample is a made-up token. In a real test you would take tokens issued to your own test account, decode them like this, then ask the server with a changed header or payload whether it still accepts them. A server that accepts a modified or unsigned token has a serious authentication flaw.

Rate limits, errors and information leaks

Also check: verbose error pages with stack traces or SQL, exposed files (.git, backups, admin panels), directory listing, and missing rate limits on login and password-reset endpoints (test gently, on a test account). Each is small, but together they tell an attacker how the system is built.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does an intercepting proxy let a tester do?

    That visibility is how a tester checks server-side behaviour independently of what the interface allows.
  2. 2. Which cookie attribute stops JavaScript from reading a session cookie?

    HttpOnly hides the cookie from scripts, limiting theft through XSS.
  3. 3. A JWT payload contains an email and role. Why is that worth noting?

    Base64URL is encoding, not encryption. Sensitive data should not be in the payload unless the token is encrypted.
  4. 4. What does the Server: Apache/2.4.49 header leak?

    Version banners should be minimized, though patching is the real fix.

Summary

  • Web testing is about reading and replaying HTTP; an intercepting proxy in a dedicated test profile makes that possible.
  • Check security headers, but judge them in context and read their values, not just presence.
  • Session cookies need Secure, HttpOnly and SameSite, and identifiers must change at login.
  • JWTs are readable by anyone; verify that servers enforce signatures, expiry and audience.
  • Report information leaks and missing rate limits as small findings that add up.

Next: Network segmentation, firewalls and wireless testing