Chrysolites Open Courses

Cybersecurity Topics: Threats, Defences and Careers · Course book

Chapter 14: Phases of a Penetration Test

Pairs with Lesson 14: The Phases of an Ethical Hacking Engagement

An authorised penetration test is not a random series of attempts to break in. It follows a structured sequence of phases, which mirrors the way real attackers operate while adding the safeguards, documentation and reporting that make the work useful to the client. Following the phases in order means that each step builds on the information gathered in the one before, that nothing important is skipped, and that the client receives evidence they can act on. This chapter walks through the commonly taught phases of ethical hacking: reconnaissance, scanning, gaining access, maintaining access, covering tracks and, most important of all, reporting. For each phase it explains the tester's goal and, just as importantly, what the same activity looks like from the defender's side, so that security teams can recognise real attackers at each stage. It then explains how findings are rated for severity and how a good report is structured.

Why a structured method matters

A structured method gives a penetration test three qualities. It is repeatable: two tests of the same system a year apart can be compared, showing whether security has improved. It is thorough: working through defined phases makes it less likely that whole areas are overlooked. And it is safe: the method includes checkpoints at which the tester confirms that the next activity is within scope and agreed in the rules of engagement, and plans to avoid disruption to live systems.

Several published methodologies exist, such as those from the penetration testing community and from standards bodies, and their phase names differ slightly. The six phases used in this chapter follow a common teaching model. In real engagements the phases overlap and repeat: discovering a new system during the access phase, for example, sends the tester back to scanning for that system.

Tests also differ in how much the tester is told at the start. In a black-box test, the tester begins with little more than the organisation's name, imitating an outside attacker; this is realistic but spends much of the budget on discovery. In a white-box test, the tester receives network diagrams, source code and accounts, allowing a deeper examination of more systems in the same time. A grey-box test sits between the two, for example providing an ordinary user account to show what a malicious customer or compromised employee could achieve. Many organisations choose grey-box testing as the best balance of realism and coverage. A related exercise, red teaming, is broader and longer: a team pursues a specific goal, such as reaching the finance system, by any agreed means, while the organisation's defenders, the blue team, try to detect and stop them, testing people and processes as well as technology.

1. Reconnaissance2. Scanning3. Gaining access4. Maintaining access5. Covering tracks6. Reporting new systems found: scan again the phase that delivers value
Figure 14.1 — The six phases of an ethical hacking engagement. Phases often loop back as new systems are discovered, and the report is what turns the test into improvements.

Phases 1 and 2: reconnaissance and scanning

Reconnaissance, covered in detail in the previous chapter, gathers information about the target organisation from public and directly queried sources. Its output is a picture of the organisation's people, domains, technologies and likely entry points.

Scanning turns that picture into a precise technical map. The tester checks which addresses in scope respond, which ports are open on each, which services and versions are running behind those ports, and whether any known vulnerabilities affect them. Tools such as network port scanners and vulnerability scanners automate much of this work, but the tester must interpret the results, since automated scanners produce false positives and miss issues that need human judgement. Scanning live production systems carries some risk, as aggressive scans can overload fragile equipment, so testers agree scan intensity and timing in advance.

From the defender's side, scanning is noisy. A single source contacting hundreds of ports in a short time, or requesting unusual paths on a web server in rapid succession, stands out clearly in firewall and web server logs. Organisations that alert on scanning gain early warning that someone is studying them, though real attackers often scan slowly or from many addresses to blend in.

Phases 3 and 4: gaining and maintaining access

In the gaining access phase, also called exploitation, the tester attempts to use the weaknesses found so far to get into systems: logging in with weak or default passwords, exploiting an unpatched vulnerability in a web application, or, if social engineering is in scope, persuading an employee to open a test phishing email. The aim is to prove that a weakness is real and to show what an attacker could reach through it. Testers stop short of actions that would cause harm, such as deleting data, and they treat any sensitive information they encounter with strict confidentiality.

