Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 5 of 6 · Concept · 15 min · revision 2

Authorization, Law and Professional Ethics

Why the same scan can be a job or a crime, what computer-misuse laws in the UK, US and EU forbid, what a written authorisation must contain, how third parties and cloud providers limit what a client can allow, and how to handle sensitive data and report what you find. Includes a scope check you can run before any test.

Contentsand lesson path

What you will learn

  • Explain the legal and ethical limits of security work, including written authorization before any testing.

01. Why it matters

A penetration tester and a criminal can type the same commands. What separates them is permission: a tester acts with the written agreement of the person entitled to grant it, within limits both sides understand, and reports what they find to that person. Without that permission, even a "harmless look" can be a criminal offence, can break a contract, and can end a career before it starts.

This lesson is not legal advice, and laws differ between countries and change over time. Its aim is to give you habits that keep security work lawful and ethical wherever you are: get it in writing, stay in scope, do the least harm, and report responsibly.

02. What the law forbids

Most countries have a computer-misuse law, and the three you will hear about most are similar in spirit.

  • United Kingdom: Computer Misuse Act 1990. Section 1 makes unauthorised access to computer material an offence when you know the access is unauthorised. Further sections cover access with intent to commit other crimes (section 2), acts that impair a computer (section 3), acts that cause serious damage (section 3ZA), and making, supplying or obtaining tools for these offences (section 3A). The Crown Prosecution Service guidance linked below explains each one.
  • United States: Computer Fraud and Abuse Act (18 U.S.C. § 1030). It covers accessing a computer "without authorization" or in a way that "exceeds authorized access". In Van Buren v. United States (2021), the Supreme Court read the second phrase narrowly: it applies when someone with access obtains information from parts of a system, such as files or databases, that are off-limits to them. Many states have their own laws as well.
  • European Union: Directive 2013/40/EU. It requires member states to criminalise illegal access to information systems, illegal system and data interference, illegal interception, and tools made for these offences.

Three practical points follow. First, intent to help does not create permission: finding a flaw for good reasons does not make unauthorised access lawful. Second, more than one country's law can apply, because you, the target system and its data may each be in a different place. Third, laws change; some governments are discussing defences for good-faith security research, but until a defence is in force and you meet its conditions, plan as if it does not exist.

03. What a written authorisation contains

Authorisation means permission from someone entitled to grant it for the specific systems involved, usually the owner or an executive who controls them. A friend who works at a company, or an IT employee without that authority, cannot grant it. Get the permission in writing and signed before any testing starts. It is normally backed by a contract and by rules of engagement that set out:

  • scope: the exact hosts, address ranges, applications and accounts that may be tested, and what is explicitly excluded;
  • activities: what you may do, such as scanning or web application testing, and what you may not, such as denial of service or social engineering of staff;
  • time window: when testing may happen, in a stated time zone;
  • contacts and stop conditions: who to call in an emergency, and when you must stop and report, for example if you reach personal data or a service slows down;
  • data handling: what evidence you may keep, how it is protected and when it is destroyed.

Third parties limit what a client can allow. A client can only authorise testing of systems it controls. Its website may run on a hosting company's servers, its email on a cloud provider, its payments on a processor: each of those needs its own permission or a published policy that allows the test. AWS, for example, lets customers test their own resources on a list of services without asking first, but its policy prohibits denial-of-service and request-flooding tests and sends DDoS simulations to a separate approval process. Always read the provider's current policy.

04. Example: check every action against the scope

Experienced testers check scope mechanically, because mistakes happen when you are tired or excited. The script below (Python 3.10 or newer, standard library only) reads a signed authorisation saved as JSON and checks planned actions against it. The addresses come from 203.0.113.0/24, a range reserved for documentation by RFC 5737, and the names use the reserved .example suffix, so nothing here points at a real system.

JSON · authorization.json
{
  "engagement": "NFP-2026-11",
  "client": "Northfield Physio Ltd",
  "signed_by": "Practice owner (system owner), signed 2026-11-02",
  "window_utc": ["2026-11-16T09:00", "2026-11-20T17:00"],
  "in_scope": ["book.northfieldphysio.example", "203.0.113.0/28"],
  "out_of_scope": ["203.0.113.5", "pay.example"],
  "activities": ["discovery-scan", "web-app-test", "auth-test"],
  "stop_and_report": ["personal data reached", "service degraded"],
  "contact": "IT lead, phone number in the signed letter"
}
Python · scope_guard.py
"""Check a planned test action against the signed authorisation before running it."""
import ipaddress
import json
from datetime import datetime


def _matches(target: str, entry: str) -> bool:
    try:
        return ipaddress.ip_address(target) in ipaddress.ip_network(entry)
    except ValueError:  # not an IP address: compare host names exactly
        return target.lower() == entry.lower()


