Methodology & Practice
Introduction to Penetration Testing
What Is Penetration Testing?
Penetration testing also called pen testing or ethical hacking is the authorized, simulated attack on a computer system, network, web application, or physical environment performed by security professionals to identify security vulnerabilities that real attackers could exploit. Unlike vulnerability scanning — which only identifies potential weaknesses — penetration testing actively exploits them to demonstrate real-world impact and business risk.
Penetration Testing vs. Vulnerability Assessment vs. Red Team
| Dimension | Vulnerability Assessment | Penetration Test | Red Team Exercise |
|---|---|---|---|
| Objective | Identify and catalogue vulnerabilities | Exploit vulnerabilities to demonstrate impact | Simulate a full adversary campaign against specific objectives |
| Depth | Broad, surface-level scan | Deep exploitation of confirmed findings | Full kill chain simulation including evasion and persistence |
| Scope | Typically all in-scope assets | Defined target systems or domains | Entire organization — people, process, and technology |
| Blue Team Notified? | Usually yes | Usually yes (except black-box) | No — tests detection and response capability |
| Duration | Days | 1–4 weeks typically | Weeks to months |
| Primary Output | Vulnerability list with CVSS scores | Exploitation evidence with business impact | Attack narrative with detection gaps and resilience findings |
| Best Used For | Routine hygiene; compliance baseline | Testing specific security controls and risk | Validating full security program maturity |
Why Penetration Testing Is Essential
Organizations invest heavily in security controls — firewalls, EDR, IAM, patching programs — but these controls are only effective if they function correctly against real adversary techniques. Penetration testing answers questions that no other security activity can:
- Can an external attacker gain initial access to our network?
- If a credential is compromised, how far can an attacker move laterally?
- Can our security monitoring detect and respond to a real attack in progress?
- Are our most critical assets (financial systems, customer data, intellectual property) actually protected?
- Does our patching program eliminate vulnerabilities before attackers can exploit them?
- Would a social engineering attack succeed against our trained workforce?
Core Terminology
| Term | Definition |
|---|---|
| Attack Surface | The total set of entry points an attacker can use to attempt unauthorized access — includes systems, applications, APIs, users, and physical access points |
| Exploit | Code or technique that takes advantage of a vulnerability to achieve an unauthorized outcome (e.g., remote code execution, privilege escalation) |
| Payload | The code executed on a target system after successful exploitation (e.g., a reverse shell, a Meterpreter session) |
| Shell | A command-line interface giving the attacker interactive control over a target system — bind shell (target listens) or reverse shell (target connects back) |
| Privilege Escalation | Gaining a higher level of access than initially obtained — horizontal (different user at same level) or vertical (user → admin/root) |
| Persistence | Techniques used to maintain access to a compromised system across reboots, credential changes, and other disruptions |
| Lateral Movement | Moving from the initially compromised host to other systems within the network to reach high-value targets |
| Pivoting | Using a compromised host as a relay to reach network segments that are not directly accessible |
| C2 (Command & Control) | Infrastructure used by an attacker to maintain communication with and control over compromised systems |
| OSINT | Open Source Intelligence — information gathered from publicly available sources without direct interaction with the target |
| CVSS Score | Common Vulnerability Scoring System — standardized 0–10 numerical rating of a vulnerability’s severity |
| CVE | Common Vulnerabilities and Exposures — public catalogue of known software vulnerabilities with unique identifiers (e.g., CVE-2021-44228) |
| Zero-Day | A vulnerability that is unknown to the vendor and for which no patch exists — highest value and risk |
| MITRE ATT&CK | Globally-accessible knowledge base of adversary tactics and techniques based on real-world observations — standard reference for pen testing and red teaming |
Classifying Penetration Tests
Knowledge Level Classifications
Penetration tests are categorized by how much information the tester is given about the target environment before testing begins. Each model has specific advantages and is appropriate for different testing objectives:
| Model | Knowledge Provided | Advantages | Best Used For |
|---|---|---|---|
| Black Box | Nothing — tester has no prior knowledge of internal systems, architecture, or credentials | Closest simulation of an external attacker with no insider information; tests real-world attack surface | External network tests; simulating opportunistic attackers; testing perimeter defenses |
| Grey Box | Partial — tester has user-level credentials, network diagrams, or application documentation | More efficient than black box; tests authenticated attack paths; better coverage in limited time | Web application testing; internal network testing; authenticated API testing |
| White Box | Full — tester has complete access to source code, architecture diagrams, credentials, and configurations | Maximum coverage; identifies vulnerabilities not externally visible; most cost-effective per finding | Code review; configuration audits; verifying specific security controls; compliance testing |
Testing Domain Classifications
| Test Domain | Scope & Focus | Key Techniques |
|---|---|---|
| External Network | Internet-facing infrastructure: perimeter firewalls, VPNs, public-facing services, email gateways, DNS | Port scanning, service enumeration, exploit known CVEs, credential stuffing, SSL/TLS analysis, firewall rule testing |
| Internal Network | Internal corporate network: workstations, servers, Active Directory, internal applications, network devices | AD enumeration, Pass-the-Hash/Ticket, Kerberoasting, lateral movement, network protocol attacks (SMB, LDAP, DNS) |
| Web Application | Web apps, APIs, mobile backend services, OAuth flows, authentication mechanisms | OWASP Top 10 testing, authentication bypass, injection attacks, broken access control, API fuzzing, JWT manipulation |
| Wireless | Wi-Fi networks, rogue access points, WPA2/3 security, Bluetooth, RFID | WPA2 handshake capture, evil twin attacks, PMKID attack, deauthentication, guest network segmentation testing |
| Social Engineering | Human layer: phishing, vishing, physical access, pretexting | Spear phishing campaigns, USB drop attacks, tailgating/physical access testing, vishing scenarios, MFA bypass attempts |
| Cloud Infrastructure | AWS/Azure/GCP services, IAM policies, S3 buckets, container configurations, serverless functions | Misconfiguration review, IAM privilege escalation, metadata service attacks, storage enumeration, cross-account attacks |
| Mobile Application | iOS and Android apps, mobile APIs, local data storage, inter-process communication | Traffic interception, certificate pinning bypass, local storage analysis, deep link exploitation, intent injection |
| OT/ICS/SCADA | Operational technology, industrial control systems, PLCs, HMIs, SCADA networks | Passive enumeration, protocol analysis (Modbus, DNP3), firmware analysis — CRITICAL: safety constraints required |
Selecting the Right Test
| Business Objective | Recommended Test Type(s) |
|---|---|
| Compliance with PCI DSS, HIPAA, or SOC 2 | External + Internal Network penetration test; Web application test for customer-facing systems |
| Pre-launch validation of new web application | White-box web application penetration test + API security assessment |
| Testing response to a phishing campaign | Social engineering assessment (phishing simulation) with IR team coordination |
| Validating cloud security posture post-migration | Cloud configuration review + cloud penetration test (AWS/Azure/GCP) |
| Testing full security program maturity | Red team exercise simulating targeted threat actor with defined crown-jewel objectives |
| Insider threat / privileged access testing | Internal grey-box test with standard user or IT user credentials |
| Physical security and tailgating risk | Physical penetration test + social engineering combined assessment |
Pre-Engagement Phase
The pre-engagement phase establishes the legal, procedural, and logistical foundation for the entire penetration test. Failures in pre-engagement — unclear scope, missing authorizations, undefined emergency contacts — are the leading cause of incidents, legal exposure, and failed tests. This phase requires as much rigor as the technical testing itself.
Engagement Documentation Requirements
No testing activity may begin without ALL of the following documents reviewed, negotiated, and signed by authorized parties on both sides:
| Document | Purpose & Required Content |
|---|---|
| Statement of Work (SOW) | Defines deliverables, timeline, methodology, and commercial terms. Must specify: test type, domains in scope, deliverable format, payment terms, and project schedule. |
| Rules of Engagement (ROE) | Operational boundaries for the test. Must specify: testing hours, allowed techniques, prohibited actions (production impact limits), emergency halt procedures, and escalation contacts. |
| Authorization Letter / Permission to Test | Explicit written authorization from the system/data owner. Must identify: tester identities, target systems, authorized IP ranges, testing period, and emergency contacts. This is your legal protection. |
| Non-Disclosure Agreement (NDA) | Protects client confidentiality of findings and proprietary information. Must cover: finding information, system architectures, credentials encountered, and business-sensitive data observed during testing. |
| Emergency Contact Sheet | 24/7 contacts for immediate notification if a real incident is discovered, critical service is affected, or testing must be halted immediately. |
Scoping Methodology
Scope definition is the most consequential pre-engagement decision. Scope that is too narrow produces incomplete findings; scope that is too broad produces unfocused results and cost overruns.
Network & Infrastructure Scoping
- Define all IP ranges, CIDR blocks, and hostnames explicitly in scope — ambiguity creates legal risk
- Identify explicitly out-of-scope systems (third-party hosting, shared environments, DR systems, production databases with real PII)
- Specify whether cloud accounts, sub-domains, and acquired company infrastructure are in scope
- Identify third-party systems that may be touched (CDNs, WAFs, DDoS protection services) — these require third-party authorization
- Document whether Denial of Service testing is authorized — this must be explicit, not assumed
Application Scoping
- List all application URLs, APIs, and mobile apps in scope with their environments (production vs. staging)
- Specify whether testing on production data is authorized or whether a sanitized test environment is required
- Define authenticated testing roles: which user roles will testers operate as?
- Identify rate-limited or business-critical transaction flows where testing intensity must be limited
Social Engineering Scoping
- Define allowed social engineering techniques: phishing email only, vishing calls, physical access testing
- Specify whether employees are aware a test is happening (announced vs. unannounced)
- Define what counts as a ‘success’ — clicking a link, submitting credentials, granting physical access
- Establish procedures for staff who report the test — they should not be told it is a test until after campaign close
Rules of Engagement (ROE) — Key Clauses
| ROE Element | Standard Specification |
|---|---|
| Testing Hours | Define permitted testing windows (e.g., 06:00–22:00 local time weekdays; 24/7 for external passive reconnaissance only) to minimize business impact |
| Destructive Testing | Explicitly state whether destructive exploits (deleting files, crashing services, corrupting data) are authorized — default is NO unless specifically approved |
| Data Handling | Define what happens to any sensitive data encountered: must not be exfiltrated, must be encrypted if stored, must be deleted within X days of report delivery |
| Credential Handling | Credentials discovered during testing must be documented, not used beyond agreed scope, and immediately reported to client — no credential reuse outside test scope |
| Emergency Stop Procedure | Define exact trigger conditions and procedure for immediately halting testing (e.g., discovering real active attacker, unintended production impact, client business emergency) |
| Notification Threshold | Define what must be immediately reported to client vs. documented in final report only (e.g., actively exploited zero-day, discovered ransomware indicator, critical CVSS 9+ finding) |
| Physical Access | If physical testing is authorized: tester identification procedures, facility access hours, escorted vs. unescorted, allowable tools (lock picks, RFID cloners, etc.) |
| Third-Party Authorization | Tester must obtain written authorization from all cloud providers, ISPs, and third-party service operators for any testing touching their infrastructure |
Testing Methodology Overview
The penetration testing methodology follows a structured, repeatable lifecycle. While the specific techniques vary by target domain, the logical flow is consistent across all test types.
| Phase | Name | Objective & Output |
|---|---|---|
| 1 | Reconnaissance | Gather intelligence about the target without active interaction — builds the attack map that drives all subsequent phases |
| 2 | Scanning & Enumeration | Actively probe target systems to identify open ports, services, versions, and configurations — builds the vulnerability hypothesis list |
| 3 | Vulnerability Analysis | Correlate enumeration findings with known vulnerabilities to identify exploitable weaknesses — prioritized by risk and exploitability |
| 4 | Exploitation | Attempt to exploit identified vulnerabilities to confirm exploitability and establish initial access — prove that a real attacker could succeed |
| 5 | Post-Exploitation | Demonstrate what an attacker could achieve after initial access: privilege escalation, lateral movement, data access, persistence |
| 6 | Reporting | Document all findings with evidence, business impact, and remediation guidance — the deliverable that drives security improvement |
Reconnaissance
Reconnaissance is the intelligence-gathering phase. The goal is to build the most complete picture of the target’s attack surface using only publicly available information and authorized scanning — before touching a single target system. A well-executed reconnaissance phase directly determines the quality and efficiency of everything that follows.
Passive Reconnaissance (OSINT)
Passive reconnaissance gathers information without any direct interaction with the target’s systems. Because it uses only publicly available data, it carries zero technical risk to the tester and produces no evidence of testing activity in the target’s logs.
OSINT Techniques & Sources
| OSINT Category | Technique | Tools & Sources |
|---|---|---|
| DNS Intelligence | DNS record enumeration: A, MX, NS, TXT, CNAME, SPF records; zone transfer attempts; subdomain discovery | dnsdumpster.com, SecurityTrails, Amass, Subfinder, MXToolbox, dig, nslookup |
| IP & Network Intelligence | WHOIS data, ASN lookup, IP range ownership, BGP routing data, historical IP assignments | ARIN/RIPE WHOIS, Shodan, Censys, BGPView, Hurricane Electric BGP Toolkit |
| Search Engine Dorking | Advanced search queries to find exposed files, login pages, configuration files, database dumps, employee data | Google Dorks (site:, filetype:, inurl:), Bing, GHDB (Google Hacking Database) |
| Certificate Transparency | SSL/TLS certificate logs reveal subdomains and internal hostnames not publicly listed in DNS | crt.sh, Censys certificates, SSLMate, Facebook CT |
| Code Repository Mining | Searching public GitHub/GitLab/Bitbucket repos for hardcoded credentials, API keys, internal URLs, architecture details | GitHub Search, GitLeaks, truffleHog, Gitrob, GitHub Dorking |
| Employee & Org Intelligence | LinkedIn profiling for technology stack, employee names/titles, email format discovery, job posting analysis | LinkedIn, Hunter.io, theHarvester, EmailHarvester, OSINT Framework |
| Breach Database Intelligence | Checking if organizational email addresses or domains appear in known data breach datasets | HaveIBeenPwned, DeHashed, Breach-Parse, dark web monitoring services |
| Technology Fingerprinting | Identifying web frameworks, CMS platforms, CDNs, WAFs, and server technologies from public sources | Wappalyzer, BuiltWith, Netcraft, Shodan, SecurityHeaders.com |
| Physical & Geographic | Google Maps Street View, satellite imagery, building access analysis, parking lot surveillance planning (for physical tests) | Google Maps, Google Earth, Bing Maps, LinkedIn location data |
Active Reconnaissance
Active reconnaissance involves direct interaction with target systems. While it generates log entries on the target, it remains in the reconnaissance phase because no exploitation attempts are made. Active recon must stay within authorized scope.
- DNS brute-forcing and zone transfers — attempt to enumerate all subdomains and records from DNS servers
- Web spidering / crawling — automated discovery of application pages, endpoints, and parameters
- Directory and file fuzzing — enumerate hidden directories, backup files, and administrative interfaces using wordlists
- Banner grabbing — connect to services to retrieve version information from banners (HTTP headers, SSH banners, SMTP EHLO)
- Email harvesting with validation — verify discovered email addresses are active via SMTP enumeration
- WAF/IDS fingerprinting — identify security controls in place to inform evasion planning
Reconnaissance Deliverables
Before proceeding to scanning, document all reconnaissance findings in a structured format. The reconnaissance report serves as the test’s intelligence brief and attack map:
- Domain InventoryAll confirmed domains, subdomains, and IP ranges owned by the target
- Technology InventoryIdentified frameworks, server software, security controls, cloud providers
- Employee DataKey personnel with security responsibilities, email format, technology expertise visible in public sources
- Exposed Sensitive DataAPI keys, credentials, internal URLs, or architecture details found in public sources — critical findings, report immediately
- Attack Surface SummaryPrioritized list of high-value entry points identified for scanning and exploitation phases
Scanning & Enumeration
Scanning builds on reconnaissance by actively probing target systems to map open services, identify software versions, and enumerate configuration details. Together, scanning and enumeration generate the technical evidence base for vulnerability analysis.
Network Scanning
Host Discovery
Before port scanning, confirm which hosts are alive to avoid wasting time on non-existent targets:
- ICMP ping sweep — fastest method; often blocked by firewalls on hardened networks
- TCP SYN ping (port 80/443) — more reliable through firewalls; sends SYN, looks for SYN-ACK
- ARP scan — most reliable on local subnets; cannot cross routers
- UDP ping — useful when ICMP and TCP are filtered
Port Scanning Techniques
| Scan Type | How It Works | Best Used For |
|---|---|---|
| TCP SYN Scan (-sS) | Sends SYN; open ports return SYN-ACK; tester sends RST (no full connection — ‘stealth scan’) | Default for privileged users; fastest and most reliable port scan; lower IDS visibility than full connect |
| TCP Connect Scan (-sT) | Completes full 3-way TCP handshake; logged by target system | Non-privileged users; when SYN scan is not possible; more reliable in some NAT environments |
| UDP Scan (-sU) | Sends UDP packets; closed ports return ICMP Port Unreachable; open ports often silent | Identifying UDP services (DNS, SNMP, DHCP, TFTP) — slower and less reliable than TCP scans |
| Service Version Detection (-sV) | Probes open ports to determine exact service name and version | Building vulnerability list; critical for identifying exploitable software versions |
| OS Detection (-O) | Analyzes TCP/IP stack behavior to fingerprint the operating system and version | Understanding target environment; identifying OS-specific vulnerabilities |
| Script Scan (-sC) | Runs NSE (Nmap Scripting Engine) scripts for additional enumeration | Automated detection of common vulnerabilities, misconfigurations, and useful information |
Service Enumeration
Once open ports and services are identified, enumerate each service in detail to extract actionable intelligence:
| Service / Port | Protocol | Key Enumeration Targets | Primary Tools |
|---|---|---|---|
| TCP 21 | FTP | Anonymous login; software version; directory listing; writable directories | Nmap scripts, ftp client, Metasploit ftp modules |
| TCP 22 | SSH | Software version (OpenSSH version for CVE lookup); enabled authentication methods; weak algorithms | ssh-audit, Nmap -sV, Metasploit ssh_version |
| TCP 25/465/587 | SMTP | Open relay testing; user enumeration (VRFY/EXPN); software version; STARTTLS enforcement | smtp-user-enum, Nmap smtp scripts, swaks |
| TCP/UDP 53 | DNS | Zone transfer (AXFR); subdomain enumeration; DNS cache snooping; DNSSEC validation | dig, dnsrecon, Fierce, dnsx |
| TCP 80/443 | HTTP/HTTPS | Web server version; HTTP methods; directory structure; TLS configuration; security headers | Nikto, gobuster, dirb, whatweb, testssl.sh |
| TCP 445 | SMB | OS version; share enumeration; null sessions; SMB signing; EternalBlue (MS17-010) | Nmap smb scripts, enum4linux, smbclient, Metasploit |
| TCP 389/636 | LDAP | Domain naming context; user/group enumeration (anonymous); domain controller identification | ldapsearch, ldapdomaindump, ADExplorer, BloodHound |
| TCP 1433/3306 | MSSQL/MySQL | Version; accessible databases; stored procedures; linked servers; xp_cmdshell status | Nmap db scripts, sqlmap, sqsh, mysql client |
| UDP 161/162 | SNMP | Community string brute-force; device configuration; routing tables; user enumeration | snmpwalk, snmp-check, Metasploit snmp modules, onesixtyone |
| TCP 3389 | RDP | Software version; NLA enforcement; BlueKeep (CVE-2019-0708); weak encryption | Nmap rdp scripts, rdp-sec-check, Metasploit rdp modules |
Active Directory Enumeration
Active Directory is the primary identity infrastructure in most enterprise environments and is a critical target in any internal penetration test. Thorough AD enumeration often reveals the complete path from initial access to domain dominance:
- Domain ControllersIdentify all DCs, their OS versions, and FSMO roles
- User EnumerationFull user list, privileged account identification, service accounts, stale accounts, password policy (minimum length, lockout threshold, complexity requirements)
- Group EnumerationDomain Admins, Enterprise Admins, Server Operators, Backup Operators — who has privileged access?
- Trust RelationshipsDomain trusts and their directions — can compromise of a child domain lead to parent domain compromise?
- Group Policy ObjectsIdentify GPOs that push scripts, configure security settings, or deploy software — potential misuse for lateral movement
- Kerberos ConfigurationIdentify Service Principal Names (SPNs) for Kerberoasting; identify AS-REP Roastable accounts (no pre-authentication required)
- ACL AnalysisIdentify over-permissive Access Control Lists — especially write/GenericAll permissions on sensitive objects (BloodHound excels at this)
Vulnerability Analysis & Exploitation
Vulnerability Analysis
Vulnerability analysis correlates enumeration data with known vulnerability databases to identify which discovered services, versions, and configurations have exploitable weaknesses. This phase produces the prioritized target list for exploitation.
- Cross-reference discovered software versions against CVE databases (NVD, Exploit-DB, Vulners) for known vulnerabilities
- Run automated vulnerability scanners (Nessus, OpenVAS, Nexpose) to identify known vulnerabilities at scale — validate all critical findings manually
- Analyze service configurations for security weaknesses: default credentials, weak cipher suites, missing patches, insecure protocols
- Review web application structure for OWASP Top 10 vulnerabilities through manual analysis and automated tools
- Prioritize findings using CVSS score PLUS exploitability context: is there a public exploit? Does it require authentication? Is the attack surface network-accessible?
- Document each finding with: CVE reference (if applicable), affected component, evidence of existence, CVSS score, and exploitation hypothesis
OWASP Top 10 — Web Application Vulnerability Reference
| # | Vulnerability | Description | Test Technique |
|---|---|---|---|
| A01 | Broken Access Control | Users can access resources or perform actions beyond their intended permissions | IDOR testing; horizontal/vertical privilege escalation; forced browsing; JWT role manipulation |
| A02 | Cryptographic Failures | Sensitive data exposed due to weak or absent encryption at rest or in transit | Check HTTPS enforcement; test TLS configuration; look for plaintext data in transit; inspect client-side storage |
| A03 | Injection | Malicious data sent to interpreter as part of a command or query (SQLi, Command Injection, LDAP injection) | Manual and automated injection testing; sqlmap for SQLi; Burp Suite Active Scanner; manual parameter fuzzing |
| A04 | Insecure Design | Architectural flaws that exist by design — not fixable by patching, require redesign | Business logic testing; threat modeling review; rate limiting bypass; workflow manipulation |
| A05 | Security Misconfiguration | Insecure default configurations, missing hardening, verbose error messages, open cloud storage | Configuration review; default credential testing; error message analysis; S3/blob storage enumeration |
| A06 | Vulnerable & Outdated Components | Use of libraries, frameworks, or other software with known vulnerabilities | Component inventory analysis; dependency scanning (OWASP Dependency-Check, Snyk); CVE correlation |
| A07 | Identification & Authentication Failures | Weaknesses in authentication: weak passwords, broken session management, missing MFA, credential stuffing | Brute force testing (within rate limits); session token analysis; MFA bypass techniques; default credential testing |
| A08 | Software & Data Integrity Failures | Code and infrastructure not protected against integrity violations — unsigned updates, insecure CI/CD | CI/CD pipeline review; software signature verification; deserialization testing |
| A09 | Security Logging & Monitoring Failures | Insufficient logging to detect attacks in progress — tested as a documentation finding, not exploited directly | Verify whether test activities generate alerts; review available log coverage; test log injection |
| A10 | Server-Side Request Forgery (SSRF) | Attacker causes server to make HTTP requests to internal or external systems | Test URL parameters, image/file fetch endpoints, webhook configurations for SSRF; attempt cloud metadata access |
Exploitation
Exploitation is the phase where identified vulnerabilities are actively leveraged to gain unauthorized access. In a penetration test, exploitation serves to confirm that a vulnerability is genuinely exploitable and to demonstrate the real business impact of that exploitation.
Network Exploitation Techniques
| Attack Category | Common Techniques | MITRE ATT&CK Mapping |
|---|---|---|
| Initial Access via Public Services | Exploit public-facing service CVEs (Apache, IIS, Exchange, VPN); default credentials on admin interfaces; exposed remote management (RDP, SSH, VNC) | T1190 Exploit Public-Facing Application; T1133 External Remote Services; T1078 Valid Accounts |
| Credential-Based Attacks | Password spraying; credential stuffing; brute force (where authorized); NTLM relay attacks; Pass-the-Hash; Pass-the-Ticket (Kerberos) | T1110 Brute Force; T1557 Adversary-in-the-Middle; T1550 Use Alt Auth Material |
| Active Directory Attacks | Kerberoasting (request TGS for service accounts → offline crack); AS-REP Roasting; DCSync; Zerologon (CVE-2020-1472) | T1558 Steal or Forge Kerberos Tickets; T1003 OS Credential Dumping |
| Network Protocol Exploitation | LLMNR/NBT-NS poisoning (Responder); SMB relay attacks; IPv6 DNS takeover (mitm6); ARP spoofing | T1557 Adversary-in-the-Middle; T1040 Network Sniffing |
| Web Application Exploitation | SQL injection data extraction; Remote Code Execution via file upload; Server-Side Template Injection; deserialization exploits; OAuth misconfigurations | T1190 Exploit Public-Facing App; T1059 Command and Scripting Interpreter |
Common Exploitation Frameworks
| Framework / Tool | Primary Use | Key Capabilities |
|---|---|---|
| Metasploit Framework | Network and service exploitation; post-exploitation | 1,900+ exploit modules; Meterpreter payload; automated post-exploitation; pivoting; evasion modules |
| Burp Suite Professional | Web application testing | HTTP proxy; active scanner; Intruder (fuzzing); Collaborator (SSRF/XXE OOB); extension ecosystem (BApp Store) |
| Cobalt Strike | Adversary simulation; C2 infrastructure | Beacon C2 agent; malleable profiles for AV evasion; team server; lateral movement; reporting |
| Impacket | Windows/AD protocol exploitation | Python implementations of Windows protocols: SMB, MSRPC, NTLM, Kerberos; secretsdump; psexec; ntlmrelayx |
| PowerSploit / PowerShell Empire | Windows post-exploitation; AD attacks | PowerShell-based attack framework; Invoke-Mimikatz; Invoke-Kerberoast; privilege escalation modules |
| CrackMapExec / NetExec | Active Directory attack automation | SMB/LDAP/MSSQL enumeration; credential validation; lateral movement; module framework |
Post-Exploitation
Post-exploitation answers the most important question in a penetration test: what could an attacker do after gaining initial access? A single foothold on a low-privilege workstation may appear minor — but post-exploitation activities frequently reveal that an attacker could reach Domain Admin, exfiltrate sensitive data, or achieve complete business disruption.
Privilege Escalation
After initial access, the tester works to elevate privileges to maximize the impact they can demonstrate.
Windows Privilege Escalation
| Technique | Mechanism | Detection Indicator |
|---|---|---|
| Unquoted Service Paths | Windows service with spaces in path and no quotes — attacker places executable in ambiguous path location | New executable in unusual path; service binary path audit |
| Weak Service Permissions | Service binary or directory writable by non-admin user — replace with malicious executable | Service binary hash change; unexpected file modification |
| DLL Hijacking | Application searches insecure paths for DLLs — attacker places malicious DLL in search path | Unexpected DLL in application directory; process loading unsigned DLL |
| Token Impersonation (SeImpersonatePrivilege) | Service accounts with SeImpersonatePrivilege can be escalated to SYSTEM via Potato attacks (PrintSpoofer, JuicyPotato) | SYSTEM process spawned by service account; Potato binary execution |
| AlwaysInstallElevated | Registry policy allowing MSI packages to install as SYSTEM — malicious MSI achieves SYSTEM privilege | MSI installation from non-admin user; registry key value audit |
| CVE-Based Escalation | Kernel or local privilege escalation CVEs: PrintNightmare (CVE-2021-34527), HiveNightmare, various Windows kernel exploits | Known CVE exploit execution; unusual kernel module loading |
Linux Privilege Escalation
- SUID/SGID binaries — executables running as root regardless of calling user; GTFOBins database of exploitable binaries
- Writable /etc/passwd or /etc/shadow — direct password modification or hash extraction
- Sudo misconfigurations —
sudo -lreveals commands executable as root without password; GTFOBins exploitation - Cron job exploitation — world-writable scripts executed by cron as root
- Kernel exploits — dirty pipe (CVE-2022-0847), dirty cow (CVE-2016-5195), overlayfs escalations
- Credentials in config files, environment variables, .bash_history, and application configuration
Lateral Movement Techniques
Lateral movement expands the tester’s footprint across the network to demonstrate the full scope of attacker access and the value of assets that could be compromised:
| Technique | How It Works | Prerequisite |
|---|---|---|
| Pass-the-Hash (PtH) | Use captured NTLM hash directly for authentication without knowing the plaintext password | Local admin or domain account NTLM hash from credential dump (Mimikatz, secretsdump) |
| Pass-the-Ticket (PtT) | Inject stolen Kerberos TGT or TGS ticket into current session for authentication | Captured Kerberos ticket (from Mimikatz, Rubeus, or secretsdump) |
| Overpass-the-Hash | Convert NTLM hash to Kerberos ticket for use in Kerberos authentication environments | NTLM hash of domain account (from local LSASS dump) |
| Golden Ticket | Forge a Kerberos TGT using the krbtgt account hash — grants unlimited domain access | Domain SID + krbtgt NTLM hash (requires DC compromise) |
| Silver Ticket | Forge a Kerberos TGS for a specific service without contacting the KDC | Target service account NTLM hash; works offline — no KDC contact |
| Remote Execution (SMB) | Use admin shares (C$, ADMIN$) or PSEXEC/WMIEXEC/DCOMEXEC to execute commands on remote systems | Local or domain admin credentials on target system |
| LDAP / Kerberos-Based Movement | Use AD permissions to reset passwords, add to groups, or request access to additional resources | Write/GenericAll permissions identified via BloodHound ACL analysis |
Credential Harvesting
- LSASS Memory Dumping — Mimikatz, ProcDump + Mimikatz offline: extracts plaintext passwords, NTLM hashes, and Kerberos tickets from Windows LSASS process
- NTDS.dit Extraction — database of all domain account hashes; extractable via VSS shadow copy, ntdsutil, or DCSync attack
- SAM Database — local Windows account hashes; accessible as SYSTEM via registry export or VSS
- Kerberoasting — request TGS tickets for service accounts (SPNs); extract ticket from memory; crack offline with hashcat
- AS-REP Roasting — accounts with Kerberos pre-auth disabled; request AS-REP without credentials; crack offline
- DPAPI Master Key Extraction — decrypt Chrome/Edge saved passwords, certificate private keys, other DPAPI-protected secrets
- Credential Files — searching file system, shares, and databases for credentials in plaintext: config files, scripts, password managers, email attachments
Demonstrating Crown Jewel Access
The culmination of post-exploitation is demonstrating access to the organization’s most critical assets — the ‘crown jewels’ defined during pre-engagement scoping:
| Crown Jewel Target | Demonstration Method (Safe for Engagement) |
|---|---|
| Domain Admin / Enterprise Admin | Achieve DA privileges; screenshot of whoami /groups showing DA membership; BloodHound attack path visualization |
| Active Directory Database (NTDS.dit) | Perform DCSync or VSS extraction; document hash count; do NOT crack or retain actual password hashes beyond test period |
| Financial / ERP System | Authenticate to financial application with harvested credentials; screenshot demonstrating access to financial records (no actual data extracted) |
| Customer PII Database | Demonstrate query access to customer database; document table/column names and row count; do NOT extract real PII — document schema only |
| Email System (Exchange / M365) | Authenticate to administrative interface; demonstrate ability to access all mailboxes; no email content extraction without explicit client approval |
| Source Code Repository | Authenticate to code repository with elevated privileges; document repositories accessible; no source code copied off-client environment |
Penetration Test Reporting
The penetration test report is the primary deliverable — the document that transforms technical findings into actionable security improvement. A poor technical test with an excellent report is more valuable than an excellent test with a poor report. Findings must be written for multiple audiences: technical teams who will remediate, and executives who must understand business risk and prioritize investment.
Report Structure
| Report Section | Content Requirements |
|---|---|
| Executive Summary | Non-technical overview of test purpose, scope, overall security posture, critical findings summary, and strategic recommendations. Written for CISO, CEO, and Board. Maximum 2–3 pages. |
| Engagement Overview | Test type, scope, methodology used, testing dates, tester team, limitations encountered, and tools used. Provides context for all subsequent findings. |
| Attack Narrative | Chronological story of the test: how the tester progressed from initial access to highest access achieved. Shows attack chain and demonstrates real-world attacker perspective. |
| Executive Risk Summary | Risk-rated finding counts by severity; risk heat map or chart; comparison to industry benchmarks where available; overall risk score. |
| Technical Findings | Full finding details for every identified vulnerability — see Finding Template below. Organized by severity (Critical → High → Medium → Low → Informational). |
| Appendices | Raw tool output; screenshot evidence; network diagrams annotated with attack paths; hash evidence; full payload and command listings. |
Finding Template — Required Fields
Severity Rating Framework
| Severity | CVSS Range | Definition | Remediation Timeline |
|---|---|---|---|
| CRITICAL | 9.0–10.0 | Remote unauthenticated exploitation with critical impact; ransomware-enabling; AD compromise; direct data breach path | Within 7 days — emergency patch/mitigate; notify CISO immediately |
| HIGH | 7.0–8.9 | Significant impact but may require authentication or specific conditions; privilege escalation; significant data exposure | Within 30 days — prioritized patching cycle |
| MEDIUM | 4.0–6.9 | Limited impact or significant exploitation difficulty; information disclosure; indirect attack path | Within 90 days — standard vulnerability management process |
| LOW | 0.1–3.9 | Minimal direct impact; defense-in-depth weakness; useful for attackers only in combination with other findings | Scheduled remediation — next maintenance cycle |
| INFORMATIONAL | N/A | Best-practice recommendations; hardening opportunities; findings with no direct security impact | Address during normal development/operations cycles |
Writing for Multiple Audiences
| Audience | What They Need to Know | Writing Guidance |
|---|---|---|
| Board / C-Suite | What is the business risk? What does it cost to fix? What is the regulatory exposure? How do we compare to peers? | Avoid technical jargon entirely. Translate exploitation to business outcomes: ‘An attacker could access all 240,000 customer records’ not ‘SQLi in login endpoint’ |
| CISO / Security Management | What are the highest priorities? What is the attack narrative? What is the risk posture? | Summary statistics; risk trend; attack chain narrative; strategic remediation roadmap with resource requirements |
| System Owners / Developers | Exactly what is vulnerable, where is it, and how do I fix it specifically? | Full technical detail; exact affected endpoints; working proof-of-concept; specific code/configuration fix instructions; framework-specific guidance |
| Auditors / Compliance | Does this represent a compliance failure? What evidence proves remediation? | Regulatory framework mapping (PCI DSS requirement, HIPAA control); evidence of exploitation; remediation verification process |
Specialized Assessment Domains
Cloud Penetration Testing
Cloud environments introduce attack surfaces fundamentally different from on-premises infrastructure. Misconfiguration — not software vulnerabilities — is the dominant risk vector in cloud environments. Cloud penetration testing requires specific expertise in cloud-native IAM, service configurations, and shared responsibility model implications.
Cloud-Specific Attack Techniques
| Attack Category | Technique | AWS / Azure / GCP Specifics |
|---|---|---|
| IAM Privilege Escalation | Over-permissive IAM roles; misconfigured assume-role policies; privilege escalation via policy attachment | AWS: iam:PassRole, sts:AssumeRole chains; Azure: contributor role escalation; GCP: service account key misuse |
| Metadata Service Attacks (SSRF) | Attacker-induced SSRF reaching cloud metadata endpoint extracts temporary credentials | AWS: 169.254.169.254/latest/meta-data/; IMDSv2 enforcement testing; Azure: 169.254.169.254 IMDS; GCP: metadata.google.internal |
| Storage Misconfiguration | Publicly accessible storage buckets/blobs containing sensitive data; insufficient access logging | AWS S3 public ACL/bucket policy; Azure Blob public access; GCP Storage public buckets; use GrayhatWarfare, cloudenum |
| Container & K8s Attacks | Misconfigured container registries; privileged container escape; exposed Kubernetes API; RBAC misconfigurations | Docker socket access; K8s API server unauthenticated; Pod security policy bypass; etcd exposure |
| Serverless Function Exploitation | Injection attacks against Lambda/Azure Functions; excessive permissions; sensitive data in environment variables | Lambda environment variable extraction; event injection; function URL exposure; SQS/SNS injection |
Social Engineering Assessment
Social engineering tests the human layer of security — often the most exploitable attack surface in any organization. These assessments require careful ethical handling, explicit scope definition, and careful management of employee welfare throughout.
Phishing Campaign Methodology
- Define campaign objectives and success criteria (click rate, credential submission rate, MFA bypass rate)
- Profile target users: seniority, department, role-appropriate pretexts (IT helpdesk, HR, finance themes)
- Design phishing infrastructure: domain registration (typosquatting, look-alike domain), email template, credential harvesting page
- Validate deliverability: test against spam filters, DMARC/SPF/DKIM alignment; adjust as needed
- Execute phishing campaign within authorized window; track clicks, submissions, and reports
- Debrief: inform recipients that the email was a test; provide immediate security awareness training
- Report: campaign metrics; who clicked, who submitted credentials, who reported; by department breakdown
Physical Penetration Testing
Physical penetration testing assesses the organization’s physical security controls — access control systems, security staff responses, surveillance coverage, and physical security policies.
- Tailgating / PiggybackingFollowing authorized personnel through secure access points; tests staff compliance with badge policy
- Social Engineering / PretextingImpersonating IT support, delivery personnel, or new employees to gain facility access
- RFID CloningCapturing and cloning proximity card credentials using a Proxmark or similar device
- Lock Picking / BypassTesting physical lock quality; using bypass tools on lever-handle locks, padlocks, or electric strikes
- Dumpster DivingExamining discarded materials for sensitive information: old hardware, documents, access badges, printed credentials
- USB Drop TestPlacing labeled USB drives in facility; tracking how many are plugged into corporate systems and reported
Legal & Ethical Framework
Legal Authorization Framework
Penetration testing without proper authorization violates computer crime laws in virtually every jurisdiction. Understanding the legal framework is a professional and ethical obligation for every practitioner:
| Law / Regulation | Jurisdiction | Relevance to Penetration Testing |
|---|---|---|
| Computer Fraud & Abuse Act (CFAA) | United States | Primary US computer crime law. Unauthorized access to ‘protected computers’ is criminal. Written authorization from system owner is the essential protection. No authorization = federal crime. |
| Computer Misuse Act (CMA) 1990 | United Kingdom | Criminalizes unauthorized access to computer systems. Section 1 (unauthorized access), Section 2 (with intent), Section 3 (unauthorized modification). Authorization scope must be crystal clear. |
| GDPR Article 32 / Data Protection Laws | EU / UK / Global | Any testing that accesses or processes personal data of EU residents must comply with GDPR. Do not exfiltrate real personal data during testing. Engagement agreements must address data handling. |
| Electronic Communications Privacy Act (ECPA) | United States | Governs interception of electronic communications. Relevant in social engineering and network traffic capture scenarios — ensure client authorization explicitly covers these activities. |
| Cloud Provider Acceptable Use Policies | Global (AWS, Azure, GCP) | All major cloud providers require pre-authorization notification before penetration testing their infrastructure. AWS: Vulnerability & Penetration Testing Policy must be followed. Violation = account termination. |
| PCI DSS Requirement 11.4 | Global (card industry) | Requires annual penetration testing of systems in the cardholder data environment (CDE). Testing must follow industry-standard methodology and be performed by qualified internal or external resource. |
Professional Ethics Standards
- Scope AdherenceTest only what is explicitly authorized — no exceptions, no ‘while we’re here’ additions
- Minimal FootprintUse the least invasive technique that demonstrates the finding; avoid unnecessary system impact
- ConfidentialityTreat all client information as strictly confidential; proper NDA required before engagement initiation
- Responsible DisclosureIf a previously unknown vulnerability is discovered, follow responsible disclosure practices — notify vendor before public disclosure
- No Personal BenefitNever use access obtained during an engagement for any purpose beyond the engagement objectives
- Client ProtectionIf a real attacker is discovered during testing, immediately notify the client — do not proceed with authorized testing while real attacker is active
- Data MinimizationCollect only the minimum evidence necessary to demonstrate exploitation; never exfiltrate or retain client data beyond engagement period
- Truthful ReportingReport all findings accurately — do not exaggerate or minimize findings for commercial or relationship reasons
Professional Certifications
| Certification | Issuing Body | Relevance & Recognition |
|---|---|---|
| OSCP (Offensive Security Certified Professional) | Offensive Security | Gold standard hands-on certification; 24-hour exam on live lab environment; demonstrates practical exploitation skill; widely required by employers and clients |
| GPEN (GIAC Penetration Tester) | GIAC / SANS | Comprehensive coverage of network pen testing methodology; respected in enterprise and government sectors; proctored exam with labs |
| CEH (Certified Ethical Hacker) | EC-Council | Broad coverage of hacking concepts and tools; most recognized by compliance frameworks and non-technical hiring managers; good foundation certification |
| GWAPT (GIAC Web App Penetration Tester) | GIAC / SANS | Specialized web application testing certification; covers OWASP methodology and advanced web exploitation techniques |
| CRTO (Certified Red Team Operator) | Zero-Point Security | Practical Cobalt Strike and red team operations certification; excellent for adversary simulation and C2 infrastructure |
| eWPT / eJPT | eLearnSecurity | Accessible entry-level certifications; practical exam format; good introduction to web app and network pen testing respectively |
Quick Reference — Penetration Testing Key Terms
| Term | Definition |
|---|---|
| Black Box Test | Penetration test with no prior knowledge of the target environment — simulates external attacker |
| White Box Test | Penetration test with full knowledge: source code, architecture, credentials — maximum coverage |
| OSINT | Open Source Intelligence — information gathered from public sources without target system interaction |
| CVE | Common Vulnerabilities and Exposures — unique identifier for known software vulnerabilities |
| CVSS | Common Vulnerability Scoring System — standardized 0–10 severity rating for vulnerabilities |
| Exploit | Code or technique that leverages a vulnerability to achieve unauthorized access or control |
| Payload | Code executed on a target system after successful exploitation (e.g., reverse shell, Meterpreter) |
| Privilege Escalation | Gaining higher access than initially obtained — vertical (user → admin) or horizontal (user → user) |
| Lateral Movement | Progressing from an initially compromised system to other systems within the network |
| OWASP Top 10 | Top 10 most critical web application security risks — industry-standard web testing reference |
| Kerberoasting | Requesting Kerberos TGS tickets for accounts with SPNs; cracking hashes offline to recover passwords |
| Pass-the-Hash | Using a captured NTLM hash to authenticate without knowing the plaintext password |
| BloodHound | AD attack path visualization tool — maps relationships between AD objects to identify privilege escalation paths |
| STRIDE | Threat modeling taxonomy: Spoofing, Tampering, Repudiation, Information Disclosure, DoS, Elevation of Privilege |
| Rules of Engagement (ROE) | Operational boundaries for a penetration test: testing hours, prohibited actions, emergency procedures |
| MITRE ATT&CK | Knowledge base of adversary tactics and techniques used to map findings to real-world threat actor behavior |
| C2 (Command & Control) | Infrastructure used to maintain communication with and control over compromised systems |
| Zero-Day | A vulnerability unknown to the vendor with no available patch — highest severity finding in any engagement |
Appendix A: Pre-Engagement Checklist
Complete all items before any testing activity begins. No exceptions — each item represents a legal, ethical, or operational requirement.
| ✓ | Pre-Engagement Requirement | Owner |
|---|---|---|
| Legal & Authorization | ||
| ☐ | Statement of Work (SOW) fully executed by both parties | Legal / PM |
| ☐ | Rules of Engagement (ROE) reviewed, negotiated, and signed | Lead Tester + Client |
| ☐ | Authorization Letter / Permission to Test document signed by system owner | Client |
| ☐ | NDA executed by all testers who will access client information | Legal |
| ☐ | Third-party authorizations obtained for all cloud providers / CDNs in scope | Client + Tester |
| ☐ | AWS/Azure/GCP penetration testing policy reviewed and followed | Lead Tester |
| Scoping & Technical | ||
| ☐ | All in-scope IP ranges, domains, and URLs formally documented | Lead Tester |
| ☐ | All out-of-scope systems explicitly documented to prevent accidental testing | Lead Tester + Client |
| ☐ | Testing environment confirmed (production vs. staging — document implications) | Client |
| ☐ | Test accounts / credentials provisioned (for grey-box engagements) | Client |
| ☐ | Testing hours and blackout periods confirmed | Both Parties |
| ☐ | Destructive testing authorization explicitly confirmed (default: NO) | Client |
| Operational | ||
| ☐ | Emergency contact list (24/7) obtained from client — primary and backup | PM |
| ☐ | Emergency stop procedure reviewed with all team members | Lead Tester |
| ☐ | Tester source IPs documented and whitelisted with client where appropriate | Lead Tester + Client IT |
| ☐ | Report format and delivery method agreed | PM |
| ☐ | Data handling and retention requirements agreed and documented | Legal / PM |
| ☐ | Internal team kickoff completed — all testers briefed on scope and ROE | Lead Tester |
Appendix B: Tools Quick Reference
| Tool | Category | Primary Use Case |
|---|---|---|
| Nmap | Scanning | Port scanning; service version detection; OS fingerprinting; NSE script automation |
| Nessus / OpenVAS | Vulnerability Scanning | Comprehensive vulnerability identification; authenticated and unauthenticated scanning; compliance checks |
| Metasploit Framework | Exploitation / Post-Exploitation | Exploit framework; Meterpreter; pivoting; auxiliary modules; post-exploitation automation |
| Burp Suite Pro | Web App Testing | HTTP proxy; web vulnerability scanner; Intruder; Collaborator; extension ecosystem |
| BloodHound + SharpHound | AD Enumeration | Active Directory attack path analysis; privilege escalation path visualization; ACL analysis |
| Mimikatz | Credential Harvesting | LSASS credential extraction; Pass-the-Hash; Kerberos ticket manipulation; DCSync |
| Responder | Network Attacks | LLMNR/NBT-NS poisoning; NTLM hash capture; credential relay setup |
| Impacket Suite | Windows Protocol Attacks | SMB attacks; secretsdump; ntlmrelayx; psexec; Kerberos attacks; LDAP queries |
| Amass / Subfinder | Reconnaissance | Subdomain enumeration; DNS intelligence gathering; asset discovery |
| theHarvester | OSINT | Email, name, domain, and IP gathering from public sources and search engines |
| Gobuster / ffuf | Web Enumeration | Directory and file brute-forcing; DNS subdomain fuzzing; virtual host discovery |
| sqlmap | Injection Testing | Automated SQL injection detection and exploitation; database extraction; authentication bypass |
| Hashcat / John the Ripper | Password Cracking | Offline hash cracking; dictionary attacks; rule-based attacks; mask attacks |
| Proxmark3 | Physical / RFID | RFID and NFC card reading, analysis, and cloning for physical penetration tests |
| GoPhish | Social Engineering | Open-source phishing campaign framework; tracking; credential harvesting landing pages |
| Shodan / Censys | Reconnaissance | Internet-wide scan database; identify exposed services, devices, and vulnerabilities before testing |
Appendix C: Recommended Resources
- PTES (Penetration Testing Execution Standard) — pentest-standard.org — comprehensive methodology reference
- OWASP Testing Guide v4.2 — owasp.org/www-project-web-security-testing-guide
- NIST SP 800-115 — Technical Guide to Information Security Testing and Assessment
- MITRE ATT&CK Framework — attack.mitre.org — adversary TTP knowledge base; essential for reporting and red teaming
- Exploit-DB — exploit-db.com — searchable database of public exploits and shellcode
- PayloadsAllTheThings — github.com/swisskyrepo/PayloadsAllTheThings — payload collection for every vulnerability class
- HackTricks — book.hacktricks.xyz — comprehensive pentesting techniques and checklists
- TryHackMe / HackTheBox — online lab platforms for hands-on penetration testing practice
- GTFOBins — gtfobins.github.io — Unix binaries exploitable for privilege escalation and bypass
- LOLBAS — lolbas-project.github.io — Living Off the Land Binaries and Scripts for Windows