Once inside, an attacker usually tries to escalate privileges, moving from an ordinary account to an administrator, and to move laterally to other systems. The tester does the same, within scope, because demonstrating that one weak password leads all the way to the company's finance database is far more persuasive than reporting the weak password alone.

The maintaining access phase tests whether an attacker could keep a foothold over time, for example by creating an extra account or installing a small program that reconnects after a restart. In an ethical test this is done only if agreed, with careful records, and everything is removed at the end. Defenders watch for exactly these signs in their own environment: new accounts, especially with administrator rights; new scheduled tasks or services; and programs that contact outside servers at regular intervals.

PhaseTester's goalWhat a defender might see
ReconnaissanceLearn about people and systemsLittle or nothing; some DNS queries; staff targeted on social media
ScanningMap hosts, ports, services and versionsBursts of connections to many ports; unusual web requests
Gaining accessExploit a weakness to get inFailed then successful logins; exploit patterns; alerts from endpoint tools
Maintaining accessShow persistence is possibleNew accounts, services or scheduled tasks; regular outbound connections
Covering tracksShow whether activity could be hiddenGaps in logs; cleared event logs; disabled security tools
ReportingExplain findings and fixes(Not applicable: delivered to the client)

Phase 5: covering tracks

Real attackers try to hide evidence of their presence by deleting or altering logs, removing their tools and disguising their activity as normal traffic. In an ethical engagement, this phase is handled very differently. Testers do not destroy the client's evidence; instead, where agreed, they assess whether an attacker could hide, for example by checking whether ordinary accounts can clear security logs or whether logs are sent to a separate, protected system. They also clean up after themselves, removing any test accounts and files, and record everything they did so the client can verify the clean-up.

For defenders, the lesson of this phase is the importance of protected logging. Logs that are copied immediately to a central system that attackers cannot easily reach, and alerts on attempts to clear logs or disable security software, make it far harder for an intruder to vanish without trace.

Phase 6: reporting and severity ratings

The report is the reason a penetration test exists. A brilliant technical test with a confusing report produces little improvement, while a clear report turns findings into fixes. A good report usually contains an executive summary in plain language for managers, describing the overall level of risk and the most important actions; a description of the scope and method; a list of findings, each with a description, evidence such as screenshots, the affected systems, a severity rating and specific remediation advice; and an appendix of technical detail. Many testers also offer a retest to confirm that fixes work.

Severity is commonly expressed using the Common Vulnerability Scoring System (CVSS), which produces a score from 0.0 to 10.0 based on factors such as how easily the flaw can be exploited, whether it requires an account or user interaction, and its impact on confidentiality, integrity and availability.

CVSS scoreSeverityTypical response
0.0NoneNo action needed
0.1 – 3.9LowFix during normal maintenance
4.0 – 6.9MediumPlan a fix within weeks
7.0 – 8.9HighFix as a priority, within days
9.0 – 10.0CriticalFix or mitigate immediately

A score alone does not settle priority. A "medium" flaw on an internet-facing payment system may deserve faster action than a "high" flaw on an isolated test server, so good reports explain the business context of each finding. Testers also highlight attack chains, where several individually modest weaknesses combine into a serious compromise; fixing one link in the chain may break it entirely, which helps clients spend effort where it matters most.

Check your understanding

  1. Name the six phases described in this chapter and the main goal of each.
  2. Give three reasons why penetration tests follow a structured method.
  3. Why is scanning described as "noisy", and how can defenders use that?
  4. Explain why ethical testers demonstrate privilege escalation and lateral movement rather than stopping at the first weakness.
  5. How does the covering-tracks phase differ between a real attacker and an ethical tester, and what defensive lesson does it teach?
  6. A flaw has a CVSS score of 7.4 on an isolated test server, and another scores 5.9 on the public login page. Which would you fix first, and why?

Install Chrysolites Open Courses

Android / Chrome / Edge: open the browser menu and choose Install app or Add to Home screen.

iPhone / iPad (Safari): tap the Share button, then Add to Home Screen.