Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 37 ยท Getting Started

Legal and Ethical Ground Rules, and a Safe Lab

Learn what authorised security testing means, how scope and rules of engagement work, and how to build a safe isolated home lab to practise defence legally.

Security knowledge is dual-use. The same understanding that lets you harden a firewall could be misused to break into one. The difference between a professional and a criminal is not skill; it is permission. In almost every country, accessing or probing a computer system you do not own and have not been authorised to test is illegal, even if you mean no harm, even if the door was unlocked, and even if you only "looked around". This lesson sets out the ground rules you must follow throughout this course, and shows how to build a lab where you can practise safely.

This is general information, not legal advice. Laws differ between countries (examples are the Computer Fraud and Abuse Act in the United States, the Computer Misuse Act in the United Kingdom, and national implementations of the Budapest Convention in Europe). When in doubt, get written permission or do not do it.

The golden rule: authorisation

Before you scan, test or monitor any network, make sure that:

  1. You own it, or the owner has given you written permission.
  2. The permission states the scope: which addresses, systems, and applications are included, and which are not.
  3. It states the time window and the allowed techniques.
  4. You know who to contact if something breaks.

Your own laptop, your own home network and virtual machines you create are fine. Your employer's network is fine only with explicit authorisation, not "I am IT so I assume it is OK". A school, a neighbour's Wi-Fi, a website you are curious about, a bank, a government site: all need a written agreement, and most will never give one. Public "bug bounty" programmes publish exact rules for testing; follow them to the letter.

Scope and rules of engagement

Professional security testers work under a rules of engagement document. It is worth understanding even if you never write one, because it models responsible thinking:

  • Scope. Which networks, hosts and applications may be tested. Anything not listed is out of scope.
  • Techniques. For example: no denial of service, no social engineering of staff, no testing of production databases during business hours.
  • Data handling. If you stumble on personal data, stop, record only what is needed, and report it. Do not copy it.
  • Reporting. Findings go to a named contact, privately, with enough detail to fix them.
  • Stop conditions. If a test causes an outage or finds something critical, you pause and call the contact.

The next program turns a scope definition into a checker, so you can see how "is this target allowed?" is a precise question with a precise answer. It uses only Python's ipaddress module and touches no network.

Python Check targets against an authorised scope

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice the default: anything not clearly in scope is out of scope. That mirrors the default deny principle you have already met.

Ethical principles

Beyond the law, security work has an ethical core:

  • Do no harm. Prefer read-only checks, avoid disruption, and do not leave backdoors.
  • Respect privacy. Network data contains people's messages and habits. Collect the minimum and delete it when finished.
  • Disclose responsibly. If you find a flaw in someone else's system by accident, report it to them quietly and give them time to fix it. Do not publish details that help attackers.
  • Be honest about limits. Say what you tested and what you did not.
  • Share knowledge. Defenders get better when techniques and lessons are shared.

Building a safe lab

You learn defence fastest by building, breaking and fixing your own network. A lab costs very little and is entirely under your control. The key rule is isolation: nothing in the lab should be able to reach the real internet or your real devices in ways you did not intend.

flowchart LR
    H["Your PC (host)"] --> V["Virtualisation: VirtualBox, VMware, Hyper-V, or KVM"]
    V --> N["Isolated virtual network (host-only or internal)"]
    N --> A["VM 1: Linux server"]
    N --> B["VM 2: client"]
    N --> C["VM 3: firewall/router appliance"]

An internal virtual network keeps lab traffic away from your home LAN.

A sensible starting lab:

  • A hypervisor such as VirtualBox, VMware Workstation Player, Hyper-V or KVM.
  • Two or three Linux virtual machines (a server, a client, and a router or firewall VM), connected to an internal or host-only virtual network, not bridged to your home network.
  • A firewall/router VM (for example one running pfSense, OPNsense or plain Linux with nftables) so you can practise rules and segmentation without touching your real router.
  • Snapshots. Take one before each experiment; revert when you break something.
  • Intentionally vulnerable training images only from reputable teaching projects, and only on the isolated network.

You can also practise purely in code. The programs in this course are simulations that run in your browser and never open a connection, which is why they are safe to run anywhere.

Python Lab checklist generator

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Never point learning tools at addresses you do not own. Documentation ranges (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24) are reserved for examples and never route to real hosts, which is why this course uses them.

Handling what you find

Defenders regularly see sensitive things: passwords in logs, personal emails in a packet capture. Treat captured data as confidential. Store captures encrypted, restrict who can open them, redact secrets when sharing, and delete them on schedule. If a capture is from a real network, make sure someone with authority approved capturing it in the first place.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. You discover your neighbour's Wi-Fi has a weak password. What is the right move?

    Accessing a network you do not own without permission is illegal even with good intentions. Telling the owner privately is the responsible approach.
  2. 2. What is the purpose of defining scope before testing?

    Scope is the precise boundary of authorisation. Systems or techniques outside it are not permitted.
  3. 3. Which lab setting is safest for practising?

    Isolation keeps experiments away from real devices, and snapshots let you undo mistakes.
  4. 4. Why does this course use addresses like 192.0.2.10 and 203.0.113.9 in examples?

    RFC 5737 reserves these ranges for examples, so using them cannot accidentally target real machines.

Summary

  • Permission is what separates security testing from a crime: own it or have written authorisation.
  • Scope, techniques, data handling, reporting and stop conditions form the rules of engagement.
  • Act ethically: do no harm, protect privacy, disclose responsibly.
  • Build an isolated lab with internal networks and snapshots; never bridge experiments to real networks.
  • Use documentation address ranges for examples and treat captured data as confidential.

Next: Threat Actors and the Attack Surface