SECURITY ENGINEERING · PART 5 · ETHICAL HACKING, STEP BY STEP · PROCESS · 58 OF 229

Penetration Testing Phases: The Full Process

A penetration test is an authorised, time-boxed attack on a system to find weaknesses before real attackers do. This episode walks through the whole process: scoping and permission, reconnaissance, scanning, exploitation, post-exploitation, reporting and retesting, the standards behind it (PTES, OWASP, NIST 800-115), black, grey and white box tests, and what the defending team should see at each phase.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 15

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Scope
  • recon
  • scan
  • exploit
  • post-exploit
  • report
  • retest, always with written permission

Notes

What a pentest is

A penetration test is a simulated attack on a system whose owner has asked you to test it. The goal is to find weaknesses that a real attacker could use, and to prove how far they lead. It is time-boxed, usually one to three weeks. The product is not the hack; the product is a report the owner can act on. And the difference between a penetration tester and a criminal is exactly one thing: written permission.

Definition
  • a simulated attack on a system the owner asked you to test
  • goal: find weaknesses a real attacker could use, and prove their impact
  • time-boxed: days or weeks
  • output: a report the owner can act on without permission it is not a pentest; it is a crime

Scan, pentest, red team

Four things are often confused. A vulnerability scan is automated and broad; it lists possible problems. A penetration test adds people, who verify those problems and chain them together inside an agreed scope. A red team exercise is quieter and goal-based, such as reach the payment database, and it tests whether the defenders notice. A bug bounty invites outside researchers and pays per valid finding. Companies use all four, for different purposes.

Know the difference
  • vulnerability scan: automated, broad, lists possible issues
  • penetration test: humans verify and chain issues in an agreed scope
  • red team: a quiet, goal-based attack that tests people and detection too
  • bug bounty: outside researchers, paid per finding

Phase 1: scope

Phase one is scoping, and it happens before any tool is run. What is in scope: which domains, address ranges, applications and accounts. What is explicitly out of scope. Which techniques are allowed, and at what hours. A signed authorisation letter. Emergency contacts on both sides in case something breaks. And how any sensitive data you come across will be handled. The next episode covers scope and rules of engagement in detail.

Pre-engagement
  • what is in scope: domains, IP ranges, apps, accounts
  • what is out of scope
  • allowed techniques and times
  • a signed authorisation letter
  • emergency contacts on both sides
  • how data found is handled
  • next episode covers this in detail

Phase 2: reconnaissance

Phase two is reconnaissance: learning as much as possible before touching the target. Passive recon uses only public sources, such as DNS records, certificate logs, search engines, code repositories, staff names and old password leaks. Active recon starts talking to the target. The output is a list of assets and technologies. For defenders there is a sobering point here: passive reconnaissance does not touch your systems, so you cannot see it happening.

Recon
  • passive: public sources only; DNS, certificates, search engines, code repos, staff names, leaked passwords
  • active: talking to the target; DNS queries, web requests
  • output: a list of assets and technologies
  • defender view: passive recon is invisible to you

Phase 3: scanning

Phase three is scanning and enumeration. A port scan finds which services are reachable. Version detection identifies the software behind them. Enumeration pulls out detail: user names, file shares, web directories, API endpoints. A vulnerability scan matches versions against known weaknesses. The output is a list of candidates that still have to be verified. For defenders, this phase is noisy: firewalls, intrusion detection and web logs should all show it.

Scanning and enumeration
  • port scan: which services are reachable
  • service and version detection
  • enumeration: users, shares, directories, API endpoints
  • vulnerability scan: match versions to known CVEs
  • output: a list of candidate weaknesses, to be verified
  • defender view: very noisy

Phase 4: exploitation

Phase four is exploitation: turning a candidate into proof. Proof might be a login, a file you should not be able to read, or code running on the server. The usual ways in are unglamorous: weak or reused passwords, missing patches, web application flaws and misconfiguration. A professional exploits with care: nothing that could take the service down or destroy data, only as far as the rules allow, and with every step and its time written down.

Exploitation
  • turn a candidate into proof: a login, a file read, code running
  • common ways in: weak or reused passwords, missing patches, web flaws, misconfiguration
  • care: no denial of service, no data destruction
  • record every step and time

Phase 5: post-exploit

Phase five is post-exploitation. One foothold is only a start; the real question is what it leads to. What can this account see? Can a normal user become an administrator, which is privilege escalation? Can you move from this machine to the next, which is lateral movement? Can you reach the agreed goal, such as customer data or cloud keys? This phase shows the real business impact. And at the end, the tester removes every account, file and tool they added.

After the first access
  • what can this account see?
  • privilege escalation: user to administrator
  • lateral movement: one machine to the next
  • reach the agreed goal: domain admin, customer data, cloud keys
  • shows real business impact
  • then: clean up everything

Phases 6 and 7

Phases six and seven. The report is the actual product. It has an executive summary in plain language, and for every finding: what it is, where, the evidence, a severity rating and how to fix it. It shows the attack path step by step. A debrief walks the teams through it. Then, after the fixes, a retest confirms each finding is closed. As a security engineer inside a company, you will be on the receiving end of these reports, and you turn them into work.

