TL;DR
This guide provides a structured approach to server penetration testing, covering reconnaissance, scanning, exploitation, post-exploitation, and reporting. It’s designed for both beginners and those looking to refine their methodology.
1. Planning & Scope Definition
- Define the scope: Clearly identify which servers are in scope. Get written permission!
- Rules of Engagement (ROE): Document acceptable testing methods, prohibited activities (e.g., denial-of-service), and contact information for emergencies.
- Gather Information: Collect server names, IP addresses, operating systems (if known), network diagrams, and any publicly available documentation.
2. Reconnaissance
Passive information gathering without directly interacting with the target servers.
- DNS Enumeration: Use tools like
nslookupor online DNS records lookups to find subdomains and associated IP addresses.nslookup example.com - WHOIS Lookup: Identify the owner, contact information, and registration details of the domain.
whois example.com - Search Engines (Google Dorking): Use advanced search operators to find sensitive information exposed online.
Example:site:example.com filetype:pdf - Social Media & Public Repositories: Search for employee names, technologies used, and potential vulnerabilities mentioned publicly.
3. Scanning
Active information gathering to identify open ports, services, and potential vulnerabilities.
- Port Scanning (Nmap): Discover open ports and running services.
nmap -sV -T4 -A - Service Version Detection: Identify the versions of running services to pinpoint known vulnerabilities. Nmap’s
-sVflag is useful for this. - Vulnerability Scanning (Nessus, OpenVAS): Use automated vulnerability scanners to identify potential weaknesses.
- Configure scans appropriately based on the target environment.
- Review scan results carefully; false positives are common.
4. Exploitation
Attempting to gain access to the server using identified vulnerabilities.
- Exploit Research: Search for publicly available exploits on platforms like Exploit-DB or Metasploit.
- Match exploits to the specific versions of running services.
- Metasploit Framework: A powerful framework for developing and executing exploits.
msfconsole - Manual Exploitation: If an exploit isn’t readily available, consider manual exploitation techniques based on the vulnerability.
- Web Application Testing (if applicable): Test for common web vulnerabilities like SQL injection, cross-site scripting (XSS), and remote file inclusion (RFI).
5. Post-Exploitation
Actions taken after gaining access to the server.
- Privilege Escalation: Attempt to gain higher privileges on the system.
- Look for misconfigured services, kernel vulnerabilities, or weak passwords.
- Data Gathering: Collect sensitive information such as user accounts, passwords, and configuration files.
- Maintaining Access (Optional): Establish a persistent backdoor to maintain access (with permission!).
6. Reporting
Documenting the findings of the penetration test.
- Executive Summary: A high-level overview of the testing process and key findings for non-technical stakeholders.
- Technical Report: Detailed documentation of all identified vulnerabilities, exploitation steps, and remediation recommendations.
- Remediation Recommendations: Provide specific steps to fix identified vulnerabilities.
- Prioritize vulnerabilities based on severity and impact.
Resources
- OWASP: https://owasp.org – Web application security resources.
- Metasploit Framework Documentation: https://docs.metasploit.com/
- Nmap Documentation: https://nmap.org/docs/

