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'.4---56# Pentesting Methodology78A comprehensive guide for conducting penetration tests and security assessments. This skill provides a structured approach to security testing from initial reconnaissance through post-exploitation.910## ⚠️ Ethical Considerations1112**Always ensure you have explicit authorization before performing any security testing.** This methodology should only be used:13- On systems you own or have written permission to test14- In authorized penetration testing engagements15- In controlled lab environments for learning16- During bug bounty programs within scope1718## Methodology Overview1920Follow this structured approach for comprehensive security assessments:2122### Phase 0: Physical Access Assessment2324If you have physical access to target systems:25- Review physical attack vectors (USB drops, keyloggers, hardware implants)26- Consider GUI escape techniques for locked workstations27- Document physical security controls and bypass opportunities2829### Phase 1: Asset Discovery3031**Internal Tests:**32- Discover hosts within the network using ARP scanning, Nmap, and network enumeration33- Map network topology and identify critical infrastructure3435**External Tests:**36- Enumerate company assets on the internet (domains, subdomains, cloud resources)37- Use OSINT tools to gather publicly available information38- Once internal access is gained, restart from Phase 1 for internal discovery3940### Phase 2: Network Intelligence (Internal Only)4142Before targeting specific hosts:43- **Passive reconnaissance:** Sniff network traffic to understand protocols and data flows44- **Active reconnaissance:** Perform MITM attacks to intercept credentials and sessions45- **Credential harvesting:** Capture NTLM hashes, Kerberos tickets, or plaintext credentials46- Document network protocols, services, and potential attack surfaces4748### Phase 3: Port Scanning & Service Discovery4950**Essential scanning workflow:**511. **Initial scan:** Quick port scan to identify open ports522. **Service enumeration:** Identify running services and versions533. **Deep scan:** Comprehensive scan with version detection and script scanning544. **Documentation:** Record all findings with timestamps5556**Recommended tools:**57- Nmap for comprehensive scanning58- Masscan for rapid port discovery59- Rustscan for fast initial sweeps6061### Phase 4: Vulnerability Research6263For each discovered service:641. **Version identification:** Determine exact service versions652. **CVE lookup:** Search for known vulnerabilities (Exploit-DB, NVD, GitHub)663. **Exploit availability:** Check for public exploits or proof-of-concepts674. **Risk assessment:** Prioritize based on severity and exploitability6869**Resources:**70- Exploit-DB for public exploits71- NVD for CVE information72- GitHub for custom exploits and tools73- Vendor security advisories7475### Phase 5: Service-Specific Testing7677**When no direct exploits exist:**78- Test for common misconfigurations79- Check for default credentials80- Test for authentication bypasses81- Look for information disclosure82- Attempt parameter tampering8384**Web applications (highest priority):**85- SQL injection testing86- XSS vulnerability assessment87- Authentication/authorization testing88- File upload vulnerabilities89- Business logic flaws9091**Common services to test:**92- SSH, RDP, VNC (remote access)93- SMB, NFS (file sharing)94- HTTP/HTTPS (web services)95- Database services (MySQL, PostgreSQL, MongoDB)96- Mail services (SMTP, IMAP, POP3)9798**Automated tools:**99- Legion for automated vulnerability assessment100- Nessus/OpenVAS for vulnerability scanning101- Custom scripts for service-specific testing102103**Brute-force considerations:**104- Use wordlists appropriate to the service105- Implement rate limiting to avoid detection106- Document all attempts for reporting107- Consider credential stuffing if hashes are available108109### Phase 6: Social Engineering110111**When technical vectors fail:**112- Phishing campaigns (email, SMS, voice)113- Credential harvesting pages114- Malicious document delivery115- Business email compromise scenarios116117**Important:** Only use social engineering with explicit authorization and within legal boundaries.118119### Phase 7: Initial Access120121**Once a vulnerability is identified:**1221. **Exploit development:** Adapt or write exploits as needed1232. **Payload delivery:** Choose appropriate payload (reverse shell, bind shell, web shell)1243. **Shell establishment:** Gain initial interactive access1254. **Stabilization:** Upgrade to stable shell if needed126127**Reverse shell considerations:**128- Choose appropriate language (bash, python, netcat, powershell)129- Consider firewall/AV evasion130- Use encrypted channels when possible131- Have backup access methods ready132133**Windows-specific:**134- AV evasion techniques for payloads135- Use encoded or obfuscated commands136- Consider living-off-the-land binaries (LOLBins)137138### Phase 8: Post-Access Enumeration139140**Linux systems:**141- User enumeration (`/etc/passwd`, `last`, `w`)142- Privilege escalation paths (SUID binaries, cron jobs, capabilities)143- Network connections and listening services144- Installed software and versions145- Scheduled tasks and startup scripts146147**Windows systems:**148- User and group enumeration149- Service and process analysis150- Registry persistence locations151- Scheduled tasks and startup items152- Credential storage locations153- Active Directory information (if domain-joined)154155### Phase 9: Data Exfiltration156157**Data extraction methods:**158- Direct file transfer (SCP, FTP, HTTP)159- Encrypted channels (DNS tunneling, HTTPS)160- Steganography for covert channels161- Compression and encoding for large datasets162163**Data to prioritize:**164- Credentials and password hashes165- Sensitive documents and databases166- Configuration files with secrets167- Source code and intellectual property168- Network topology information169170### Phase 10: Privilege Escalation171172**Local Privilege Escalation:**173174**Linux:**175- Kernel exploits (check kernel version)176- SUID/SGID binary abuse177- Capability exploitation178- Cron job manipulation179- Service misconfigurations180- Use PEAS (Privilege Escalation Awesome Scripts) for enumeration181182**Windows:**183- Service exploitation184- Token manipulation185- UAC bypass techniques186- Unquoted service paths187- Weak service permissions188- Use WinPEAS for enumeration189190**Domain Privilege Escalation:**191- Active Directory enumeration192- Trust relationship exploitation193- Kerberos attacks (AS-REP roasting, Golden Ticket)194- Lateral movement techniques195- Credential dumping (Mimikatz, secretsdump)196- GPO abuse and manipulation197198### Phase 11: Post-Exploitation199200**Looting:**201- Search for additional credentials202- Check for access to other systems203- Dump password hashes and cached credentials204- Look for configuration files with secrets205- Identify high-value targets206207**Persistence:**208- Implement 2-3 different persistence mechanisms209- **Windows:** Scheduled tasks, services, registry run keys, WMI subscriptions210- **Linux:** Cron jobs, systemd services, bashrc modifications211- **Active Directory:** GPO modifications, ACL changes, DC shadowing212- Document all persistence for cleanup213214### Phase 12: Pivoting215216**Network pivoting:**217- SSH tunneling for port forwarding218- SOCKS proxies for network access219- Meterpreter pivoting (if using Metasploit)220- Chisel/SSHuttle for advanced tunneling221222**Lateral movement:**223- Use harvested credentials on other systems224- Pass-the-hash/Pass-the-ticket attacks225- WMI/WinRM for Windows lateral movement226- SSH key abuse for Linux environments227228**When pivoting:**229- Restart methodology from Phase 1 for new networks230- Document network topology changes231- Update asset inventory232- Consider new attack vectors233234## Specialized Testing Areas235236### Mobile Application Testing237- Android application security assessment238- APK analysis and decompilation239- Runtime analysis and hooking240- API security testing241242### Binary Exploitation243- Stack-based buffer overflows244- Format string vulnerabilities245- Return-oriented programming (ROP)246- Windows-specific exploitation techniques247248### Cryptographic Analysis249- ECB mode vulnerabilities250- CBC-MAC weaknesses251- Padding oracle attacks252- Weak key generation and usage253254## Documentation & Reporting255256**During the engagement:**257- Document all findings with timestamps258- Capture screenshots and logs259- Record commands and outputs260- Track progress through methodology phases261262**Final report should include:**263- Executive summary for management264- Technical findings with severity ratings265- Proof-of-concept evidence266- Remediation recommendations267- Risk assessment and prioritization268269## Tools Reference270271**Reconnaissance:**272- Nmap, Masscan, Rustscan273- Subfinder, Amass, Assetfinder274- Shodan, Censys for external assets275276**Vulnerability Assessment:**277- Legion, Nessus, OpenVAS278- Nikto, WPScan for web applications279- Burp Suite for web testing280281**Exploitation:**282- Metasploit Framework283- Custom exploit development284- Exploit-DB search tools285286**Post-Exploitation:**287- PEAS/WinPEAS for enumeration288- Mimikatz for credential access289- BloodHound for AD analysis290- Empire/Cobalt Strike for C2291292**Pivoting:**293- SSH tunneling294- Chisel, SSHuttle295- Proxychains for routing296297## Safety Reminders2982991. **Authorization:** Never test without written permission3002. **Scope:** Stay within agreed boundaries3013. **Timing:** Avoid production impact during business hours3024. **Data handling:** Protect any sensitive data discovered3035. **Cleanup:** Remove all persistence and access methods3046. **Reporting:** Document everything for the client305306## When to Use This Skill307308Use this methodology when:309- Planning a penetration test engagement310- Conducting security assessments311- Learning penetration testing techniques312- Developing security testing procedures313- Creating bug bounty testing strategies314- Performing authorized red team operations315- Documenting security testing processes316317This skill provides the framework - adapt specific techniques to your target environment and engagement scope.