Why ethical hacking, and the law
What a legal test is, and the laws that make the same acts a crime without permission
By the end of this lesson you can
- Define ethical hacking and a penetration test, and say what separates them from an attack.
- State that unauthorized access is a crime and name the matching law in Switzerland, the UK, and the US.
- Explain why permission, not intent, is what makes a test legal.
- Describe the US good-faith security research policy and its limits.
- Describe how this course keeps every lab lawful.
01What ethical hacking is, and is not
In the Kali Linux track you learned the tools. This course teaches the job those tools serve. Ethical hacking means testing a system for weaknesses with the owner's permission and inside an agreed boundary, so the owner can fix what you find before a real attacker finds it. The word "ethical" does not describe the tester's personality or good mood. It describes a situation: the owner asked for the test, said what may be touched, and expects a report at the end.
The most common form of ethical hacking is the penetration test: a scoped, authorized engagement that simulates an attacker, finds weaknesses, safely demonstrates that they are real, and reports them with fixes. Two recognized methodologies you will meet in module 2 show how much of that work is not "hacking" at all. The Penetration Testing Execution Standard (PTES) has seven sections, and the first one, Pre-engagement Interactions, is entirely about agreeing on the test before anything runs. The last one, Reporting, is about writing it up. NIST Special Publication 800-115, a US government guide to security testing, describes a four-phase model: Planning, Discovery, Attack, and Reporting. Again, planning comes first and reporting closes the loop.
So a penetration test is a project with a beginning, a middle, and an end:
- Before: the owner and the tester agree on goals, scope, and rules in writing.
- During: the tester works methodically, inside that scope, keeping notes of every action.
- After: the tester reports each finding with evidence and a fix, cleans up, and later retests.
What ethical hacking is not: it is not breaking into something to prove you can, it is not "testing" a website you happen to use, and it is not a skill that becomes legal because you are good at it. An attacker and a tester can type exactly the same commands. Only the paperwork around those commands is different, and that paperwork is the subject of this whole first module.
Throughout the course you will follow a fictional example. Sam is a one-person security consultant. Northwind Supplies, a small fictional company, will sign a one-page scope letter so Sam can test a lab that stands in for its systems. Dana, Northwind's IT contact, will read Sam's report and apply the fixes. Sam's lab is the same isolated lab you built in the Kali Linux track. Northwind is only a story that gives the work a reader.
02The one rule: permission
Here is the rule everything else rests on: you test only systems you own, or systems whose owner has given you written permission to test. That permission is called authorization. It names what may be touched, and by implication everything that may not.
Why does permission carry so much weight? Because from the outside, a test and an attack look the same. A port scan from a contracted tester produces the same log lines as a port scan from a stranger. A login attempt with a guessed password is the same packet whoever sends it. The law cannot judge the keystrokes, so it judges the relationship: did the owner agree?
Notice what the rule does not say. It does not say "test only if you mean well," "test only if nothing breaks," or "test only if you plan to report it." Intent, harmlessness, and a later report are all good things, but none of them is permission. A test is legal because the owner agreed beforehand, and only to the extent they agreed.
No permission, no test. That covers "just looking," "only one scan," "I only wanted to see if the login page was weak," and "I would have told them." If you are unsure whether something is covered, treat it as not covered until the owner confirms in writing.
03The three laws in plain words
Most countries have a criminal law against unauthorized access to computer systems. This course names three, because many learners live or work under one of them. You do not need to be a lawyer. You do need to know which law applies to you, and what it forbids in everyday language.
| Jurisdiction | Law and article | What it forbids, in plain words |
|---|---|---|
| Switzerland | Swiss Criminal Code (SR 311.0), Art. 143bis "Unauthorized access to a data processing system" | Getting into someone else's specially protected system over a network without authorization. Prosecuted on complaint, with a custodial sentence of up to three years or a monetary penalty. Paragraph 2 covers making available or trading in passwords, programs, or data meant for such an offense. |
| United Kingdom | Computer Misuse Act 1990, section 1 "Unauthorized access to computer material" | Causing a computer to give you access to programs or data when you know you are not authorized to have it. |
| United States | Computer Fraud and Abuse Act (CFAA), 18 U.S.C. 1030, subsection (a)(2) | Intentionally accessing a computer without authorization, or exceeding the access you were given, to obtain information from a protected computer. |
Switzerland
Art. 143bis has been in force in its current form since January 1, 2012. Two words matter. "Specially protected" means the system has some barrier against access, such as a login. "On complaint" means prosecution normally starts when the person harmed files a complaint. Neighboring articles cover related acts: Art. 143 is unauthorized obtaining of data, and Art. 144bis is damage to data. A test that copied or changed data could therefore touch more than one article.
United Kingdom
The Computer Misuse Act 1990 is built as a ladder of offenses. Section 1 is unauthorized access. Section 2 is unauthorized access with intent to commit or help commit further offenses. Section 3 covers unauthorized acts with intent to impair, or recklessness as to impairing, the operation of a computer. Section 3ZA covers unauthorized acts causing, or creating a risk of, serious damage. Section 3A covers making, supplying, or obtaining articles for use in an offense under sections 1, 3, or 3ZA. Every rung starts with the same word: unauthorized.
United States
The CFAA, titled "Fraud and related activity in connection with computers", has several offenses. Subsection (a)(2) is the access offense in the table. Subsection (a)(5) covers knowingly causing damage by a transmission, and accessing without authorization in a way that causes damage. The law defines its key words: (e)(6) defines "exceeds authorized access", meaning you had some access but used it to reach information you were not entitled to, and (e)(8) defines "damage" as any impairment to the integrity or availability of data, a program, a system, or information. Subsection (f) says the law does not prohibit lawfully authorized investigative, protective, or intelligence activity by government agencies.
"Exceeds authorized access" is the phrase every tester should remember. A tester with permission for one server who drifts onto the next server, because it was "right there", has gone beyond the access they were given. Authorization has edges, and the edges are the scope.
This course deliberately gives no penalties for the UK and US laws and no case outcomes. They depend on the offense and the facts. If you need them, read the official text or ask a lawyer.
04Good intentions are not a defense
Many people who get into legal trouble over computer access meant no harm. They were curious, wanted to help, or planned to report what they found. The laws above do not ask about any of that before the question of authorization.
The clearest example of where good intentions do and do not help comes from the United States. In May 2022 the US Department of Justice announced a revised charging policy: federal prosecutors should not charge good-faith security research under the CFAA. The policy describes such research as accessing a computer solely to test, investigate, or correct a security flaw, in a way designed to avoid harm, with the information used mainly to improve security.
That sounds generous, so read its limits carefully:
- It is an internal charging policy for federal prosecutors. It tells them which cases not to bring. It is not a legal defense you can raise.
- It does not bind state prosecutors, who enforce their own computer crime laws.
- It does not stop civil claims, where the owner sues you for damages.
- It applies only in the United States, and says nothing about Swiss or UK law.
- Whether your activity counts as "good faith" is decided by someone else, after the fact.
For a tester the lesson is simple. A policy that might, after the event, persuade a prosecutor not to charge you is a very different thing from permission given before you start. Professionals do not rely on the first. They get the second.
On May 19, 2022, the US Department of Justice announced that it would not charge good-faith security research under the CFAA. It is a federal charging policy, not a license to test: it does not bind state prosecutors or prevent civil suits, and it gives no permission to touch anyone's systems.
Source: US Department of Justice, "Department of Justice Announces New Policy for Charging Cases under the Computer Fraud and Abuse Act," May 19, 2022"A disclaimer, a VPN or good intentions make it legal." None of them does. A line saying "for educational purposes only" does not change who owns the system. A VPN hides where you are. It does not make you authorized. Good intentions may matter later to a prosecutor or a judge, but they do not turn unauthorized access into authorized access. Only the owner's written consent, or a system you own, does that.
05How this course works
Every hands-on lesson in this course is designed so that you never need anyone else's permission, because you never touch anyone else's system.
- Your own isolated lab only. All targets are machines you run yourself on a host-only network,
192.168.56.0/24, that cannot reach the internet or your home network: Kali, Metasploitable 2, and the practice web apps DVWA and OWASP Juice Shop, which run on your Kali machine at127.0.0.1. Lesson 4 confirms that lab before any tool runs. - A written scope even for your own lab. In lessons 2 and 4 you write a one-page scope for the lab, as Sam does for Northwind. It is good practice, and it builds the habit you need for real work.
- Scope reminder first, defender's view last. Every lab opens with a scope reminder and ends with how a defender would detect and prevent what you just did.
- Least force. Demonstrations stop at proof. No malware, no evading security products, no denial of service, no stealing real credentials, no phishing of real people.
When you leave the lab, examples in this course use reserved documentation ranges such as 198.51.100.0/24 and names like example.com. They are there to be read, never to be targeted.
The permission rule has a mirror image on the defending side. Anything that touches your systems without an agreed scope is unauthorized and worth a look. Defenders keep firewall and server logs, watch for bursts of connections to many ports or many hosts and for repeated failed logins, and agree in advance how their own authorized testers will announce themselves, so a planned test is never confused with a real intrusion.
Practical exercise: the law in your own words
A browser and a text editor, or paper and pen. No tools are run in this exercise. Check off each step as you finish it. Your checkmarks are saved in this browser.
This exercise only reads and writes notes. Do not run any tool against any system. From lesson 4 on, the only targets in scope are the machines in your own host-only lab and the training apps on your Kali machine.
The scope line you just wrote is also a defender's tool. When an organization knows exactly which addresses an authorized test covers and when, its monitoring team can treat activity outside that window or those addresses as a possible real attack.
Key takeaways
- Ethical hacking is testing with the owner's permission inside an agreed scope, and a penetration test is the structured, reported form of it.
- Testers and attackers can type the same commands. Written authorization is the only difference the law sees.
- Unauthorized access is an offense under Swiss Art. 143bis, the UK Computer Misuse Act 1990, and the US CFAA, 18 U.S.C. 1030.
- Going beyond the access you were given ("exceeds authorized access") is also unauthorized.
- The 2022 DOJ good-faith policy is a federal charging guideline, not a defense and not permission.
- This course uses only your own isolated lab, with a scope reminder before and a defender's view after every lab.