Client-Server Architecture
Overview
The client-server model is the fundamental architecture underlying all web communication. Understanding this model is essential for OSCP because every web application vulnerability you will encounter during the exam operates within this framework. As a penetration tester, you are typically the “client” sending crafted requests to a target “server” to discover and exploit weaknesses.
Core Concepts
The Client-Server Model
In the client-server model, two distinct entities communicate over a network:
- Client: The entity that initiates requests. During OSCP, you act as the client using tools like Burp Suite, curl, sqlmap, or custom scripts.
- Server: The entity that receives, processes, and responds to requests. The target web server (Apache, Nginx, IIS) is your primary adversary.
The communication follows a request-response cycle:
- Client sends an HTTP request to the server.
- Server processes the request (may query databases, run business logic).
- Server sends an HTTP response back to the client.
- Client renders or processes the response.
Key Architectural Components
| Component | Role | Common Implementations | OSCP Relevance |
|---|---|---|---|
| Client | Sends requests, renders responses | Burp Suite, curl, wget, Python scripts | Your attack surface; you control this |
| Load Balancer | Distributes traffic across servers | HAProxy, Nginx, AWS ELB | May hide backend topology; can be bypassed |
| Web Server | Receives HTTP requests, serves content | Apache, Nginx, IIS | Primary target for web exploits |
| Application Server | Executes business logic | Tomcat, Node.js, Django, JBoss | Where vulnerabilities often reside |
| Database Server | Stores and retrieves persistent data | MySQL, PostgreSQL, MSSQL, MongoDB | Target of SQL injection, direct access |
| Reverse Proxy | Front-end for backend services | Nginx, Apache mod_proxy | Can leak internal IPs, enable SSRF |
Architecture Diagrams
Simple Two-Tier Architecture
┌──────────────┐ HTTP/HTTPS ┌──────────────┐
│ CLIENT │ ──────────────────────────> │ WEB SERVER │
│ (Browser) │ <────────────────────────── │ (Apache) │
│ Attacker │ Response (HTML/JSON) └──────┬───────┘
└──────────────┘ │
│ Query
┌────▼───────┐
│ DATABASE │
│ (MySQL) │
└────────────┘
Three-Tier Architecture (Common in OSCP Labs)
┌──────────────┐ HTTP ┌──────────────┐ Internal ┌──────────────┐
│ CLIENT │ ─────────> │ WEB SERVER │ ─────────────> │ APP SERVER │
│ (Burp) │ <───────── │ (Nginx) │ <───────────── │ (Tomcat) │
└──────────────┘ Response └──────────────┘ └──────┬───────┘
│
┌────▼───────┐
│ DATABASE │
│ (PostgreSQL)│
└────────────┘
Communication Protocols
| Protocol | Port | Encrypted? | OSCP Use |
|---|---|---|---|
| HTTP | 80 | No | Intercept with Burp, modify requests |
| HTTPS | 443 | Yes | Burp CA cert needed for interception |
| FTP | 21 | No | File transfer, anonymous access |
| SSH | 22 | Yes | Post-exploitation, pivoting |
| RDP | 3389 | Partial | Windows post-exploitation |
| SMB | 445 | Partial | Windows file sharing, exploits |
Attack Vectors
1. Direct Server Access
Concept: Bypass the load balancer or reverse proxy to directly access backend servers.
How it works:
- Load balancers distribute traffic but backend servers may be accessible on internal networks.
- If you discover an internal IP address (via error messages, SSRF, or DNS), you may access backend services directly.
OSCP Example:
# Discover internal IP from error message
curl http://target.com/api/data
# Response: "Connection refused to 192.168.1.50:3306"
# Directly access the database
mysql -h 192.168.1.50 -u root -p
Detection Methods:
- Analyze error messages for internal IP addresses.
- Use SSRF to probe internal services.
- Check DNS records for internal hostnames.
- Examine HTTP response headers (
X-Forwarded-For,X-Real-IP).
2. Server Misconfiguration
Concept: Exploit default configurations, exposed admin panels, or unnecessary services.
Common Misconfigurations:
- Default credentials on admin panels (
/admin,/phpmyadmin,/manager/html). - Server-status pages left enabled (
/server-status,/server-info). - Debug mode enabled in production (Django debug pages, PHP info).
- Directory listing enabled (Nginx
autoindex on, ApacheOptions Indexes).
OSCP Example:
# Check for server-status
curl http://target.com/server-status
# Check for phpMyAdmin
curl http://target.com/phpmyadmin/
# Try default credentials
# phpMyAdmin: root / (empty)
# Tomcat Manager: admin / admin
# Jenkins: admin / admin
3. Man-in-the-Middle (MitM)
Concept: Intercept and modify unencrypted traffic between client and server.
When applicable:
- HTTP (not HTTPS) traffic on the same network segment.
- When you can position yourself between the client and server.
OSCP Relevance:
- Use Burp Suite as an intercepting proxy.
- Capture login credentials sent over HTTP.
- Modify requests to test for injection vulnerabilities.
Tools:
# Burp Suite (GUI) - configure browser proxy to 127.0.0.1:8080
# mitmproxy (CLI alternative)
mitmproxy
# sslstrip for HTTPS stripping (older technique)
sslstrip -l 8080
4. Resource Exhaustion
Concept: Overwhelm server resources to cause denial of service.
Types:
- DoS (Denial of Service): Single source flooding.
- DDoS (Distributed DoS): Multiple sources flooding.
OSCP Note: DoS attacks are generally out of scope for OSCP exams. Focus on exploitation rather than disruption. However, understanding resource limits can help with:
- File upload size limits (bypass with chunked encoding).
- Rate limiting bypass (timing attacks).
- Slowloris-style attacks (keeping connections open).
Practical Lab Exercises
Exercise 1: Map the Architecture
Objective: Identify all components in a target web application’s architecture.
Steps:
- Use
nmapto scan for open ports and services. - Identify the web server type from response headers.
- Find the application framework (Wappalyzer, whatweb).
- Discover database technology from error messages.
- Map the request flow using Burp Suite.
# Port scanning
nmap -sV -sC -p- target.com
# Technology detection
whatweb http://target.com
# Check response headers
curl -I http://target.com
Exercise 2: Bypass a Reverse Proxy
Objective: Access a backend server directly, bypassing the front-end proxy.
Steps:
- Identify the reverse proxy from response headers.
- Find the backend server’s IP address (error messages, SSRF).
- Access the backend directly using the discovered IP.
# Check for proxy headers
curl -I http://target.com
# Look for: X-Forwarded-For, X-Real-IP, Via
# If SSRF exists, probe internal services
curl http://target.com/fetch?url=http://127.0.0.1:8080/admin
Exercise 3: Exploit Server Misconfiguration
Objective: Find and exploit a misconfigured server component.
Steps:
- Enumerate common paths (gobuster, ffuf).
- Check for default credentials.
- Exploit the misconfiguration to gain access.
# Directory enumeration
gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt
# Try default credentials on discovered admin panels
# Common defaults: admin/admin, root/root, admin/password
Tools Reference
| Tool | Purpose | Command Example |
|---|---|---|
| Burp Suite | Intercepting proxy, request modification | Configure browser proxy to 127.0.0.1:8080 |
| curl | HTTP requests from CLI | curl -v http://target.com |
| nmap | Port scanning, service detection | nmap -sV -p 80,443,8080 target |
| whatweb | Technology identification | whatweb http://target.com |
| gobuster | Directory/file enumeration | gobuster dir -u http://target -w wordlist.txt |
| ffuf | Fast web fuzzer | ffuf -u http://target/FUZZ -w wordlist.txt |
| Wappalyzer | Browser extension for tech detection | Install in Firefox/Chrome |
Defensive Strategies
For Defenders
- Network Segmentation: Place backend services on internal networks, inaccessible from the internet.
- Reverse Proxies: Use Nginx or Apache as a reverse proxy to hide backend infrastructure.
- Firewall Rules: Restrict access to management interfaces (phpMyAdmin, Tomcat Manager).
- Remove Default Accounts: Disable or rename default admin accounts.
- Disable Unnecessary Services: Turn off server-status, server-info, and debug pages.
- Rate Limiting: Implement rate limiting to prevent brute-force and DoS attacks.
- HTTPS Enforcement: Use HSTS headers to force encrypted communication.
- Security Headers: Implement CSP, X-Frame-Options, X-Content-Type-Options.
Architecture Hardening Checklist
- Backend servers not directly accessible from internet
- Default credentials changed on all services
- Debug mode disabled in production
- Server version information hidden from headers
- Directory listing disabled
- Unnecessary HTTP methods disabled (TRACE, OPTIONS)
- Rate limiting implemented on authentication endpoints
- HTTPS enforced with valid certificates
- Security headers configured
- Regular security audits and penetration tests scheduled
Key Takeaways for OSCP
-
Every web attack starts with understanding the architecture. Before exploiting, map the target’s components and their relationships.
-
Error messages are goldmines. They often reveal internal IP addresses, technology stacks, file paths, and database types.
-
Default credentials are still common. Always try common defaults on admin panels, database interfaces, and management consoles.
-
Burp Suite is your primary client. Master intercepting, modifying, and replaying HTTP requests.
-
The three-tier architecture is most common in OSCP labs. Expect a web server (Nginx/Apache) fronting an application server (Tomcat/Node.js/Django) connected to a database (MySQL/PostgreSQL/MSSQL).
-
Information gathering is half the battle. The more you know about the target’s architecture, the easier exploitation becomes.
Exam Tips
- When you encounter a web application, first identify the server type, framework, and database.
- Check response headers for technology clues (
Server,X-Powered-By,X-AspNet-Version). - Look for admin panels, debug pages, and API documentation.
- Pay attention to error messages — they often contain internal IPs, file paths, and stack traces.
- Use Burp Suite’s site map to understand the application’s structure.
- Document your findings — the OSCP report requires detailed evidence of your methodology.