Skip to content
BoKSA

B11. Penetration Testing

B11. Penetration Testing

Level Intermediate, as a first step towards Advanced (the fiche puts this topic at Advanced)
Prerequisites B1 to B9, especially B4 Network protocols and B6 Attacks
Study time About 10 hours to start (4 h reading and video, 6 h in a legal lab), then ongoing practice
Source Teach-the-Teachers fiche B11
Next topics B12 Roles and certifications · knowledge base: Web and mobile security

⚠️ Legal first. Testing a system without the owner's written permission is a crime, even if you "only look" and mean well. In the Netherlands this is computervredebreuk (Article 138ab of the Criminal Code); every EU country has a similar law. Only practise on your own lab, on deliberately vulnerable machines, or on platforms that invite you to test them.

Why this matters

Organisations spend a lot on firewalls, patches and policies, but how do they know it all actually works? A penetration test (pentest) answers that question. An authorised specialist tries to break in the way a real attacker would, within agreed limits, and then reports what was possible, how serious it is and how to fix it.

For you as a future security specialist, penetration testing matters even if you never become a pentester:

  • you learn to think like an attacker, which makes you a better defender, developer or adviser;
  • you learn that security is about evidence, not assumptions ("we think it is safe" versus "we tested it and here are the results");
  • many organisations must test: DORA requires threat-led penetration testing (TLPT) for large financial entities, and NIS2 and ISO 27001 expect organisations to test whether their measures are effective;
  • pentest reports are often what you, as an adviser, will read and translate into risk and actions for management.

Learning objectives

Foundation. After this topic you can:

  1. Explain the difference between a criminal hacker and an ethical hacker or pentester (permission, scope, intent, reporting).
  2. Name the phases of a penetration test.
  3. Explain what the OWASP Top 10 is and name its first three items.

Intermediate. In addition you can:

  1. Explain the main frameworks (PTES, OWASP WSTG, NIST SP 800-115) and the documents that make a test legal (scope, rules of engagement).
  2. Name the tool categories a pentester uses and give an example of each.
  3. Practise on a legal platform and write a clear finding with a severity rating and a recommendation.

Towards Advanced. You can also explain the difference between a vulnerability scan, a pentest and a red team exercise, and relate pentesting to frameworks such as MITRE ATT&CK and TIBER-EU.

Foundation: what a pentest is

Ethical hacking versus criminal hacking

The techniques can be the same. What differs is everything around them:

Criminal hacker Ethical hacker / pentester
Permission None Written permission from the owner, signed before the test
Scope Anything they can reach Only the agreed systems, at the agreed times
Goal Profit, damage, espionage Find weaknesses so they can be fixed
Data Steals and uses it Touches as little as possible, keeps it confidential, deletes it afterwards
Result Damage A report with findings and recommendations

So is ethical hacking "dangerous"? Done carelessly, yes: a test can crash a production system or expose data. That is exactly why professionals work with a scope, rules of engagement, emergency contacts and backups, and why you only practise in a lab.

What if you find something by accident? In the Netherlands you can report it through coordinated vulnerability disclosure (CVD). Many organisations publish a CVD policy or a security.txt file that tells you how to report. Report only what you saw, do not dig deeper, do not keep data, and give the organisation time to fix it. The NCSC CVD guideline explains how this works.

Kinds of security testing

Test What it is Typical result
Vulnerability scan An automated tool checks systems for known weaknesses (missing patches, bad configuration) A long list of possible issues, including false positives
Penetration test A person verifies and exploits weaknesses within a scope, chains them together and judges the real impact A report with confirmed findings, impact and advice
Red team exercise A long, stealthy, goal-based simulation of a real adversary (for example "reach the payment system"), which also tests detection and response by the blue team Insight into how well the whole organisation detects and responds
Bug bounty An organisation invites outside researchers to find bugs and pays per valid finding Individual reports from many researchers

Pentests are also described by how much the tester knows in advance:

  • Black box: no information, like an outside attacker. Realistic, but slow.
  • Grey box: some information, for example a normal user account. The most common choice.
  • White box: full information, including source code and architecture. The most thorough per hour spent.

And by target: external network, internal network, web application, mobile app, API, cloud configuration, wireless, or people (social engineering, such as a phishing simulation).

The phases of a penetration test

Almost every methodology follows the same steps. The Penetration Testing Execution Standard (PTES) names seven:

  1. Pre-engagement. Agree on scope, goals, timing, contacts and rules. Get it signed.
  2. Intelligence gathering (reconnaissance). Collect information about the target: domains, IP ranges, technologies, employees. This is the first technical step (fiche question Q1).
  3. Threat modelling. Decide what is valuable and which attacks are most likely.
  4. Vulnerability analysis. Find weaknesses, with scanners and by hand.
  5. Exploitation. Prove that a weakness can really be used, carefully and within scope.
  6. Post-exploitation. Determine the impact: what data or systems could an attacker reach from here?
  7. Reporting. Explain findings, risk and fixes to both technical staff and management.

