Ethical Hacking: Authorisation, Scope and Building a Safe Lab
Where legitimate offensive security begins: the law and permission, rules of engagement and scope, types of engagement (penetration test, red team, bug bounty, CTF), professional ethics, and how to build an isolated practice lab with vulnerable targets so you can learn without harming anyone.
Offence in the service of defence
Attackers think differently from defenders. Offensive security professionals deliberately attack systems, with permission, to find weaknesses before criminals do, and to test whether the defenders notice. The work is valuable because it shows how a real attacker would proceed, which tells you which controls matter and whether your detection works.
Related roles and terms:
| Term | Meaning |
|---|---|
| Vulnerability assessment | Finding and listing weaknesses, usually with scanners; does not exploit them |
| Penetration test (pentest) | Authorised, time-boxed attempt to exploit weaknesses to show real impact, followed by a report |
| Red team | A goal-driven simulation of a real adversary (for example “reach the finance database”) that also tests detection and response, usually unannounced to most staff |
| Blue team | The defenders: monitoring, detection, response |
| Purple team | Red and blue working together, sharing techniques and detection results to improve both |
| Bug bounty | A programme where researchers are rewarded for responsibly reporting vulnerabilities within published rules |
| CTF (capture the flag) | A legal competition with deliberately vulnerable challenges |
| Black, grey, white box | Testing with no, partial or full knowledge of the target’s internals |
The law and permission
Most countries criminalise unauthorised access to computer systems, interception of communications, damaging data and possessing tools for those purposes with intent. Examples include the Computer Fraud and Abuse Act (US), the Computer Misuse Act 1990 (UK), the Budapest Convention that many countries follow, and in Nigeria the Cybercrimes (Prohibition, Prevention, etc.) Act 2015 (as amended). Details vary, and laws change, so take advice for your own jurisdiction.
The key points are consistent:
- Intent is not a defence. “I was only checking whether it was secure” does not make unauthorised access lawful.
- Permission must be from someone entitled to give it. An employee cannot authorise testing of systems owned by another company, a cloud provider, or a third-party service.
- Third parties count. Cloud platforms, ISPs, payment providers and shared hosting have their own rules. Many cloud providers publish testing policies (for example, what you may test without prior approval and what is prohibited, such as denial of service).
- Personal data and privacy law still apply during a test. If you encounter real personal data, handle it minimally and securely.
Rules of engagement and scope
Before any testing, the client and the tester agree in writing:
| Element | What it covers |
|---|---|
| Authorisation | A signed letter or contract from an authorised person; sometimes a “get out of jail free” letter the tester can show if challenged |
| Objectives | What the client wants to learn (find web flaws, test the SOC, assess the wireless network) |
| Scope | Exactly which systems, IP ranges, domains, applications, locations and people are in scope, and what is explicitly out of scope (production payment systems, third-party hosted services, a fragile legacy system) |
| Techniques allowed and forbidden | For example, social engineering allowed or not, denial of service forbidden, no destructive actions, no persistence beyond the test |
| Timing | Dates, hours, change freezes, blackout periods |
| Contacts and escalation | Who to call for emergencies, and a way to stop the test immediately |
| Data handling | How findings and any captured data are stored, encrypted and destroyed |
| Reporting | Format, timelines, confidentiality; how critical findings are reported at once |
| Liability and insurance | Professional indemnity and legal protections |
Treat the scope as a hard boundary. If you find a path that leads outside it, stop and ask. Also expect that systems can break during testing; agree backups and a plan before you begin.
Professional ethics
- Do no harm: avoid damaging systems or data, especially in production. Prefer proof of access over proof by destruction.
- Minimise data exposure: capture only what you need as evidence, protect it, and securely delete it at the end.
- Confidentiality: what you learn belongs to the client.
- Honesty and accuracy: report what you found, without exaggeration or hiding your own mistakes (if you caused an outage, say so at once).
- Responsible disclosure: when you find a vulnerability outside an engagement (in a product, or a public site), report it privately to the owner through their security contact, give reasonable time to fix, and do not exploit it further or publish details prematurely. Look for a
security.txtfile or a vulnerability disclosure policy. - Competence: do not take on work you cannot do safely.
- Many certifications and bodies have codes of conduct (for example EC-Council, (ISC)², Offensive Security, CREST, OWASP).
Where you can legally practise
- Your own lab (below), with intentionally vulnerable machines.
- Purpose-built learning platforms: Hack The Box, TryHackMe, PortSwigger Web Security Academy, OverTheWire, VulnHub (download and run locally), PentesterLab and cloud ranges, each with its own rules.
- CTF competitions: in teams or solo, in-person or online.
- Bug bounty programmes (HackerOne, Bugcrowd, Intigriti and company programmes): follow each programme’s scope and rules exactly.
Building a safe practice lab
You need a few virtual machines on an isolated virtual network.
What you need
- A computer with 16 GB of RAM is comfortable (8 GB can work with one or two small machines), a few tens of GB of disk and a hypervisor: VirtualBox or VMware Workstation Player (free), or Proxmox/Hyper-V.
- An attacker machine: Kali Linux or Parrot OS (prebuilt images with the standard tools), or your own Linux install with the tools you need.
- Targets: intentionally vulnerable systems:
| Target | Teaches |
|---|---|
| OWASP Juice Shop | Modern web application flaws (runs in a container) |
| DVWA (Damn Vulnerable Web Application) | Classic web flaws with difficulty levels |
| OWASP WebGoat | Guided lessons on web security |
| Metasploitable 2 / 3 | Deliberately weak services and operating system |
| VulnHub machines | Many “boot to root” challenges |
| Windows evaluation VMs and a small Active Directory lab | Windows and domain attacks (build with free evaluation licences) |
Network design
[Attacker VM: Kali] ----+
| Host-only / internal virtual network (e.g. 192.168.56.0/24)
[Target: Juice Shop] ---+ NOT bridged, no route to your LAN or the internet
|
[Target: Metasploitable]-+
- Use a host-only or internal network in the hypervisor, so the VMs can talk to each other but not to your home or work network. Add a separate NAT adapter to the attacker VM only while updating tools, then remove it.
- Never bridge vulnerable machines to a real network. They are trivial to compromise and could be taken over by anyone.
- Do not put real data on lab machines and do not reuse real passwords.
- Take snapshots before each exercise so you can reset a broken target in seconds.
- Keep your host updated and avoid running unknown malware samples in the same environment (use a separate, locked-down analysis lab for that; see the malware analysis lesson).
Containers for quick targets
# OWASP Juice Shop, available at http://localhost:3000 (bind to localhost so only you can reach it)
docker run --rm -p 127.0.0.1:3000:3000 bkimminich/juice-shop
# DVWA
docker run --rm -p 127.0.0.1:8080:80 vulnerables/web-dvwa
Binding the published port to 127.0.0.1 keeps the vulnerable app reachable only from your own computer.
Organise your work
- Keep notes: commands, outputs, screenshots, timestamps. Tools such as Obsidian, CherryTree, Joplin or plain Markdown in Git work well. Good notes become good reports.
- Use a methodology checklist (the next lessons follow the standard phases).
- Time-box yourself and write down what you tried, not only what worked.
The phases you will practise in this course
- Planning and scoping (this lesson)
- Reconnaissance and OSINT
- Scanning and enumeration
- Gaining access (vulnerabilities and passwords)
- Privilege escalation and lateral movement
- Post-exploitation, persistence and cleanup
- Reporting and retesting
For every phase, you will also ask: what would the defender see, and how would they stop it? That is the purple-team mindset, and it makes you far more useful than someone who can only break things.
A friend asks you to 'quickly check' whether their online shop is secure, because they are worried. They say it is fine with them. What should you do before touching anything?
Get written permission from the person who actually owns and is responsible for the shop (and its hosting arrangements), agree the scope (which domains and applications, what is off limits), the timing, the techniques allowed and a contact in case something breaks. Check the hosting provider’s testing policy, and test a staging copy where possible. A friend saying “it’s fine” informally, or someone who is not the owner, is not sufficient authorisation.
Can You Explain It?
Close the lesson and answer these without looking back. The goal isn't the wording — it's whether you've formed a usable mental model.
- Explain why intent does not make unauthorised testing legal, and what does.
- List five items that belong in rules of engagement.
- Describe a safe lab network design and two mistakes that make a lab dangerous.
🧪 Want to practise this on your own computer? See how to set up your lab →