OWASP Top 10 Security Lab

A05

Security Misconfiguration

Discover and exploit common configuration vulnerabilities

What is Security Misconfiguration?

Security misconfiguration is the most commonly seen issue in the OWASP Top 10. It occurs when security settings are defined, implemented, and maintained improperly. This can happen at any level of an application stack, including network services, platform, web server, application server, database, frameworks, custom code, and pre-installed virtual machines, containers, or storage.

🎯 Common Misconfiguration Types

  • Default Credentials: Unchanged default usernames and passwords
  • Unnecessary Features: Enabled ports, services, pages, accounts, or privileges
  • Missing Security Headers: No HTTPS, HSTS, CSP, or other protective headers
  • Verbose Error Messages: Stack traces and detailed errors exposed to users
  • Directory Listing: Web server allows browsing of directories
  • Insecure Permissions: Overly permissive file and database access
  • Debug Mode: Production systems running in debug/development mode
  • Outdated Software: Unpatched systems and vulnerable components

⚠️ Attack Impact

  • Complete system compromise through default credentials
  • Unauthorized access to sensitive data and configuration files
  • Information disclosure through verbose error messages
  • Cross-site scripting and other client-side attacks
  • Man-in-the-middle attacks due to insecure transport
  • Privilege escalation through misconfigured permissions

🔍 Reconnaissance Techniques

# Port Scanning & Service Enumeration nmap -sV -sC target.com nmap -p- --top-ports 1000 target.com # Web Directory Discovery gobuster dir -u http://target.com -w wordlist.txt dirb http://target.com /usr/share/wordlists/dirb/common.txt # Default Credential Testing admin:admin, admin:password, root:root user:user, guest:guest, test:test # Security Header Analysis curl -I https://target.com # Look for: HSTS, CSP, X-Frame-Options, X-XSS-Protection # Cloud Storage Enumeration aws s3 ls s3://bucket-name --no-sign-request gsutil ls -L gs://bucket-name # Configuration File Discovery /.env, /config.php, /web.config, /.git/config /admin, /test, /dev, /backup, /old

🛡️ Hardening Best Practices

  • Minimal Installation: Remove unnecessary features, components, and services
  • Change Defaults: Update all default passwords, accounts, and configurations
  • Security Headers: Implement comprehensive HTTP security headers
  • Error Handling: Generic error messages without sensitive information
  • Regular Updates: Keep all software components up to date
  • Access Controls: Implement least privilege principle
  • Monitoring: Log and monitor all configuration changes
# Secure HTTP Headers Configuration Strict-Transport-Security: max-age=31536000; includeSubDomains Content-Security-Policy: default-src 'self' X-Frame-Options: DENY X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Referrer-Policy: strict-origin-when-cross-origin # Secure Apache Configuration ServerTokens Prod ServerSignature Off DirectoryIndex index.php index.html Options -Indexes -Includes -ExecCGI # Secure Nginx Configuration server_tokens off; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always;