Penetration testing (pentesting) your own server helps you discover vulnerabilities before attackers do. This guide covers legal considerations, methodology, and practical tools for testing your own infrastructure.
Legal Considerations
- Only test servers you own or have written permission to test
- Notify your hosting provider before testing (some providers require it)
- Do not test third-party services or shared infrastructure
- Document your authorization and scope
Reconnaissance
# DNS enumeration
dig yourdomain.com ANY
dig yourdomain.com MX
host -t ns yourdomain.com
# Port scanning
nmap -sV -sC -O your-server-ip
nmap -p- your-server-ip # All 65535 ports
# Service version detection
nmap -sV -p 22,80,443,3306 your-server-ip
# SSL/TLS analysis
sslscan yourdomain.com
testssl.sh yourdomain.comVulnerability Scanning
# Nikto — Web server scanner
sudo apt install nikto
nikto -h http://your-server-ip
# WPScan — WordPress scanner (if applicable)
docker run -it wpscanteam/wpscan --url http://yourdomain.com
# SQLMap — SQL injection testing
sqlmap -u "http://yourdomain.com/page?id=1" --batch
# Directory brute-forcing
gobuster dir -u http://yourdomain.com -w /usr/share/wordlists/dirb/common.txtManual Testing Checklist
- Check for default credentials on all services
- Test SSH configuration (password auth, key strength)
- Verify firewall rules (are unnecessary ports open?)
- Check for information leakage (server headers, error pages)
- Test file upload functionality for path traversal
- Check for outdated software with known CVEs
- Verify SSL/TLS configuration
- Test rate limiting on login pages
- Check for exposed admin panels
- Verify backup files are not publicly accessible
Reporting and Remediation
# Create a findings document with:
# 1. Vulnerability description
# 2. Severity (Critical/High/Medium/Low)
# 3. Steps to reproduce
# 4. Evidence (screenshots, command output)
# 5. Recommended fix
# 6. References (CVE, CWE numbers)
# Prioritize fixes:
# Critical — Fix immediately (active exploitation risk)
# High — Fix within 48 hours
# Medium — Fix within 2 weeks
# Low — Fix during next maintenance windowAutomated Pentesting Tools
- Metasploit — Comprehensive exploitation framework
- Burp Suite Community — Web application security testing
- OWASP ZAP — Free web app scanner
- Nessus Essentials — Free for up to 16 IPs