Pentesting Methodology
A comprehensive guide for conducting penetration tests and security assessments. This skill provides a structured approach to security testing from initial reconnaissance through post-exploitation.
⚠️ Ethical Considerations
Always ensure you have explicit authorization before performing any security testing. This methodology should only be used:
- On systems you own or have written permission to test
- In authorized penetration testing engagements
- In controlled lab environments for learning
- During bug bounty programs within scope
Methodology Overview
Follow this structured approach for comprehensive security assessments:
Phase 0: Physical Access Assessment
If you have physical access to target systems:
- Review physical attack vectors (USB drops, keyloggers, hardware implants)
- Consider GUI escape techniques for locked workstations
- Document physical security controls and bypass opportunities
Phase 1: Asset Discovery
Internal Tests:
- Discover hosts within the network using ARP scanning, Nmap, and network enumeration
- Map network topology and identify critical infrastructure
External Tests:
- Enumerate company assets on the internet (domains, subdomains, cloud resources)
- Use OSINT tools to gather publicly available information
- Once internal access is gained, restart from Phase 1 for internal discovery
Phase 2: Network Intelligence (Internal Only)
Before targeting specific hosts:
- Passive reconnaissance: Sniff network traffic to understand protocols and data flows
- Active reconnaissance: Perform MITM attacks to intercept credentials and sessions
- Credential harvesting: Capture NTLM hashes, Kerberos tickets, or plaintext credentials
- Document network protocols, services, and potential attack surfaces
Phase 3: Port Scanning & Service Discovery
Essential scanning workflow:
- Initial scan: Quick port scan to identify open ports
- Service enumeration: Identify running services and versions
- Deep scan: Comprehensive scan with version detection and script scanning
- Documentation: Record all findings with timestamps
Recommended tools:
- Nmap for comprehensive scanning
- Masscan for rapid port discovery
- Rustscan for fast initial sweeps
Phase 4: Vulnerability Research
For each discovered service:
- Version identification: Determine exact service versions
- CVE lookup: Search for known vulnerabilities (Exploit-DB, NVD, GitHub)
- Exploit availability: Check for public exploits or proof-of-concepts
- Risk assessment: Prioritize based on severity and exploitability
Resources:
- Exploit-DB for public exploits
- NVD for CVE information
- GitHub for custom exploits and tools
- Vendor security advisories
Phase 5: Service-Specific Testing
When no direct exploits exist:
- Test for common misconfigurations
- Check for default credentials
- Test for authentication bypasses
- Look for information disclosure
- Attempt parameter tampering
Web applications (highest priority):
- SQL injection testing
- XSS vulnerability assessment
- Authentication/authorization testing
- File upload vulnerabilities
- Business logic flaws
Common services to test:
- SSH, RDP, VNC (remote access)
- SMB, NFS (file sharing)
- HTTP/HTTPS (web services)
- Database services (MySQL, PostgreSQL, MongoDB)
- Mail services (SMTP, IMAP, POP3)
Automated tools:
- Legion for automated vulnerability assessment
- Nessus/OpenVAS for vulnerability scanning
- Custom scripts for service-specific testing
Brute-force considerations:
- Use wordlists appropriate to the service
- Implement rate limiting to avoid detection
- Document all attempts for reporting
- Consider credential stuffing if hashes are available
Phase 6: Social Engineering
When technical vectors fail:
- Phishing campaigns (email, SMS, voice)
- Credential harvesting pages
- Malicious document delivery
- Business email compromise scenarios
Important: Only use social engineering with explicit authorization and within legal boundaries.
Phase 7: Initial Access
Once a vulnerability is identified:
- Exploit development: Adapt or write exploits as needed
- Payload delivery: Choose appropriate payload (reverse shell, bind shell, web shell)
- Shell establishment: Gain initial interactive access
- Stabilization: Upgrade to stable shell if needed
Reverse shell considerations:
- Choose appropriate language (bash, python, netcat, powershell)
- Consider firewall/AV evasion
- Use encrypted channels when possible
- Have backup access methods ready
Windows-specific:
- AV evasion techniques for payloads
- Use encoded or obfuscated commands
- Consider living-off-the-land binaries (LOLBins)
Phase 8: Post-Access Enumeration
Linux systems:
- User enumeration (
/etc/passwd, last, w)
- Privilege escalation paths (SUID binaries, cron jobs, capabilities)
- Network connections and listening services
- Installed software and versions
- Scheduled tasks and startup scripts
Windows systems:
- User and group enumeration
- Service and process analysis
- Registry persistence locations
- Scheduled tasks and startup items
- Credential storage locations
- Active Directory information (if domain-joined)
Phase 9: Data Exfiltration
Data extraction methods:
- Direct file transfer (SCP, FTP, HTTP)
- Encrypted channels (DNS tunneling, HTTPS)
- Steganography for covert channels
- Compression and encoding for large datasets
Data to prioritize:
- Credentials and password hashes
- Sensitive documents and databases
- Configuration files with secrets
- Source code and intellectual property
- Network topology information
Phase 10: Privilege Escalation
Local Privilege Escalation:
Linux:
- Kernel exploits (check kernel version)
- SUID/SGID binary abuse
- Capability exploitation
- Cron job manipulation
- Service misconfigurations
- Use PEAS (Privilege Escalation Awesome Scripts) for enumeration
Windows:
- Service exploitation
- Token manipulation
- UAC bypass techniques
- Unquoted service paths
- Weak service permissions
- Use WinPEAS for enumeration
Domain Privilege Escalation:
- Active Directory enumeration
- Trust relationship exploitation
- Kerberos attacks (AS-REP roasting, Golden Ticket)
- Lateral movement techniques
- Credential dumping (Mimikatz, secretsdump)
- GPO abuse and manipulation
Phase 11: Post-Exploitation
Looting:
- Search for additional credentials
- Check for access to other systems
- Dump password hashes and cached credentials
- Look for configuration files with secrets
- Identify high-value targets
Persistence:
- Implement 2-3 different persistence mechanisms
- Windows: Scheduled tasks, services, registry run keys, WMI subscriptions
- Linux: Cron jobs, systemd services, bashrc modifications
- Active Directory: GPO modifications, ACL changes, DC shadowing
- Document all persistence for cleanup
Phase 12: Pivoting
Network pivoting:
- SSH tunneling for port forwarding
- SOCKS proxies for network access
- Meterpreter pivoting (if using Metasploit)
- Chisel/SSHuttle for advanced tunneling
Lateral movement:
- Use harvested credentials on other systems
- Pass-the-hash/Pass-the-ticket attacks
- WMI/WinRM for Windows lateral movement
- SSH key abuse for Linux environments
When pivoting:
- Restart methodology from Phase 1 for new networks
- Document network topology changes
- Update asset inventory
- Consider new attack vectors
Specialized Testing Areas
Mobile Application Testing
- Android application security assessment
- APK analysis and decompilation
- Runtime analysis and hooking
- API security testing
Binary Exploitation
- Stack-based buffer overflows
- Format string vulnerabilities
- Return-oriented programming (ROP)
- Windows-specific exploitation techniques
Cryptographic Analysis
- ECB mode vulnerabilities
- CBC-MAC weaknesses
- Padding oracle attacks
- Weak key generation and usage
Documentation & Reporting
During the engagement:
- Document all findings with timestamps
- Capture screenshots and logs
- Record commands and outputs
- Track progress through methodology phases
Final report should include:
- Executive summary for management
- Technical findings with severity ratings
- Proof-of-concept evidence
- Remediation recommendations
- Risk assessment and prioritization
Tools Reference
Reconnaissance:
- Nmap, Masscan, Rustscan
- Subfinder, Amass, Assetfinder
- Shodan, Censys for external assets
Vulnerability Assessment:
- Legion, Nessus, OpenVAS
- Nikto, WPScan for web applications
- Burp Suite for web testing
Exploitation:
- Metasploit Framework
- Custom exploit development
- Exploit-DB search tools
Post-Exploitation:
- PEAS/WinPEAS for enumeration
- Mimikatz for credential access
- BloodHound for AD analysis
- Empire/Cobalt Strike for C2
Pivoting:
- SSH tunneling
- Chisel, SSHuttle
- Proxychains for routing
Safety Reminders
- Authorization: Never test without written permission
- Scope: Stay within agreed boundaries
- Timing: Avoid production impact during business hours
- Data handling: Protect any sensitive data discovered
- Cleanup: Remove all persistence and access methods
- Reporting: Document everything for the client
When to Use This Skill
Use this methodology when:
- Planning a penetration test engagement
- Conducting security assessments
- Learning penetration testing techniques
- Developing security testing procedures
- Creating bug bounty testing strategies
- Performing authorized red team operations
- Documenting security testing processes
This skill provides the framework - adapt specific techniques to your target environment and engagement scope.
1---2name: pentesting-methodology3description: Use this skill whenever you need to perform penetration testing, security assessments, vulnerability research, or red team operations. This covers the complete pentesting workflow from reconnaissance through privilege escalation and pivoting. Make sure to use this skill when the user mentions pentesting, security testing, vulnerability assessment, network scanning, privilege escalation, or any security-related attack methodology, even if they don't explicitly ask for a 'pentesting methodology'.4metadata:5 source: https://skillmd.com/skills/abelrguezr/pentesting-methodology6---78# Pentesting Methodology910A comprehensive guide for conducting penetration tests and security assessments. This skill provides a structured approach to security testing from initial reconnaissance through post-exploitation.1112## ⚠️ Ethical Considerations1314**Always ensure you have explicit authorization before performing any security testing.** This methodology should only be used:15- On systems you own or have written permission to test16- In authorized penetration testing engagements17- In controlled lab environments for learning18- During bug bounty programs within scope1920## Methodology Overview2122Follow this structured approach for comprehensive security assessments:2324### Phase 0: Physical Access Assessment2526If you have physical access to target systems:27- Review physical attack vectors (USB drops, keyloggers, hardware implants)28- Consider GUI escape techniques for locked workstations29- Document physical security controls and bypass opportunities3031### Phase 1: Asset Discovery3233**Internal Tests:**34- Discover hosts within the network using ARP scanning, Nmap, and network enumeration35- Map network topology and identify critical infrastructure3637**External Tests:**38- Enumerate company assets on the internet (domains, subdomains, cloud resources)39- Use OSINT tools to gather publicly available information40- Once internal access is gained, restart from Phase 1 for internal discovery4142### Phase 2: Network Intelligence (Internal Only)4344Before targeting specific hosts:45- **Passive reconnaissance:** Sniff network traffic to understand protocols and data flows46- **Active reconnaissance:** Perform MITM attacks to intercept credentials and sessions47- **Credential harvesting:** Capture NTLM hashes, Kerberos tickets, or plaintext credentials48- Document network protocols, services, and potential attack surfaces4950### Phase 3: Port Scanning & Service Discovery5152**Essential scanning workflow:**531. **Initial scan:** Quick port scan to identify open ports542. **Service enumeration:** Identify running services and versions553. **Deep scan:** Comprehensive scan with version detection and script scanning564. **Documentation:** Record all findings with timestamps5758**Recommended tools:**59- Nmap for comprehensive scanning60- Masscan for rapid port discovery61- Rustscan for fast initial sweeps6263### Phase 4: Vulnerability Research6465For each discovered service:661. **Version identification:** Determine exact service versions672. **CVE lookup:** Search for known vulnerabilities (Exploit-DB, NVD, GitHub)683. **Exploit availability:** Check for public exploits or proof-of-concepts694. **Risk assessment:** Prioritize based on severity and exploitability7071**Resources:**72- Exploit-DB for public exploits73- NVD for CVE information74- GitHub for custom exploits and tools75- Vendor security advisories7677### Phase 5: Service-Specific Testing7879**When no direct exploits exist:**80- Test for common misconfigurations81- Check for default credentials82- Test for authentication bypasses83- Look for information disclosure84- Attempt parameter tampering8586**Web applications (highest priority):**87- SQL injection testing88- XSS vulnerability assessment89- Authentication/authorization testing90- File upload vulnerabilities91- Business logic flaws9293**Common services to test:**94- SSH, RDP, VNC (remote access)95- SMB, NFS (file sharing)96- HTTP/HTTPS (web services)97- Database services (MySQL, PostgreSQL, MongoDB)98- Mail services (SMTP, IMAP, POP3)99100**Automated tools:**101- Legion for automated vulnerability assessment102- Nessus/OpenVAS for vulnerability scanning103- Custom scripts for service-specific testing104105**Brute-force considerations:**106- Use wordlists appropriate to the service107- Implement rate limiting to avoid detection108- Document all attempts for reporting109- Consider credential stuffing if hashes are available110111### Phase 6: Social Engineering112113**When technical vectors fail:**114- Phishing campaigns (email, SMS, voice)115- Credential harvesting pages116- Malicious document delivery117- Business email compromise scenarios118119**Important:** Only use social engineering with explicit authorization and within legal boundaries.120121### Phase 7: Initial Access122123**Once a vulnerability is identified:**1241. **Exploit development:** Adapt or write exploits as needed1252. **Payload delivery:** Choose appropriate payload (reverse shell, bind shell, web shell)1263. **Shell establishment:** Gain initial interactive access1274. **Stabilization:** Upgrade to stable shell if needed128129**Reverse shell considerations:**130- Choose appropriate language (bash, python, netcat, powershell)131- Consider firewall/AV evasion132- Use encrypted channels when possible133- Have backup access methods ready134135**Windows-specific:**136- AV evasion techniques for payloads137- Use encoded or obfuscated commands138- Consider living-off-the-land binaries (LOLBins)139140### Phase 8: Post-Access Enumeration141142**Linux systems:**143- User enumeration (`/etc/passwd`, `last`, `w`)144- Privilege escalation paths (SUID binaries, cron jobs, capabilities)145- Network connections and listening services146- Installed software and versions147- Scheduled tasks and startup scripts148149**Windows systems:**150- User and group enumeration151- Service and process analysis152- Registry persistence locations153- Scheduled tasks and startup items154- Credential storage locations155- Active Directory information (if domain-joined)156157### Phase 9: Data Exfiltration158159**Data extraction methods:**160- Direct file transfer (SCP, FTP, HTTP)161- Encrypted channels (DNS tunneling, HTTPS)162- Steganography for covert channels163- Compression and encoding for large datasets164165**Data to prioritize:**166- Credentials and password hashes167- Sensitive documents and databases168- Configuration files with secrets169- Source code and intellectual property170- Network topology information171172### Phase 10: Privilege Escalation173174**Local Privilege Escalation:**175176**Linux:**177- Kernel exploits (check kernel version)178- SUID/SGID binary abuse179- Capability exploitation180- Cron job manipulation181- Service misconfigurations182- Use PEAS (Privilege Escalation Awesome Scripts) for enumeration183184**Windows:**185- Service exploitation186- Token manipulation187- UAC bypass techniques188- Unquoted service paths189- Weak service permissions190- Use WinPEAS for enumeration191192**Domain Privilege Escalation:**193- Active Directory enumeration194- Trust relationship exploitation195- Kerberos attacks (AS-REP roasting, Golden Ticket)196- Lateral movement techniques197- Credential dumping (Mimikatz, secretsdump)198- GPO abuse and manipulation199200### Phase 11: Post-Exploitation201202**Looting:**203- Search for additional credentials204- Check for access to other systems205- Dump password hashes and cached credentials206- Look for configuration files with secrets207- Identify high-value targets208209**Persistence:**210- Implement 2-3 different persistence mechanisms211- **Windows:** Scheduled tasks, services, registry run keys, WMI subscriptions212- **Linux:** Cron jobs, systemd services, bashrc modifications213- **Active Directory:** GPO modifications, ACL changes, DC shadowing214- Document all persistence for cleanup215216### Phase 12: Pivoting217218**Network pivoting:**219- SSH tunneling for port forwarding220- SOCKS proxies for network access221- Meterpreter pivoting (if using Metasploit)222- Chisel/SSHuttle for advanced tunneling223224**Lateral movement:**225- Use harvested credentials on other systems226- Pass-the-hash/Pass-the-ticket attacks227- WMI/WinRM for Windows lateral movement228- SSH key abuse for Linux environments229230**When pivoting:**231- Restart methodology from Phase 1 for new networks232- Document network topology changes233- Update asset inventory234- Consider new attack vectors235236## Specialized Testing Areas237238### Mobile Application Testing239- Android application security assessment240- APK analysis and decompilation241- Runtime analysis and hooking242- API security testing243244### Binary Exploitation245- Stack-based buffer overflows246- Format string vulnerabilities247- Return-oriented programming (ROP)248- Windows-specific exploitation techniques249250### Cryptographic Analysis251- ECB mode vulnerabilities252- CBC-MAC weaknesses253- Padding oracle attacks254- Weak key generation and usage255256## Documentation & Reporting257258**During the engagement:**259- Document all findings with timestamps260- Capture screenshots and logs261- Record commands and outputs262- Track progress through methodology phases263264**Final report should include:**265- Executive summary for management266- Technical findings with severity ratings267- Proof-of-concept evidence268- Remediation recommendations269- Risk assessment and prioritization270271## Tools Reference272273**Reconnaissance:**274- Nmap, Masscan, Rustscan275- Subfinder, Amass, Assetfinder276- Shodan, Censys for external assets277278**Vulnerability Assessment:**279- Legion, Nessus, OpenVAS280- Nikto, WPScan for web applications281- Burp Suite for web testing282283**Exploitation:**284- Metasploit Framework285- Custom exploit development286- Exploit-DB search tools287288**Post-Exploitation:**289- PEAS/WinPEAS for enumeration290- Mimikatz for credential access291- BloodHound for AD analysis292- Empire/Cobalt Strike for C2293294**Pivoting:**295- SSH tunneling296- Chisel, SSHuttle297- Proxychains for routing298299## Safety Reminders3003011. **Authorization:** Never test without written permission3022. **Scope:** Stay within agreed boundaries3033. **Timing:** Avoid production impact during business hours3044. **Data handling:** Protect any sensitive data discovered3055. **Cleanup:** Remove all persistence and access methods3066. **Reporting:** Document everything for the client307308## When to Use This Skill309310Use this methodology when:311- Planning a penetration test engagement312- Conducting security assessments313- Learning penetration testing techniques314- Developing security testing procedures315- Creating bug bounty testing strategies316- Performing authorized red team operations317- Documenting security testing processes318319This skill provides the framework - adapt specific techniques to your target environment and engagement scope.