Penetration Testing Methodology: Phases, Frameworks and Scoping

A penetration test (pen test) is an authorised, simulated attack on a system, designed to find weaknesses before real attackers do. It is not random hacking; it is a disciplined, repeatable, documented process with legal agreements at the front and a useful report at the end. This lesson explains the types of tests, the major methodologies, the phases and how professionals scope and manage an engagement. The following lessons then cover each phase in more depth, always within your own lab.

Penetration Test, Vulnerability Assessment, Red Team: What Is the Difference?

ActivityGoalDepthTypical output
Vulnerability assessmentFind and list known weaknesses broadlyBroad, mostly automatedPrioritised list of vulnerabilities
Penetration testShow whether weaknesses can really be used and what impact followsFocused, manual plus toolsVerified findings with evidence and fixes
Red team exerciseTest detection and response against a realistic adversary over timeObjective-driven, stealthy, often includes social and physical testsNarrative of the attack path and defender performance
Purple team exerciseImprove detections collaborativelyAttack and defend together, step by stepBetter detection rules and procedures
Bug bountyCrowdsourced testing of defined assetsVaries by researcherIndividual vulnerability reports

Types of Penetration Test by Knowledge

  • Black box: the tester has no inside information, simulating an external attacker. Realistic but slower.
  • Grey box: limited information, such as a standard user account or network diagram. A good balance for most engagements.
  • White box (crystal box): full information, including source code and architecture. Most thorough and efficient.

Types by Target

  • External network: internet-facing systems.
  • Internal network: an attacker or insider already inside the network.
  • Web application and API: see the web security lessons later in this series.
  • Wireless: access points and clients.
  • Mobile and IoT: apps, devices and back-end services.
  • Cloud: configuration, identity and workloads, within the provider’s rules.
  • Social engineering: phishing, phone and physical access, only with explicit approval and clear limits.
  • Physical: doors, badges and locks, with careful authorisation.

Major Methodologies and Standards

FrameworkFocus
PTES (Penetration Testing Execution Standard)End-to-end phases of a test, from pre-engagement to reporting
NIST SP 800-115Technical guide to information security testing and assessment
OSSTMMScientific methodology for operational security testing and metrics
OWASP Web Security Testing Guide (WSTG)Detailed test cases for web applications
OWASP MASVS / MASTGMobile application security verification and testing
MITRE ATT&CKAdversary behaviours for planning and red team scenarios
CREST, CHECK, and regulatory frameworks (for example, TIBER-EU)Accreditation schemes and intelligence-led testing programmes

The Phases (Based on PTES)

  1. Pre-engagement: define goals, scope, rules of engagement, legal agreements, timing and communication. See Ethical Hacking: Law and Ethics.
  2. Intelligence gathering (reconnaissance): collect information about the target; see Reconnaissance and OSINT.
  3. Threat modelling: identify the assets and the most likely or damaging attack paths.
  4. Vulnerability analysis: discover and validate weaknesses; see Scanning and Enumeration and Vulnerability Management.
  5. Exploitation: carefully demonstrate that selected weaknesses can be used to gain access, to the extent agreed; see How Exploits Work.
  6. Post-exploitation: assess the impact of access: what data or systems could an attacker reach? See Privilege Escalation and Lateral Movement.
  7. Reporting and retesting: deliver findings, advice and verification; see How to Write a Penetration Test Report.

Scoping an Engagement

Poor scoping causes most disputes. Agree these items in writing:

ItemQuestions to answer
ObjectivesWhat does the client want to learn: compliance proof, resilience, a specific risk?
TargetsExact IP ranges, domains, applications, user roles, environments (production or staging)
ExclusionsFragile systems, third-party services, certain techniques
TimingStart and end dates, hours, freeze periods
IntensityAre denial-of-service tests allowed? How noisy may scanning be?
Data handlingWhat data may be accessed and how evidence is stored and destroyed
CommunicationContacts, status updates and an emergency stop procedure
DeliverablesReport format, readout meeting, retest terms
LegalContract, authorisation letter, NDA, insurance, third-party permissions

A Worked Example: Small Web Shop (All Authorised)

A client asks for a grey-box test of its online shop. The pre-engagement stage agrees scope (the shop’s staging server and two test accounts) and bans denial-of-service testing. In intelligence gathering, the tester reviews the public site, technologies and exposed subdomains. Threat modelling highlights customer data and payment flows. Vulnerability analysis finds an outdated plugin and missing access checks on order pages. In the exploitation phase, the tester demonstrates, with test accounts only, that one customer’s order can be viewed by another. In post-exploitation analysis, they assess what else that access would reveal, stopping at agreed limits. The report explains each issue, rates its risk, provides fixes and offers a retest. At no point does the tester go outside the scope, and any real customer data seen is reported without being copied.

Professional Habits

  • Take notes continuously with timestamps, commands and screenshots; the report depends on them.
  • Prefer safe validation: prove a vulnerability exists with minimal impact (for example, reading one harmless record) rather than causing damage.
  • Communicate early if you find something critical or evidence of a real attacker.
  • Keep evidence secure and encrypted, and delete it as agreed after the engagement.
  • Stay humble: a test is a snapshot, not a guarantee.

Practice Exercises

  1. Write a scope statement and rules of engagement for a pretend test of your own home lab, including exclusions and an emergency stop contact.
  2. For each PTES phase, list one task you could perform in your lab and one tool or technique you would use.
  3. Explain to a non-technical manager the difference between a vulnerability scan and a penetration test.
  4. Choose one framework (for example, the OWASP WSTG) and read its table of contents. Which categories surprise you?
  5. Create a note-taking template with columns for time, target, action, result and evidence.

Mentor tip: The best penetration testers are not the ones with the cleverest exploit; they are the ones who communicate clearly, scope carefully and make the client’s systems measurably safer.

Educational use only: perform penetration testing only with written authorisation, within an agreed scope, or in your own lab.

Key takeaways
  • A penetration test is an authorised, scoped, documented attempt to use weaknesses and show their impact.
  • Vulnerability assessments are broad; pen tests are deeper; red teams test detection and response.
  • PTES, NIST SP 800-115, OSSTMM and OWASP WSTG are the main methodology references.
  • Scope, rules of engagement and legal permissions come before any technical work.
  • Good notes and clear reporting make the engagement valuable.

Related Lessons