Note that only two of the seven phases are about "hacking". Preparation and reporting are at least as important, and the report is the product the client pays for.

The OWASP Top 10

The OWASP Top 10 is the best-known list of the most critical web application security risks. It is a standard awareness document for developers and a common starting point for web pentests. The 2025 edition:

# Risk In one sentence
A01 Broken Access Control Users can see or do things they should not, such as viewing another customer's order by changing a number in the URL
A02 Security Misconfiguration Default passwords, unnecessary features, verbose error messages, open cloud storage
A03 Software Supply Chain Failures Vulnerable or compromised libraries, build tools and dependencies
A04 Cryptographic Failures Sensitive data not encrypted, or encrypted badly
A05 Injection User input is treated as code, such as SQL injection and cross-site scripting
A06 Insecure Design The design itself is flawed, for example no limit on password-reset attempts
A07 Authentication Failures Weak login, session or password-reset handling
A08 Software or Data Integrity Failures Updates, data or code are trusted without checking integrity
A09 Security Logging and Alerting Failures Attacks are not logged or nobody is alerted
A10 Mishandling of Exceptional Conditions Errors and unexpected situations leave the application in an unsafe state

What is SQL injection? (fiche question Q3.) An application builds a database query by pasting user input directly into it. If the input contains SQL syntax, the attacker changes the meaning of the query and can, for example, read other users' data or bypass a login. The fix is not "filtering bad characters" but parameterised queries (prepared statements), which keep data and code strictly separate. The OWASP SQL Injection Prevention Cheat Sheet explains it well.

Intermediate: working like a professional

Frameworks and standards

Framework What it gives you
PTES The seven phases above, with detail per phase
OWASP Web Security Testing Guide (WSTG) A complete checklist and method for testing web applications
OWASP ASVS Security requirements per level, useful as the "norm" a web application is tested against
NIST SP 800-115 The US government's technical guide to security testing and assessment
MITRE ATT&CK A knowledge base of real attacker tactics and techniques, used to plan red team tests and to describe findings in a language defenders understand
TIBER-EU / DORA TLPT The European framework for intelligence-led red teaming of financial institutions (in the Netherlands run by De Nederlandsche Bank as TIBER-NL)

Scope and rules of engagement

Before any test, the client and the tester sign documents that answer at least these questions:

  • What is in scope? Exact IP addresses, domains, applications, accounts. Everything else is out of scope.
  • When? Test window and time zone; are tests during office hours allowed?
  • What is not allowed? For example denial of service, social engineering of employees, or touching production data.
  • Who to call? Emergency contacts on both sides, and what happens if the tester finds evidence of a real attacker already inside.
  • Who owns the systems? Cloud and hosting providers may have their own rules; a company cannot give permission for systems it does not own.
  • How is data handled? Confidentiality, encryption of findings, and deletion after the project.

Without this, a pentest is legally just an attack.

Tool categories

You will meet these tools in labs and courses. Learn what each category is for; the specific tool changes over the years.

Category Purpose Examples
Testing distribution An operating system with hundreds of tools pre-installed Kali Linux, Parrot OS
Network discovery Find hosts, open ports and services in scope Nmap (see B4)
Vulnerability scanning Automated check for known weaknesses Greenbone OpenVAS, Nessus, Nuclei
Web proxy Intercept and modify traffic between browser and web application Burp Suite Community, OWASP ZAP
Exploitation framework A library of known exploits with a common interface Metasploit Framework
Password auditing Test how strong passwords are, offline against hashes or online against a login Hashcat, John the Ripper, Hydra
Traffic analysis Inspect what actually goes over the network Wireshark
CMS scanners Check content management systems for known plugin and configuration issues WPScan for WordPress
Reporting and notes Keep evidence and write the report Obsidian, CherryTree, SysReptor

The fiche mentions brute-forcing a login (Hydra) and scanning WordPress (WPScan). The defensive lesson from those exercises matters most: rate limiting, account lockout, MFA and keeping plugins updated stop exactly these attacks. Try them only against your own lab machines.

Severity and reporting

A finding without a clear severity and fix is useless to the client. Professionals rate findings with the Common Vulnerability Scoring System (CVSS) (current version 4.0), from 0.0 to 10.0, and then adjust for the client's business context.

A good finding contains:

  1. Title: short and specific ("Customer orders visible to other customers").
  2. Severity: CVSS score and a plain-language rating (low, medium, high, critical).
  3. Description: what the weakness is, in words a non-specialist can follow.
  4. Evidence: screenshots or request and response, enough to reproduce.
  5. Impact: what an attacker could do with it, in business terms.
  6. Recommendation: a concrete fix, plus a reference (for example the OWASP Cheat Sheet).

The report starts with a one-page management summary: overall risk, the three most important findings, and what to do first.

Pentesting and the blue team

A pentest is also a test for the defenders. Did the SOC see it? Were alerts raised? In a purple team exercise, attackers (red) and defenders (blue) work side by side: every attack step is checked against the logs, and detection is improved straight away. This links directly to B9 Incident response and to security operations.

