MarzleyTech Learn

Home / Learn / Advanced cybersecurity: defend, detect and respond like a professional / Ethical penetration testing: permission, scope, methodology, legal practice labs, bug bounties and report writing

Ethical penetration testing: permission, scope, methodology, legal practice labs, bug bounties and report writing

A penetration test is an authorised, simulated attack that shows an organisation how a real attacker could get in, so they can fix it first. The difference between a pentester and a criminal is permission, a defined scope, and a report that helps the client.

Types of security testing

TypeWhat it is
Vulnerability assessmentFind and list weaknesses (mostly scanning), no exploitation
Penetration testConfirm weaknesses can be exploited within agreed limits, show the impact
Red team exerciseLong, stealthy, goal-based simulation testing people, process and technology, including detection
Purple teamAttackers and defenders work together to improve detections
Bug bountyPublic or private programmes paying for valid reported vulnerabilities, under strict rules
Knowledge givenName
Nothing, like an outside attackerBlack box
Some (a user account, documentation)Grey box
Full (source code, architecture)White box

Step 1: pre-engagement (never skip this)

Before touching anything, get in writing:

  • Authorisation signed by someone who actually has the authority to approve testing of those systems (the system owner, not a junior staff member). Cloud and hosting providers may have their own testing policies too.
  • Scope: exact domains, IP ranges, apps and accounts in scope, and what is out of scope.
  • Rules of engagement: testing dates and times, allowed techniques (is social engineering allowed? denial of service is usually forbidden), how to handle sensitive data found, emergency contacts, and what happens if you find signs of a real attacker.
  • A contract or statement of work covering confidentiality and liability.

Lab: check a target against the agreed scope (run it)

Professionals double-check every target before testing. Python's ipaddress module makes this easy:

Python · runs live in the interactive lesson
import ipaddress

in_scope = [ipaddress.ip_network("192.0.2.0/28"), ipaddress.ip_network("198.51.100.10/32")]
out_of_scope = [ipaddress.ip_network("192.0.2.5/32")]   # client's payment server, excluded

def allowed(target):
    ip = ipaddress.ip_address(target)
    if any(ip in net for net in out_of_scope):
        return "NO - explicitly out of scope"
    if any(ip in net for net in in_scope):
        return "yes - in scope"
    return "NO - not listed in scope"

for t in ["192.0.2.3", "192.0.2.5", "192.0.2.20", "198.51.100.10"]:
    print(f"{t:15} {allowed(t)}")

192.0.2.20 is outside the /28 range (which covers .0 to .15), and .5 is excluded, so both must not be touched, even if they look interesting.

Step 2 onwards: the methodology

Recognised frameworks include the PTES (Penetration Testing Execution Standard), the OWASP Web Security Testing Guide and NIST SP 800-115.

PhaseGoalTypical tools (authorised use only)
ReconnaissanceLearn about the target from public sourcesSearch engines, DNS records, certificate transparency logs
Scanning and enumerationFind hosts, open ports, services and versionsNmap, web directory discovery tools
Vulnerability analysisMatch findings to known weaknessesVulnerability scanners, manual review
ExploitationProve a weakness is real, carefully and within scopeFrameworks such as Metasploit, Burp Suite
Post-exploitationShow business impact (only as far as the rules allow)Evidence collection, documenting access
ReportingExplain findings and fixes clearlyReport templates, screenshots
Clean-upRemove test accounts, files and tools you createdYour testing notes

Writing the report

The report is the product the client pays for. Include:

  • Executive summary: plain language for managers: overall risk, top issues, key recommendations.
  • Scope and methodology: what was tested, when and how.
  • Findings: for each one: title, severity (e.g. CVSS), affected systems, description, evidence (screenshots), business impact, and step-by-step remediation.
  • Positive findings: good controls you noticed.
  • Appendices: tools used, detailed output.

Example finding title: "High: Admin login page accessible from the internet without MFA, allowing password-guessing attacks. Fix: restrict access by IP or VPN and enforce MFA."

Legal places to practise

PlatformGood for
TryHackMeGuided beginner rooms and learning paths
Hack The Box (and HTB Academy)Realistic machines, structured courses
PortSwigger Web Security AcademyFree, excellent web security labs
OverTheWire (Bandit)Linux and command-line skills, free
picoCTFBeginner-friendly capture-the-flag challenges, free
OWASP Juice Shop, DVWAVulnerable apps you run in your own lab

Bug bounties

Platforms such as HackerOne, Bugcrowd and Intigriti host programmes where companies invite testing.

  • Read each programme's policy: scope, banned techniques, safe-harbour terms.
  • Test only listed assets, use your own test accounts, never access other users' data.
  • Expect duplicates and rejections at first; most beginners learn on labs for months before their first valid bug.
  • A programme's permission covers only what its policy says; a company without a programme has not invited testing.
Think about it: During an authorised web test, you find a database backup file on the server containing thousands of customers' ID numbers and phone numbers. What should you do?Show answer

Stop, don't download or open more than is needed to confirm what it is, and notify the client's emergency contact immediately as the rules of engagement require. Document the finding with minimal evidence (e.g. the file name and a redacted sample), recommend removing it and checking access logs to see if anyone else downloaded it, and don't keep any copy of the data.

Summary

  • Permission, scope and rules of engagement come before any testing.
  • Methodology: reconnaissance, scanning, vulnerability analysis, exploitation, post-exploitation, reporting, clean-up.
  • The report, with clear impact and fixes, is the real deliverable.
  • Practise only on legal platforms and your own lab; follow bug bounty policies exactly.

Check yourself

  1. What must you have before a penetration test? (two words: written ___)

    Show answer

    authorisation

  2. A test where the tester knows nothing in advance is a ___ box test (one word)

    Show answer

    black

  3. Which free PortSwigger resource teaches web security? (three words: Web Security ___)

    Show answer

    academy

Lesson 10 of 13 in Advanced cybersecurity: defend, detect and respond like a professional · Written by · Course notes