Report and retest
  • executive summary: risk in plain language
  • each finding: what, where, evidence, severity, how to fix
  • the attack path, step by step
  • a debrief with the teams
  • retest after fixes: closed, or still open
  • findings go into the backlog

Box colours

Tests differ in how much the tester is told. Black box: nothing, which simulates an outsider but spends most of the time on discovery. Grey box: some access and documentation, such as a normal user account. White box: source code, architecture diagrams and administrator access, which finds the most per day of testing. Most tests today are grey box, because you are paying for findings, not for the tester to guess what you could simply tell them.

Black, grey, white box
  • black box: no information; realistic outsider, but slow and shallow
  • grey box: some access and documentation, e.g. a normal user account
  • white box: source code, designs, admin access; deepest coverage per day
  • most tests today are grey

Standards

Professional tests follow named methods, so the work is repeatable. PTES, the penetration testing execution standard, defines the phases we just covered. The OWASP web security testing guide lists what to test in a web application. NIST special publication eight hundred one fifteen covers technical security testing. And MITRE ATT and CK is the catalogue of real attacker techniques that both testers and defenders use as a common language. Expect interviewers to name these.

Methodologies
  • PTES: Penetration Testing Execution Standard
  • OWASP WSTG: the web security testing guide
  • NIST SP 800-115: technical security testing
  • OSSTMM
  • MITRE ATT&CK: the catalogue of attacker techniques
  • reports reference these

The defender view

Now the defender's view, which this course adds to every attack. Recon leaves almost nothing. Scanning should light up firewall, intrusion detection and web logs. Exploitation shows as web firewall alerts, failed logins and crashes. Post-exploitation shows as new processes, unusual administrator logins and odd connections between machines. If a penetration test produces no alerts at all, that is itself a finding: your detection has a gap.

What blue teams should see
  • recon: little; watch CT logs and your own exposure
  • scanning: firewall, IDS and web logs light up exploitation: WAF alerts, failed logins, crashes
  • post-exploitation: new processes, admin logins, unusual connections
  • no alerts in a test is a finding too

Common mistakes

Mistakes. Testing without written permission, which is illegal however good your intentions. Drifting outside the agreed scope. Selling or buying an automated scan as a penetration test. Testing production with no emergency contacts. A report with no evidence, or no advice on fixing. On the company side: fixing each finding individually without asking what root cause produced them all, and never retesting.

Avoid these
  • testing without written permission
  • drifting out of scope
  • treating a scan as a pentest
  • testing production blind, with no contacts
  • a report with no evidence or no fixes
  • fixing findings one by one, not the root cause
  • never retesting

Say it like this

In the interview: it starts with scope and written authorisation, including rules of engagement. Then reconnaissance to map the attack surface, scanning and enumeration to find candidate weaknesses, exploitation to prove them, and post-exploitation to show the real impact, such as privilege escalation and lateral movement. Then cleanup, a report with evidence, severity and remediation, and a retest. I would add that I map findings to MITRE ATT and CK and check what our detection saw.

In the interview
  • "It starts with scope and written authorisation. Then recon, scanning and enumeration, exploitation to prove impact, post- exploitation to show how far
  • it goes, cleanup, a report
  • with evidence and fixes, and a retest."

Interview questions

Q1What is penetration testing?

An authorised, simulated attack on systems, networks or applications to identify exploitable weaknesses and demonstrate their impact, carried out within an agreed scope and time, and ending with a report of findings and remediation advice.

Q2What are the phases of a penetration test?

Pre-engagement (scope and authorisation), reconnaissance, scanning and enumeration, exploitation, post-exploitation, reporting, and retesting after remediation. Different standards name them slightly differently, but the sequence is the same.

Q3What is the difference between a vulnerability scan and a penetration test?

A vulnerability scan is automated and reports potential weaknesses, including false positives. A penetration test uses human testers to verify, exploit and chain weaknesses to show real impact, within a defined scope.

Q4What is the difference between black box, grey box and white box testing?

They describe how much information the tester receives: none (black box), partial such as credentials and documentation (grey box), or full including source code and architecture (white box). More information generally means deeper coverage in the same time.

Q5What is the difference between a pentest and a red team exercise?

A pentest aims to find as many weaknesses as possible in a defined scope, usually with the defenders' knowledge. A red team exercise pursues specific objectives covertly over a longer period, to test detection and response as well as prevention.

Q6Is penetration testing legal?

Only with explicit written authorisation from the owner of the systems, within the agreed scope. Accessing or testing systems without permission is an offence under computer misuse laws in most countries, regardless of intent.

Q7Which penetration testing methodologies are used?

Common ones are PTES, the OWASP Web Security Testing Guide, NIST SP 800-115 and OSSTMM, with MITRE ATT&CK used to describe attacker techniques. They make testing consistent and reports comparable.

Q8How often should a company run penetration tests?

Typically at least annually and after major changes, with higher-risk systems tested more often. Standards such as PCI DSS require regular testing. Many organisations complement periodic tests with continuous scanning and a bug bounty programme.