- HTTP is stateless and plaintext — HTTPS adds TLS encryption on top
- Every web request has headers — they carry authentication tokens, cookies, CORS policy, and security controls
- Cookies control sessions; misconfigurations (
HttpOnly,Secure,SameSite) lead to direct exploits - Same-Origin Policy is the browser's core security boundary — CORS is the controlled way to relax it
- Understanding the request/response cycle lets you manipulate everything Burp Suite intercepts
HTTP — The Protocol Under Everything
HTTP (HyperText Transfer Protocol) is a request/response protocol. Client sends a request, server returns a response. Stateless — each request is independent.
HTTP Request Structure
POST /api/login HTTP/1.1
Host: target.com
Content-Type: application/json
Authorization: Bearer eyJhbGc...
Cookie: session=abc123
User-Agent: Mozilla/5.0 ...
Content-Length: 42
{"username": "admin", "password": "hunter2"}The blank line separates headers from the body. The body is only present on POST, PUT, and PATCH requests.
HTTP Response Structure
HTTP/1.1 200 OK
Content-Type: application/json
Set-Cookie: session=new_token; HttpOnly; Secure
X-Content-Type-Options: nosniff
Content-Length: 28
{"status": "authenticated"}HTTP Methods
| Method | Purpose | Security notes |
|---|---|---|
GET | Retrieve resource | Parameters in URL — logged, cached, leaked via Referer |
POST | Submit data | Body not in URL — but still interceptable |
PUT | Replace resource | Can overwrite files if misconfigured |
PATCH | Partial update | Same attack surface as PUT |
DELETE | Remove resource | Missing auth check > unauthorised deletion |
HEAD | GET without body | Useful for checking if resource exists |
OPTIONS | What methods allowed? | Reveals CORS policy and allowed methods |
TRACE | Echo request | Cross-Site Tracing (XST) — usually disabled |
Always check OPTIONS on interesting endpoints. Seeing PUT or DELETE allowed tells you something to test. An overly permissive CORS Access-Control-Allow-Origin: * on an API with sensitive data is a direct finding.
HTTP Status Codes
| Code | Meaning | Pentest relevance |
|---|---|---|
| 200 | OK | Success |
| 201 | Created | Object was created |
| 301/302 | Redirect | Open redirect opportunities |
| 400 | Bad Request | Input validation error — probe further |
| 401 | Unauthorised | Auth required — missing/invalid token |
| 403 | Forbidden | Auth present but insufficient — try to bypass |
| 404 | Not Found | Resource missing |
| 405 | Method Not Allowed | Try different methods |
| 429 | Too Many Requests | Rate limiting — bypass with IP rotation |
| 500 | Server Error | Application crash — look for stack traces |
| 502/503 | Gateway Error | Proxy/upstream issues |
403 and 401 behave differently. 401 means your credentials are wrong or missing. 403 means you're authenticated but not authorised. These require different bypass strategies.
HTTPS and TLS
HTTPS = HTTP + TLS (Transport Layer Security). TLS provides:
- Encryption — data is unreadable to network observers
- Authentication — server certificate proves identity
- Integrity — data cannot be modified in transit
Certificate Chain
TLS Attack Surface:
- Expired/self-signed certificates > user trust issues
- Weak cipher suites (RC4, DES, export ciphers)
- TLS 1.0/1.1 > BEAST, POODLE attacks
- Certificate pinning bypass in mobile apps
# Check TLS certificate details
openssl s_client -connect target.com:443 </dev/null
openssl s_client -connect target.com:443 </dev/null 2>/dev/null | openssl x509 -noout -text
# testssl.sh — comprehensive TLS audit
testssl.sh target.comHTTP Headers — The Security Controls Layer
Headers control browser behaviour, caching, authentication, and security policies.
Security Headers (What Good Looks Like)
| Header | Purpose | Missing = vulnerable to |
|---|---|---|
Content-Security-Policy | Controls resource loading | XSS, data injection |
X-Frame-Options | Prevents framing | Clickjacking |
X-Content-Type-Options: nosniff | Prevents MIME sniffing | Content-type confusion |
Strict-Transport-Security | Forces HTTPS | SSL stripping |
Referrer-Policy | Controls Referer header | Information leakage |
Request Headers That Matter
| Header | Purpose | Attack relevance |
|---|---|---|
Authorization | Bearer tokens, Basic auth | Token theft, brute force |
Cookie | Session management | Session hijacking |
Host | Which virtual host | Host header injection |
X-Forwarded-For | Client IP behind proxy | IP spoofing auth bypasses |
User-Agent | Browser identification | WAF fingerprinting bypass |
Content-Type | Body format | Type confusion attacks |
If an application trusts X-Forwarded-For for IP-based access control (only allow 10.0.0.0/8), adding the header X-Forwarded-For: 10.0.0.1 in your request may bypass it. This is a common misconfiguration.
Cookies — Session Management
Cookies are key-value pairs the server sets in the browser. Every subsequent request includes them automatically.
Set-Cookie: session=abc123; Path=/; Domain=target.com; HttpOnly; Secure; SameSite=Strict; Max-Age=3600session=abc123Path=/Domain=target.comHttpOnlySecureSameSite=StrictMax-Age=3600Cookie Flags
| Flag | What it does | Missing = |
|---|---|---|
HttpOnly | JS cannot read document.cookie | XSS can steal session |
Secure | Only sent over HTTPS | Cookie sent over HTTP, sniffable |
SameSite=Strict | Not sent in cross-site requests | CSRF attacks possible |
SameSite=Lax | Sent on top-level navigation | Partial CSRF protection |
SameSite=None; Secure | Always sent cross-site | Full CSRF exposure |
# Check cookies with curl
curl -c cookies.txt -b cookies.txt -L https://target.com/login \
-d "user=admin&pass=admin" -v 2>&1 | grep -i "set-cookie"Same-Origin Policy (SOP)
SOP is the browser's core security boundary. A page from https://attacker.com cannot read responses from https://bank.com — even if the victim's browser is authenticated to the bank.
Origin = scheme + hostname + port
| Request from | Target | SOP allows? |
|---|---|---|
https://a.com | https://a.com/api | Yes — same origin |
https://a.com | http://a.com/api | No — different scheme |
https://a.com | https://b.com/api | No — different hostname |
https://a.com:443 | https://a.com:8443 | No — different port |
SOP blocks JavaScript from reading cross-origin responses. It does not block cross-origin requests from being sent (which is why CSRF is possible).
CORS — Controlled SOP Relaxation
CORS (Cross-Origin Resource Sharing) lets a server explicitly permit cross-origin requests.
CORS Misconfigurations:
# Dangerous — reflects Origin header back:
Access-Control-Allow-Origin: https://attacker.com
Access-Control-Allow-Credentials: true
# Wildcard + credentials (browsers block this, but it reveals intent):
Access-Control-Allow-Origin: *If Access-Control-Allow-Credentials: true is combined with a reflected or overly permissive origin, an attacker's page can make authenticated requests to the API on behalf of the victim and read the response. This bypasses SOP entirely for API calls.
URL Structure — Every Component Matters
https://admin:secret@target.com:8443/api/v1/user?id=1&debug=true#sectionhttpsadmin:secrettarget.com8443/api/v1/userid=1&debug=true#section- Credentials in URL — logged in server logs, browser history, Referer headers. Never.
- Path traversal —
../../../etc/passwdin path parameters - Query parameters — prime injection point (SQLi, XSS, SSRF)
- Fragment — never sent to server, only in browser
HTTP/2 and HTTP/3
| Version | Transport | Key difference |
|---|---|---|
| HTTP/1.1 | TCP | One request per connection (with pipelining) |
| HTTP/2 | TCP + TLS | Multiplexed — multiple requests over one connection |
| HTTP/3 | QUIC (UDP) | Faster, no TCP head-of-line blocking |
HTTP/2 introduces new attack surface: request smuggling (H2.CL, H2.TE) where a front-end proxy and back-end server disagree on request boundaries.
Operational Notes
- Burp Suite Proxy sits between your browser and the target. Every HTTP/HTTPS request passes through it. This is your primary tool for web testing.
- `curl -v` shows full request and response headers. Use it to replicate Burp requests from the terminal.
- HTTP/2 downgrade — some servers accept HTTP/1.1 and HTTP/2. Try both. Some protections only apply to one.
- Parameter pollution — send the same parameter twice (
?id=1&id=2). Different frameworks pick different values — can bypass input validation.
What to Read Next
- Web Application Analysis — put these fundamentals to work attacking OWASP Top 10 vulnerabilities
- How Authentication Works — sessions, cookies, and tokens as attack targets
- Reconnaissance — HTTP response headers and JavaScript files leak infrastructure details