HTTP (Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer Protocol Secure) are application-layer protocols used for communication between clients and web servers.
They define how browsers request resources and how servers respond.
Almost every website on the internet depends on these protocols.
In penetration testing, understanding HTTP and HTTPS is essential because most web-based attacks happen at this layer.
HTTP is a protocol used to transfer web content between a client and a server.
It operates at:
Layer 7 (Application Layer)
Default port:
80
HTTP follows a request-response model.
This means:
- client sends request
- server sends response
HTTP is stateless.
Each request is treated independently.
HTTPS is the secure version of HTTP.
Default port:
443
HTTPS uses:
TLS (Transport Layer Security)
This encrypts communication between the client and the server.
This protects:
- confidentiality
- integrity
- authentication
Without HTTPS:
data can be intercepted more easily.
Basic process:
- User enters a URL
- DNS resolves the domain name
- TCP connection is established
- Browser sends HTTP request
- Server processes request
- Server sends HTTP response
- Browser renders content
This is how websites are loaded.
An HTTP request contains:
- Method
- Path
- Headers
- Body (optional)
Example:
GET /index.html HTTP/1.1
Host: example.com
User-Agent: Mozilla
This tells the server what resource is needed.
| Method | Purpose |
|---|---|
| GET | Retrieve data |
| POST | Submit data |
| PUT | Update data |
| DELETE | Remove data |
These methods define client actions.
Understanding them is important for web testing.
A server response contains:
- Status code
- Headers
- Body
Example:
HTTP/1.1 200 OK
Content-Type: text/html
This tells the browser the result.
| Code | Meaning |
|---|---|
| 200 | Success |
| 301 | Redirect |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Server Error |
Status codes reveal how servers respond.
This is useful during enumeration.
| Feature | HTTP | HTTPS |
|---|---|---|
| Port | 80 | 443 |
| Encryption | No | Yes |
| Security | Low | High |
| TLS | No | Yes |
HTTPS is the modern standard.
Web applications use cookies to maintain user sessions.
Example:
Set-Cookie: sessionid=abc123
This allows:
- login persistence
- session tracking
- authentication state
These are common targets in web attacks.
HTTP and HTTPS are critical in penetration testing.
Examples:
- SQL Injection
- XSS
- CSRF
- Session hijacking
- Authentication bypass
- Directory enumeration
Tools used:
- Burp Suite
- cURL
- Gobuster
Most web application attacks happen at this layer.
- HTTP enables communication between browsers and servers.
- HTTPS secures communication using TLS.
- Requests and responses form web interactions.
- Methods define client actions.
- Status codes reveal server behavior.
- Cookies maintain sessions.
HTTP and HTTPS are the foundation of web communication.
For penetration testers, understanding them is essential because they expose how applications function and where vulnerabilities can exist.
