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
On this page
- Why it matters
- What the law forbids
- What a written authorisation contains
- Example: check every action against the scope
- Ethics: least harm, sensitive data and disclosure
- Check your understanding
- Apply it
- Review prompt
Lessons of Security Foundations & Threat Landscape
- Security Goals and the Controls That Serve Them Concept · 20 min
- Rating Risk with Likelihood and Impact Worked example · 20 min
- Threat Actors and the Shape of an Attack Concept · 20 min
- Tracing a Real Breach Through ATT&CK Lab · 25 min
- Authorization, Law and Professional Ethics Concept · 15 min
- Foundations Check Knowledge check · 8 questions
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.
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.
{
"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"
}"""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)}")python3 scope_guard.py2026-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 windowEach 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
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
- Crown Prosecution Service: Computer Misuse Act legal guidance
- 18 U.S.C. § 1030 (Computer Fraud and Abuse Act), Cornell LII
- Van Buren v. United States (2021), Supreme Court opinion
- Directive 2013/40/EU on attacks against information systems
- AWS: Penetration testing policy
- RFC 9116: A File Format to Aid in Security Vulnerability Disclosure
- ISC2 Code of Ethics
- NIST SP 800-115: Technical Guide to Information Security Testing
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.