root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat pentesting-fundamentals.md
// Fundamentals

Pentesting Fundamentals

18 Oct 2025 · 6 min read
This introductory room lays the conceptual foundations and ethical framework behind penetration testing ("pentesting"). It covers what pentesting is, the importance of ethics and scope, phased methodologies, the testing scopes (black, grey and white box), and closes with a hands-on simulation of a real engagement.
PlatformTryHackMe
CategoryFundamentals
DifficultyEasy
RoomPentesting Fundamentals

Task 1 — What is penetration testing?

Penetration testing is the ethical, authorized attempt to find vulnerabilities in a system by mimicking the techniques of a malicious attacker. It is essentially a security audit carried out with permission to strengthen an organization's defenses before a real adversary exploits them.

Task 2 — Penetration testing ethics

Before any test begins, the pentester and the client define the Rules of Engagement (ROE), the document that bounds the engagement:

  • Permission — the legal authorization to carry out the test.
  • Scope — which targets and services are within the allowed reach.
  • Rules — the technical boundaries, such as prohibited actions.
In practice, a solid ROE also pins down the testing window (start/end dates and hours), an emergency contact on both sides to halt the engagement if something breaks, and how findings will be reported at the end — details that turn "you have permission" into an engagement that can actually be planned, executed and audited.

Types of hacker

TypeDescription
White HatEthical pentesters acting with authorization.
Grey HatSometimes beneficial, but may breach laws or ethics.
Black HatMalicious actors with harmful intent.

Q: You are given permission to audit a system. What type of hacker are you?
A: White Hat

Q: Stealing data without consent. Which type of hacker?
A: Black Hat

Q: Document that defines the scope and permission of the test.
A: Rules of Engagement

Task 3 — Penetration testing methodologies

A pentest methodology typically follows these stages:

  1. Information Gathering — collecting public data about the target (OSINT).
  2. Enumeration / Scanning — identifying live hosts and exposed services.
  3. Exploitation — leveraging vulnerabilities to gain access.
  4. Privilege Escalation — expanding access horizontally or vertically.
  5. Post-Exploitation — pivoting, cleaning up and reporting.

Pentesting frameworks

FrameworkFocusProsCons
OSSTMMNetworks, telecoms and systemsVery comprehensiveDense and complex
OWASPWeb applicationsSimple and actively maintainedNo formal accreditation
NIST CSFOrganizational security postureWidely used and detailedGeneral-purpose, not pentest-focused
NCSC CAFCritical infrastructure and national frameworksGovernment-endorsedNiche, slower adoption

Each framework comes from a different governing body and suits a different kind of engagement: OSSTMM (Open Source Security Testing Methodology Manual) is maintained by ISECOM; OWASP (Open Web Application Security Project) also publishes the widely used OWASP Testing Guide and Top 10; NIST CSF (Cybersecurity Framework) comes from the US National Institute of Standards and Technology — for the technical mechanics of running a test, NIST separately publishes SP 800-115; and NCSC CAF (Cyber Assessment Framework) is issued by the UK's National Cyber Security Centre, commonly used to assess operators of essential services under the NIS Regulations.

Q: Stage where public information about the target is collected.
A: Information Gathering

Q: Framework aimed at auditing telecommunications networks.
A: OSSTMM

Q: Framework focused on web applications.
A: OWASP

Task 4 — Testing scopes: box types

The scope defines how much knowledge of the target the pentester has before starting:

  • Black-Box — no internal knowledge; simulates an external attacker.
  • Grey-Box — limited internal insight; better informed than black-box.
  • White-Box — full source and configuration access; thorough internal testing.

Q: Test type in which you do not have the source code.
A: Black Box

Q: Test type with full access to the source code.
A: White Box

Task 5 — Practical: ACME penetration test

The final task is a guided simulation over the fictional ACME infrastructure, applying every stage of the methodology you have learned. Completing the exercise yields the flag:

Flag: THM{PENTEST_COMPLETE}

Concept summary

TaskTopicKey outcome
1What is pentestingEthical, authorized audit
2Ethics & ROEAuthorized, scoped hacking
3MethodologiesFrom recon to reporting
4Box typesDifferent levels of knowledge
5PracticalSimulation → THM{PENTEST_COMPLETE}

Key takeaways

  • Pentesting is an ethical, authorized attack whose goal is to strengthen security, not harm it.
  • The Rules of Engagement (permission, scope and rules) legally bound every engagement.
  • The methodology runs from information gathering through post-exploitation and reporting.
  • OSSTMM, OWASP, NIST CSF and NCSC CAF cover different focuses depending on the target.
  • The scope (black, grey or white box) drives the strategy and preparation of the test.