What Is HTTP?
How HTTP requests and responses work on the wire, and where the classic web vulnerabilities start.
Every time you click a link, submit a form, or call an API, your browser and a server have a conversation. HTTP (Hypertext Transfer Protocol) is the language they speak.
As a software engineer, HTTP is the foundation of the apps you build. As a bug bounty hunter, it is your primary attack surface. Most developers only interact with HTTP through high level tools like fetch(), Axios, or Postman, rarely looking at what actually travels over the wire. Learning to read raw HTTP is what separates guessing at bugs from systematically finding them.
Only test what you are allowed to test. Every technique in this post is for your own lab, or for targets that are in scope of a bug bounty or vulnerability disclosure program. Read the scope and rules before you send a single request.
1. The URL and the Scheme
Before a request is sent, the client needs to know where to send it and how. That’s what a URL defines:
https://api.example.com:443/v1/users/42?role=admin#profile
└─┬─┘ └──────┬──────┘└─┬┘└─────┬────┘└────┬────┘└───┬──┘
Scheme Host Port Path Query Fragment
- Scheme (
http://orhttps://): Tells the client which protocol to use.httpsends data in plaintext (anyone on the network can read it);httpswraps it in TLS (it encrypts the traffic, detects tampering, and verifies the server’s identity). - Host & Port: The server’s domain name (or IP address) and the port listening for traffic (defaults are
80for HTTP,443for HTTPS). - Path: The specific resource you’re asking for (e.g.,
/v1/users/42). - Query String: Key and value pairs after the
?used for filtering, sorting, or passing parameters. - Fragment (
#profile): Handled entirely by your browser to jump to a section of the page. It is never sent to the server.
Bug Bounty Angle: Paths and query parameters are where many classic OWASP vulnerabilities start:
- IDOR (Insecure Direct Object Reference): Also called BOLA (Broken Object Level Authorization) in API contexts. Accessing someone else’s data just by changing an ID in the URL, like swapping
/v1/users/42to/v1/users/43and seeing another user’s profile.- Reflected XSS (Cross-Site Scripting): Injecting malicious JavaScript into a query parameter (e.g.,
?search=<script>...) that the server blindly echoes back into the page, executing it in a victim’s browser.- SQLi (SQL Injection): Slipping database commands into a parameter (e.g.,
?id=42' OR 1=1--) to trick the backend database into leaking or modifying data. Careful: ifOR 1=1lands in anUPDATEorDELETE, it can hit every row. (The payload is shown decoded; URL encode it when sending.)- SSRF (Server-Side Request Forgery): Passing an internal URL into a parameter (e.g.,
?avatar_url=http://169.254.169.254/latest/meta-data/) to trick the server into making HTTP requests to internal addresses the attacker cannot reach directly. The metadata example works where the older IMDSv1 is still enabled, because IMDSv2 requires a session token.
2. The HTTP Request
HTTP is a request and response protocol. The client starts the conversation by sending a text based (in HTTP/1.1) message with four parts:
POST /v1/users/42/update HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
Content-Type: application/json
Content-Length: 47
{"email": "hunter@example.com", "role": "user"}
A. The Request Line
POST /v1/users/42/update HTTP/1.1
- Method (Verb): Defines the action. Common methods are
GET(read),POST(create/submit),PUT/PATCH(update),DELETE(remove),OPTIONS(check allowed methods), andHEAD(fetch headers only). - Request Target: Usually the path and query string.
- Protocol Version:
HTTP/1.1(human readable text),HTTP/2(binary, running many requests concurrently over one connection), orHTTP/3(runs over QUIC/UDP for better performance on flaky networks).
B. Request Headers
Key and value pairs that pass metadata about the request:
Host: Required in HTTP/1.1 so servers hosting multiple websites know which domain you want.Authorization/Cookie: Proves who you are. Because HTTP is stateless (the server doesn’t inherently remember your last request), your browser or app must resend your session token on every single call.Content-Type: Tells the server how to parse the request body (e.g.,application/json,application/x-www-form-urlencoded, ormultipart/form-datafor file uploads).
C. The Blank Line
An empty line separates the headers from the body. Each line ends with \r\n, so on the wire you see \r\n\r\n: the end of the last header, then the empty line.
D. The Request Body
The actual payload sent to the server, like JSON data, form inputs, or files. GET and HEAD requests normally don’t have a body; POST, PUT, and PATCH do.
Bug Bounty Angle:
- HTTP Verb Tampering: If
POST /admin/deletereturns403 Forbidden, try switching it toGET,PUT, orPATCH. Misconfigured access controls sometimes only block specific methods. A bypass can really delete data, so only try this against test objects you own.- Mass Assignment: In the JSON body above, what happens if you change
"role": "user"to"role": "admin"? If the backend blindly binds the entire request body to a database model without filtering allowed fields, you just escalated your privileges.- HTTP Request Smuggling: A high impact vulnerability where a front end server (like a CDN or load balancer) and a back end server disagree on where one HTTP request ends and the next begins, usually by abusing conflicting
Content-LengthandTransfer-Encodingheaders. This lets an attacker “smuggle” a hidden request into another user’s traffic. A modern variant abuses HTTP/2 downgrading, where the front end speaks HTTP/2 to clients but rewrites requests as HTTP/1.1 for the back end. Testing this on a live target can break other users’ requests. Practice in a lab, and check that the program explicitly allows it.
3. The HTTP Response
Once the server processes your request, it sends back a response with a mirror structure:
HTTP/1.1 200 OK
Date: Sat, 21 Nov 2026 15:44:00 GMT
Content-Type: application/json; charset=utf-8
Set-Cookie: session_id=abc123xyz; HttpOnly; Secure; SameSite=Lax
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Length: 52
{"status": "updated", "email": "hunter@example.com"}
A. The Status Line
HTTP/1.1 200 OK
Includes the protocol version, a three digit Status Code, and a short reason phrase (optional in HTTP/1.1, and gone in HTTP/2). Status codes fall into five buckets:
- 1xx (Informational): An interim response or a protocol switch (e.g.,
100 Continue,101 Switching Protocolsfor WebSockets). - 2xx (Success): Everything worked (
200 OK,201 Created,204 No Content). - 3xx (Redirection): Go somewhere else (
301 Moved Permanently,302 Found). - 4xx (Client Error): You messed up (
400 Bad Request,401 Unauthorized(really “unauthenticated”),403 Forbidden,404 Not Found,429 Too Many Requests). - 5xx (Server Error): The server messed up (
500 Internal Server Error,502 Bad Gateway,503 Service Unavailable).
B. Response Headers
Metadata sent back by the server. From a security standpoint, this is where browser level defenses live:
Set-Cookie: Issues session tokens. Look for three flags:HttpOnly(stops JavaScript from reading the cookie, although injected script can still send requests as the user),Secure(only sends the cookie over HTTPS), andSameSite(helps block CSRF).- Security Headers: Rules the server tells the browser to enforce, like CSP (
Content-Security-Policy, which restricts where scripts can load from) and HSTS (Strict-Transport-Security, which forces HTTPS). CORS (Access-Control-Allow-Origin) works the other way around: browsers block cross origin reads by default (the same origin policy), and CORS headers selectively relax that. A sloppy CORS config is a vulnerability, not a defense. - Server / Tech Stack Headers: Headers like
ServerorX-Powered-Bythat often leak exact software versions.
C. The Response Body
The resource you asked for: HTML, JSON, an image, a PDF, or an error message.
Bug Bounty Angle:
- CSRF (Cross-Site Request Forgery): If a site relies on cookies for authentication and has weak or missing CSRF defenses, an attacker can trick a signed in user’s browser into sending an unwanted request (like changing their email or transferring funds) from a malicious site.
SameSitehelps but is not enough on its own:Laxcookies still travel on top levelGETnavigations, a hostile subdomain counts as the same site, and browsers differ when the attribute is missing. Use CSRF tokens too, and never change state on aGET.- 403 vs. 404: Subtle differences in status codes and
Content-Lengthlet you enumerate hidden endpoints or valid usernames.- 500 Internal Server Error: Never ignore a
500. It often means your input broke backend logic. This is a strong signal to dig deeper for injection flaws like SQLi.- Response Body Leaks: Even when the UI hides sensitive data, API responses frequently overfetch and return internal IDs, password hashes, or PII in the raw JSON.
4. Try It Yourself
You don’t need a proxy to see raw HTTP. curl -v prints both sides of the conversation, with > for what you send and < for what comes back. --http1.1 forces the text format from this post, since curl negotiates HTTP/2 over HTTPS by default:
curl -sv -o /dev/null --http1.1 https://example.com
> GET / HTTP/1.1
> Host: example.com
> User-Agent: curl/8.7.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html
< ...
The output is abbreviated, and your versions and headers will differ. Run it, then send a HEAD request with -I, or add a header with -H "X-Test: 1" and watch what changes. Do this against your own services or a lab first.
Wrapping Up
HTTP is deceptively simple: a client sends a structured text message, and a server replies with a status code, headers, and a body. Yet nearly every modern web vulnerability, from IDOR and XSS to SSRF and HTTP Request Smuggling, comes down to how browsers, proxies, CDNs, and backend servers parse and trust those exact fields.
If you want to truly learn HTTP, look beyond your browser’s DevTools. Download an intercepting proxy like Burp Suite or Caido, a tool that sits between your browser and the internet so you can pause, read, and edit raw HTTP requests in real time before they hit the server. Watching your own traffic go over the wire will make everything in this post click immediately.
For deeper reading, see RFC 9110 (HTTP Semantics), RFC 9112 (HTTP/1.1), MDN’s HTTP docs, and PortSwigger’s Web Security Academy.
Next up: cookies, sessions, and how authentication works over a stateless protocol.