Module 9 of 20 — Offensive Security

Penetration Testing Methodologies

Penetration testing simulates real attacks to identify vulnerabilities before adversaries do. Effective testing follows structured methodologies that ensure comprehensive coverage while maintaining legal and ethical boundaries.

Penetration Testing Frameworks

Multiple methodologies guide penetration testing engagements. Each offers different perspectives and levels of detail for various testing scenarios.

PTES (Penetration Testing Execution Standard)

Comprehensive framework with pre-engagement through reporting phases.

Key Feature: Emphasis on pre-engagement communication and threat emulation.

OSSTMM (Open Source Security Testing Methodology Manual)

Scientific methodology focusing on measurable security metrics.

Key Feature: Quantifies security through the Security Tenacity Chain.

NIST SP 800-115

Government methodology covering technical testing approaches.

Key Feature: Integration with risk management and compliance requirements.

MITRE ATT&CK

Adversary TTP framework mapping real-world attack behaviors.

Key Feature: Maps defensive gaps to specific adversary techniques.

Penetration Testing Phases

The attack lifecycle mirrors real adversaries. Understanding each phase helps identify where defenses failed and how to improve them.

1

Reconnaissance

Passive information gathering without direct interaction with target.

Techniques:

WHOIS, DNS enumeration, social media research, public breach data.

Tools:

theHarvester, Maltego, Shodan, Recon-ng

Example: Company executive LinkedIn reveals tech stack preferences.
2

Scanning & Enumeration

Active probing to identify live systems, open ports, and services.

Techniques:

Port scanning, service detection, OS fingerprinting, vulnerability scanning.

Tools:

Nmap, Nessus, Masscan, Nikto

Example: Nmap reveals ports 80, 443, 22, 3389 open on target server.
3

Gaining Access

Exploiting identified vulnerabilities to gain initial system access.

Techniques:

Exploit execution, social engineering, credential attacks.

Tools:

Metasploit, SQLMap, Burp Suite, Hydra

Example: Exploited SQL injection to bypass login authentication.
4

Maintaining Access

Ensuring persistent access to compromised systems.

Techniques:

Web shells, scheduled tasks, rootkits, backdoor installation.

Tools:

Netcat, Empire, Metasploit persistence modules

Example: Uploaded PHP web shell for remote command execution.
5

Privilege Escalation

Increasing access level from user to administrator/root.

Techniques:

Kernel exploits, misconfigurations, password reuse, token impersonation.

Tools:

LinPEAS, WinPEAS, PowerSploit, BeRoot

Example: Exploited unquoted service path to gain SYSTEM privileges.
6

Lateral Movement

Expanding access to other systems in the network.

Techniques:

Pass-the-hash, SMB relay, remote desktop, remote PowerShell.

Tools:

Mimikatz, CrackMapExec, BloodHound, PsExec

Example: Used stolen credentials to access domain controller via PSRemoting.

Penetration Testing Report Structure

Effective reports translate technical findings into actionable business recommendations. Poor reporting wastes testing investment and delays remediation.

Executive Summary

High-level findings, business impact, risk rating.

Technical Details

Vulnerability descriptions, affected systems, reproduction steps.

Proof of Concept

Demonstration of exploitability with evidence.

Remediation

Specific recommendations with priority ratings.

Retest Results

Verification that fixes were properly applied.

Legal & Ethical Considerations

Penetration testing requires explicit authorization. Without proper legal protections, legitimate security testing can result in criminal charges.

!Written authorization (Rules of Engagement) must explicitly define scope
!Data handling procedures must comply with privacy regulations (GDPR, HIPAA)
!Coordination with incident response team avoids false positive alerts
!Insurance may require specific methodologies or certifications
!Chain of custody for evidence if criminal activity discovered

Key Takeaways

  • PTES and OSSTMM provide structured approaches with defined phases.
  • Reconnaissance→Exfiltration mirrors real adversary attack paths.
  • MITRE ATT&CK maps testing to real-world adversary techniques.
  • Written authorization is mandatory—verbal permission is insufficient.