def check(auth: dict, target: str, activity: str, when: str) -> str:
    start, end = (datetime.fromisoformat(t) for t in auth["window_utc"])
    if not start <= datetime.fromisoformat(when) <= end:
        return "DENY: outside the authorised time window"
    if any(_matches(target, e) for e in auth["out_of_scope"]):
        return "DENY: target is explicitly out of scope"
    if not any(_matches(target, e) for e in auth["in_scope"]):
        return "DENY: target is not listed in scope; ask, do not assume"
    if activity not in auth["activities"]:
        return f"DENY: activity {activity!r} is not authorised"
    return "ALLOW"


if __name__ == "__main__":
    auth = json.load(open("authorization.json", encoding="utf-8"))
    plans = [
        ("book.northfieldphysio.example", "web-app-test", "2026-11-17T10:30"),
        ("203.0.113.9", "discovery-scan", "2026-11-17T11:00"),
        ("203.0.113.5", "discovery-scan", "2026-11-17T11:05"),
        ("pay.example", "web-app-test", "2026-11-17T11:10"),
        ("notes.northfieldphysio.example", "auth-test", "2026-11-17T11:15"),
        ("book.northfieldphysio.example", "load-test", "2026-11-17T11:20"),
        ("book.northfieldphysio.example", "web-app-test", "2026-11-20T18:30"),
    ]
    for target, activity, when in plans:
        print(f"{when}  {target:<30} {activity}")
        print(f"    -> {check(auth, target, activity, when)}")
Terminal
python3 scope_guard.py
Expected output
2026-11-17T10:30  book.northfieldphysio.example  web-app-test
    -> ALLOW
2026-11-17T11:00  203.0.113.9                    discovery-scan
    -> ALLOW
2026-11-17T11:05  203.0.113.5                    discovery-scan
    -> DENY: target is explicitly out of scope
2026-11-17T11:10  pay.example                    web-app-test
    -> DENY: target is explicitly out of scope
2026-11-17T11:15  notes.northfieldphysio.example auth-test
    -> DENY: target is not listed in scope; ask, do not assume
2026-11-17T11:20  book.northfieldphysio.example  load-test
    -> DENY: activity 'load-test' is not authorised
2026-11-20T18:30  book.northfieldphysio.example  web-app-test
    -> DENY: outside the authorised time window

Each refusal is a real situation. 203.0.113.5 sits inside the authorised range but was excluded, perhaps because it is a fragile medical device. pay.example is the payment provider, a third party the clinic cannot authorise. notes.northfieldphysio.example looks like it belongs to the client, but it is not in the letter, so the right answer is to ask rather than assume. A load test was never agreed, and the last action falls after the window closed. The check is deliberately strict: anything not explicitly allowed is refused.

05. Ethics: least harm, sensitive data and disclosure

Staying within the law is the minimum. Professional ethics ask more. The ISC2 Code of Ethics, which many certifications follow, has four canons: protect society and the infrastructure; act honourably, honestly, justly, responsibly and legally; provide diligent and competent service to principals; and advance and protect the profession. In daily work this means a few habits.

  • Do the least harm needed to show the risk. Prove that access is possible with the smallest action, such as listing a table's name rather than downloading it.
  • Treat what you find as confidential. Findings and evidence belong to the client. Store them encrypted, share them only through agreed channels, and destroy them when the engagement says so.
  • Stop when you reach sensitive data. Personal, medical or financial data is a stop condition in most rules of engagement: keep minimal evidence, stop, and tell the client contact.
  • Be honest in the report. Say what you tested, what you did not, and what went wrong, including any accidental impact.

Sometimes you notice a weakness without any engagement, for example while using a website normally. Do not probe further to "confirm" it, because that probing is where unauthorised access begins. Report what you saw through the owner's published channel: a vulnerability disclosure policy or bug bounty programme if it has one, whose terms say what testing it permits, or the contact in its security.txt file, a standard location defined by RFC 9116 at /.well-known/security.txt. Coordinated disclosure means giving the owner reasonable time to fix the problem before anything is made public.

06. Check your understanding

Practice check · 3 questions

Authorisation and ethics

Decide as a professional tester would.

Q1. Your authorised scan of an in-scope host is half finished when `scope_guard.py` starts to answer "outside the authorised time window". What do you do?
Q2. With no engagement in place, you notice while shopping online that a shop's admin page loads without asking you to log in. What is the appropriate next step?
Q3. A client hosted on AWS asks you to check how its public API copes with a flood of requests during your penetration test. What is the right response?
Practice only: not graded, not saved, not evidence.

07. Apply it

Write a one-page set of rules of engagement for a lab you control, such as the containers you run in later skills: scope, activities, window, contacts, stop conditions and data handling. Save it as authorization.json, add two more planned actions to scope_guard.py, one that must be allowed and one that must be refused, and run it. Keep the habit: no test without a scope check, even in your own lab.

08. Review prompt

Without looking back: name the computer-misuse laws of the UK, the US and the EU and what each forbids in one line. List five things a written authorisation must contain, explain why a client cannot authorise testing of its cloud provider's infrastructure, and describe what you do when you reach personal data during a test.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check