Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!
Lesson 2 of 10
Penetration Testing Methodology
Professional penetration testing follows a structured methodology to ensure comprehensive, consistent, and reportable results. The phases build on each other - reconnaissance informs exploitation, which informs post-exploitation.
The Five Phases of Penetration Testing
Phase 1 - RECONNAISSANCE (Information Gathering)
Goal: Build a map of the target's infrastructure, people, and technology
Passive: OSINT only - no direct contact with target systems
- WHOIS records, DNS enumeration, Shodan, LinkedIn, job postings
- Google dorks: site:target.com filetype:pdf
- theHarvester, Maltego, Recon-ng
Active: Direct probing of target systems
- Port scanning (Nmap), web crawling, banner grabbing
- Converts to noise in IDS/SIEM logs
Phase 2 - SCANNING & ENUMERATION
Goal: Identify open ports, running services, OS versions, vulnerabilities
Tools: Nmap (-sV -sC -O -p-), Nessus/OpenVAS, Nikto (web), Gobuster (directories)
Phase 3 - EXPLOITATION
Goal: Prove vulnerabilities are real by successfully exploiting them
Tools: Metasploit, custom exploits, SQLMap, Burp Suite
Important: Only against in-scope targets with authorization
Phase 4 - POST-EXPLOITATION
Goal: Demonstrate real-world impact - what can an attacker DO with access?
Activities: Privilege escalation, lateral movement, data access, persistence
Objective evidence: Screenshot of accessible sensitive data (not downloading it)
Phase 5 - REPORTING
Goal: Communicate findings clearly to technical and non-technical stakeholders
Content: Executive summary, technical findings, evidence, remediation steps, risk ratingsScoping a Penetration Test
- Internal vs. External: External = testing from the internet (what an untrusted attacker sees). Internal = testing from inside the network (compromised employee/insider threat simulation)
- Black box: Tester has no prior knowledge of the target - simulates an external attacker. Most realistic but least efficient
- White box: Full access to source code, architecture diagrams, credentials - deepest coverage, most efficient
- Gray box: Some information provided (network diagram, user credentials) - balances realism with efficiency. Most common
- Assumed breach: Start with low-privilege internal access - tests lateral movement, privilege escalation, and detection capabilities
Common Mistakes
- Rushing to exploitation without thorough reconnaissance - you may miss high-impact vulnerabilities by skipping recon
- Not taking notes during testing - professional reports require evidence (screenshots, command output, timestamps) captured at the time of testing
- Destructive testing on production without explicit permission - always confirm whether DoS testing is in scope
Tip
Tip
Practice Penetration Testing Methodology in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
The foundational security model: Confidentiality (privacy), Integrity (trust), and Availability (uptime).
Practice Task
Note
Practice Task - (1) Write a working example of Penetration Testing Methodology from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Quick Quiz
Common Mistake
Warning
A common mistake with Penetration Testing Methodology is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready cybersecurity code.
Key Takeaways
- Professional penetration testing follows a structured methodology to ensure comprehensive, consistent, and reportable results.
- Internal vs. External: External = testing from the internet (what an untrusted attacker sees). Internal = testing from inside the network (compromised employee/insider threat simulation)
- Black box: Tester has no prior knowledge of the target - simulates an external attacker. Most realistic but least efficient
- White box: Full access to source code, architecture diagrams, credentials - deepest coverage, most efficient
Finished this lesson?