Towards Advanced

  • Chaining: real impact usually comes from combining several low-severity findings into one serious attack path.
  • Active Directory and cloud: most internal tests in companies focus on Windows domains and cloud identity (Entra ID, AWS IAM). These are large fields of their own.
  • AI systems: testing LLM applications for prompt injection and data leakage is a new specialisation. See the OWASP Top 10 for LLM Applications.
  • Certifications: see B12 for entry and professional pentest certifications.

In practice

All exercises use legal targets only.

Exercise 1: permission or not? (Foundation, 30 min, group)

Discuss these cases and decide whether they are legal, and why:

  1. You notice that your school's web portal shows other students' grades if you change a number in the URL.
  2. A friend asks you to "test" their employer's website.
  3. You scan scanme.nmap.org.
  4. You find a vulnerable server through a search engine and log in with a default password "just to check".
  5. A company has a bug bounty programme on a public platform, and the website you test is listed in scope.

Then read the NCSC page on reporting a vulnerability and write down what you should do in case 1.

Exercise 2: OWASP Top 10 in the browser (Foundation/Intermediate, 3–4 h)

Create a free account at the PortSwigger Web Security Academy. Do the Apprentice labs on Access control and SQL injection. For each lab, write down in two sentences what the vulnerability was and how a developer should have prevented it.

Exercise 3: your own lab (Intermediate, 2 h)

Build a small, isolated practice lab with a hypervisor (VirtualBox or VMware Workstation) on a host-only network:

Make sure the vulnerable machines can never reach the internet or your home network. Document your lab in a short diagram.

Exercise 4: guided learning path (Intermediate, ongoing)

Follow a beginner path on TryHackMe (for example Pre Security, then Jr Penetration Tester) or Hack The Box Academy. Watch the Hacker101 pentesting series alongside it. Keep notes per machine: what you found, what worked, what did not.

Exercise 5: write a finding (Intermediate, 1 h)

Pick one vulnerability you found in exercise 2, 3 or 4. Write it up as a professional finding using the six parts above. Calculate the CVSS 4.0 score with the FIRST calculator. Swap with a classmate: could they reproduce it and explain the risk to a manager?

Exercise 6: the defender's view (Foundation, 1 h)

Work through the Wireshark exercise in the Hacker Highschool lesson Defensive Hacking (page 15). Which signs in the traffic would tell a defender that someone is scanning or attacking?

Tools

Tool Use Cost
Kali Linux Testing distribution for your lab Free
Nmap Network discovery Free
Burp Suite Community Web proxy, used in the PortSwigger labs Free (Pro is paid)
OWASP ZAP Open-source web proxy and scanner Free
Greenbone OpenVAS Vulnerability scanner Free community edition
Metasploit Framework Exploitation framework Free
Wireshark Traffic analysis Free
OWASP Juice Shop Vulnerable web application for practice Free
FIRST CVSS calculator Rate the severity of findings Free

Videos

Handouts and reading

Literature and courses

Common mistakes

  • Testing without written permission, or outside the agreed scope. Good intentions are not a legal defence.
  • Treating scanner output as the result. A scanner finds possible issues; a pentester verifies them and removes false positives.
  • Skipping reconnaissance and jumping straight to tools. Most findings come from understanding the target.
  • Poor notes. If you cannot reproduce a finding, you cannot report it.
  • Writing only for technicians. Management needs to understand the risk and the priority.
  • Connecting vulnerable lab machines to the internet or your home network.
  • Thinking a passed pentest means "secure". A pentest is a snapshot of a limited scope at one moment.

Check yourself

  1. What is the first step in a penetration test?
  2. "Ethical hacking is something dangerous to do." Is this correct?
  3. What is SQL injection, and how do you prevent it?
  4. What is the difference between a vulnerability scan and a penetration test?
  5. Name three things that should be in the rules of engagement.
  6. What are the first three items of the OWASP Top 10:2025?
  7. What does CVSS tell you, and what does it not tell you?
Answers

1. Pre-engagement: agreeing scope and rules and getting written permission. The first technical step is information gathering (reconnaissance).
2. Partly. Without permission it is illegal, and careless testing can disrupt systems. With written permission, a clear scope and careful work it is a normal, valuable professional activity.
3. User input is inserted into a database query so that it changes the query's meaning. Prevent it with parameterised queries (prepared statements), plus least-privilege database accounts.
4. A scan is automated and lists possible known weaknesses. A pentest is done by a person who verifies, exploits and combines weaknesses and judges the real impact.
5. For example: the exact scope, the test window, forbidden activities, emergency contacts, and how data is handled.
6. A01 Broken Access Control, A02 Security Misconfiguration, A03 Software Supply Chain Failures.
7. CVSS gives a standard technical severity score (0.0–10.0). It does not know your business context, such as how valuable the affected system is to you, so the final priority still needs judgement.