HTTP Fundamentals
Every attack in the web area, be it SQLi, IDOR or SSRF, is a modified HTTP request and a careful reading of the response. If you know what each part of a request does, you know what to touch in Burp and why; if not, you’re just copying payloads. This page is the language: how a request is written, how a response is read, and where state lives in a protocol that has none.
Concepts
Section titled “Concepts”Request and response
Section titled “Request and response”A request has four parts: the request line (method, path, version), headers, a blank line and an optional body.
POST /api/login HTTP/1.1Host: app.example.localUser-Agent: Mozilla/5.0Content-Type: application/x-www-form-urlencodedContent-Length: 25Cookie: sid=9f2c41
user=admin&pass=Test1234!The response follows the same pattern: status line, headers, blank line and body.
HTTP/1.1 302 FoundServer: nginx/1.24.0Set-Cookie: sid=a71be0; Path=/; HttpOnly; Secure; SameSite=LaxLocation: /panelContent-Length: 0The blank line matters: it separates headers from body. Injecting a line break into a header the server builds from your input is the basis of CRLF injection.
Stateless
Section titled “Stateless”HTTP remembers nothing between one request and the next. Each request is independent, so the application has to recognise the user on every one. It does so with something the client always sends back:
| Mechanism | How it travels | Where the state lives |
|---|---|---|
| Session cookie | Cookie: sid=... |
On the server; the cookie is just an identifier. |
| Token (e.g. JWT) | Authorization: Bearer ... or in a cookie |
Inside the token itself, signed. |
| HTTP Basic authentication | Authorization: Basic base64(user:password) |
Nowhere: credentials on every request. |
Stealing or predicting that value means stealing the session. See sessions and JWT.
Methods
Section titled “Methods”| Method | What it’s for | What to look at as an attacker |
|---|---|---|
| GET | Fetch a resource. Parameters in the URL. | Parameters visible in logs and history; IDs for IDOR. |
| POST | Send data or create something. | Forms, login, uploads; parameters the front end doesn’t show. |
| PUT | Replace a whole resource. | If allowed without checks, it sometimes lets you write files. |
| PATCH | Modify part of a resource. | Mass assignment: adding fields you shouldn’t be able to touch. |
| DELETE | Delete. | Broken access control. |
| HEAD | Like GET, without the body. | Quick fingerprinting; sometimes bypasses checks written only for GET. |
| OPTIONS | Ask which methods a resource accepts (and CORS preflight). | Verbs the documentation doesn’t mention. |
A method being “read-only” is a convention, not a guarantee: if the application changes data on a GET, that GET can also be forced from another site.
Status codes
Section titled “Status codes”| Range | Meaning | Offensive reading |
|---|---|---|
| 2xx | Success | 200 for something that shouldn’t exist: check whether it’s a disguised “not found”. |
| 3xx | Redirect (Location) |
Some apps send the full body of the protected page before redirecting: look at it in Burp, not in the browser. |
| 401 | Not authenticated | You need to identify yourself. |
| 403 | Authenticated or not, no permission | Usually hints that something is there, but doesn’t prove it: a proxy or rule may return 403 for any path. Compare it with a made-up path; if it differs, try other methods, headers and path variants. |
| 404 | Doesn’t exist (or so it says) | Some apps return 404 for what they won’t let you see. |
| 405 | Method not allowed | The resource exists with another verb. |
| 5xx | Server error | If it shows up when you touch a parameter, your input broke something: possible injection. |
Headers that matter
Section titled “Headers that matter”| Header | What it’s for | Why you care |
|---|---|---|
Host |
Which site you want from that IP | One IP can serve several sites (vhosts); changing it opens others. See Host header. |
Content-Type |
Body format | The server decides how to parse based on it; changing it sometimes changes behaviour. |
Cookie · Set-Cookie |
Send · set cookies | Session, security flags. |
Authorization |
Credentials or token | What must be kept (or tampered with) on every request. |
Location |
Redirect target | Open redirects; leaked internal paths. |
Server · X-Powered-By |
Server software | Technology and sometimes the exact version. |
X-Forwarded-For |
Original IP behind a proxy | “Localhost only” logic that trusts it. |
Origin · Referer |
Where the request comes from | CSRF and CORS checks. |
Security headers (CSP, HSTS, X-Frame-Options…) have their own page: security headers.
Cookies and their attributes
Section titled “Cookies and their attributes”| Attribute | Effect |
|---|---|
HttpOnly |
JavaScript can’t read it. An XSS can’t steal it directly (though it can act with it). |
Secure |
Only sent over HTTPS. |
SameSite |
Strict: never on cross-site requests. Lax: only on top-level GET navigation. None: always (requires Secure). Decides whether CSRF is viable. |
Domain · Path |
Which domains and paths it’s sent to. A broad Domain shares it with every subdomain. |
Expires · Max-Age |
When it expires. Without them, it dies when the browser closes. |
URLs and encoding
Section titled “URLs and encoding”https://user@app.example.local:8443/api/items?id=42&order=asc#detail└scheme┘ └info┘└──────host──────┘└port┘└─path──┘└───query────┘└fragment┘- The fragment (
#...) is never sent to the server: only the browser uses it. - Special characters are sent with percent-encoding: space
%20(or+in forms),&%26,=%3D,/%2F,'%27. If a payload “doesn’t work”, it’s often because an unencoded character breaks the request. - In a normal form the body is
key=value&key2=value2(application/x-www-form-urlencoded); in an upload,multipart/form-data; in an API,application/json.
HTTPS and interception
Section titled “HTTPS and interception”HTTPS is HTTP inside TLS (port 443): it encrypts, protects integrity and authenticates the server with a certificate. On the network it can’t be read or modified. A proxy like Burp intercepts it because your browser trusts Burp’s CA: Burp decrypts, shows you the request and re-encrypts it towards the server. If an application pins the certificate (certificate pinning, common on mobile), that trust isn’t enough.
Versions
Section titled “Versions”HTTP/1.1 is plain text, one request after another per connection. HTTP/2 is binary and multiplexes many requests over one connection; HTTP/3 does the same over QUIC (UDP). Burp shows everything as text, but parsing differences between versions, and between proxies and servers, are the root of request smuggling.
In practice
Section titled “In practice”# See the response with headerscurl -i https://app.example.local/
# See the whole exchange (including the TLS negotiation)curl -sv https://app.example.local/ -o /dev/null
# Pick method, headers, cookie and bodycurl -i -X POST https://app.example.local/api/login \ -H 'Content-Type: application/json' \ -b 'sid=9f2c41' \ -d '{"user":"admin","pass":"Test1234!"}'
# Encode a parameter without worrying about special characterscurl -i -G https://app.example.local/search --data-urlencode "q=' OR 1=1-- -"
# Which methods a resource acceptscurl -i -X OPTIONS https://app.example.local/api/items
# Follow redirects and see each hopcurl -sIL http://app.example.local/ | grep -iE '^(HTTP|location)'
# Send the request through Burp to see it in the historycurl -i -x http://127.0.0.1:8080 -k https://app.example.local/# An HTTP request by hand: it's just text over TCPprintf 'GET / HTTP/1.1\r\nHost: app.example.local\r\nConnection: close\r\n\r\n' \ | nc 10.10.10.5 80Next offensive step
Section titled “Next offensive step”- How an application is organised and where its attack surface is: web architectures.
- The end-to-end flow for attacking a web app: web methodology.
- The tool for manipulating all of this: Burp Suite.
Cheat sheet
Section titled “Cheat sheet”| Concept | What to remember |
|---|---|
| Request | Method + path + version, headers, blank line, body. |
| Stateless | Identity travels on every request: cookie, token or Basic. |
| 401 · 403 · 405 | Not authenticated · no permission (compare with a made-up path) · exists with another method. |
| 3xx | Look at the body before following the redirect. |
| 5xx when touching a parameter | Your input broke something: possible injection. |
Host |
Picks the site within the IP. Vhosts. |
| HttpOnly · Secure · SameSite | JS can’t read it · HTTPS only · when it’s sent cross-site. |
Fragment # |
Never reaches the server. |
| Percent-encoding | %20 %26 %3D %27. If the payload fails, encode it. |
| Burp and HTTPS | Works because you trust its CA. |
Review questions
Section titled “Review questions”-
HTTP is stateless. How does the server know who you are on the next request?
Answer
Because the client sends back on every request an identifier (session cookie) or a token (for example in
Authorization: Bearer) that the server recognises. -
What’s the practical difference between a 401 and a 403, and what do you do with a 403?
Answer
401: you need to authenticate. 403: access is denied, which usually suggests the resource exists but doesn’t prove it (a proxy or rule may answer 403 to any path). First compare it with the response to a made-up path; if it’s different, you try other methods, headers (
X-Forwarded-For,X-Original-URL) and path variants. -
A session cookie has
HttpOnly. Which attack does it make harder and which not?Answer
It makes stealing the cookie with XSS harder (
document.cookiecan’t see it). It doesn’t stop the XSS from making requests as the user, nor does it protect against CSRF; that’s whatSameSiteis for. -
Why might a payload containing
&in a GET parameter not reach the server intact?Answer
Because
&separates parameters in the query string: the server cuts the value there. It must be encoded as%26. -
You open
/adminand the browser takes you to the login. What do you check before giving up?Answer
The original 3xx response in Burp or with
curl -i: if the body contains the admin page, the server generated it anyway and only the redirect hides it from you. -
Why can Burp read HTTPS traffic when an attacker on the network can’t?
Answer
Because you installed Burp’s CA in your browser, so you accept the certificates Burp generates. An attacker on the network has no CA the victim trusts.