Security operations

Is Ethical Hacking Legal? The CFAA, Authorization and the Rules

Ethical hacking is legal when it is authorized. The same techniques that make a penetration test valuable are a federal crime without written permission — here is where the line sits in the US, the UK and the EU.

Cysoro Security TeamPublished · 10 min read
$ nmap --authorized-scanscope: 10.0.0.0/24 ✓rules-of-engagement: signed3 findings → report sent Authorized Unauthorized SECURITY OPERATIONS Ethicalhacking Legal — when permission comes first.
Quick answer

Yes, ethical hacking is legal when you have explicit authorization from whoever controls the systems you test and you stay within the agreed scope. Without that permission, the same techniques can violate the US Computer Fraud and Abuse Act (18 U.S.C. § 1030) or the UK Computer Misuse Act 1990, regardless of good intentions. Written authorization, a defined scope and responsible disclosure are what make the work lawful.

Key takeaways

  • Authorization is the whole answer: written permission from the system owner, with a defined scope, is what separates ethical hacking from a crime.
  • The US DOJ directs prosecutors to decline charges for good-faith security research, but that is prosecutorial discretion, not immunity.
  • In the UK, the Computer Misuse Act 1990 makes unauthorized access an offence on access alone — good intentions are not a defence.

Ethical hacking uses the same techniques as criminal hacking: scanning, probing, exploiting weaknesses and moving between systems. The law does not distinguish between the two by skill, tools or intent. It distinguishes them by authorization — and that distinction is the entire answer to whether ethical hacking is legal.

Is ethical hacking legal?

Yes, ethical hacking is legal when you have explicit authorization from whoever controls the systems you test, and you stay within the boundaries of that authorization. The same actions, done to the same systems without permission, can be a federal crime in the United States and an offence in the United Kingdom.

That sounds circular, and it is worth sitting with: there is no technical act that is inherently "ethical hacking" rather than "hacking". A penetration tester with a signed statement of work is doing their job. The same person doing the same things to the same systems the week before the contract was signed has committed an offence. The paperwork is not bureaucracy around the work — it is the thing that makes the work lawful.

This article is general information, not legal advice. Computer-crime law varies by country and by state, and it applies differently to your specific facts. If you are planning paid offensive security work, get a lawyer to review your contracts.

What is ethical hacking?

Ethical hacking is the authorized use of attacker techniques to find and fix security weaknesses before criminals exploit them. It covers penetration testing, red teaming, vulnerability assessments and bug bounty research.

The work usually follows the same phases as a real attack: reconnaissance, scanning for weaknesses, attempting to exploit them, and reporting what an attacker could do with the access gained. The difference is that the goal is a report and a fix, not theft or damage — and the owner asked for it. NIST's guidance on security testing, SP 800-115, describes the same methodology as a formal assessment discipline, with planning, rules and documented authorization at the front.

LabelPermissionIntentLegal position
White hat (ethical hacker)Written authorization from the asset owner, or a published program that grants itFind and fix weaknessesLawful when the work stays inside the authorization
Gray hatNone, or exceeds what was grantedOften claims to help; may disclose publicly or demand paymentUnauthorized access can still violate the CFAA and state laws
Black hatNoneTheft, extortion, disruption or espionageCriminal

The gray hat row is the one practitioners need to understand. Good intentions do not create permission. Finding a vulnerability in a system you were not invited to test, then reporting it and expecting thanks, is still unauthorized access in the eyes of the law — even if the company fixes the flaw.

What makes hacking legal: authorization and scope

Authorization is the single factor that turns a federal crime into a legitimate security assessment. In practice it takes the form of a written penetration testing agreement, sometimes called a rules-of-engagement document.

The four-part legal test for an engagement 1Authorizationwritten, from someonewith authority overthe systems 2Scopenamed systems, IPs,apps and timewindow 3Methodagreed techniques,no damage, no dataexfiltration 4Reportingconfidential findingsto the owner first,no public leak If any of the four fails, the work is on the wrong side of the line.
Four conditions that make an engagement lawful. Illustration by Cysoro.

A solid rules-of-engagement document covers which systems, networks and applications you may target, which testing methods are allowed, the timeframe of the engagement, and how discovered vulnerabilities will be reported. These details matter because they define the legal boundary — anything outside the contract is unauthorized access.

Permission also has to come from someone with actual legal authority over the systems. A friendly employee who says "go ahead and test our website" cannot authorize testing of the company's production environment, and certainly cannot authorize testing of a third party's systems that the company uses. For cloud-hosted systems, check whether the cloud provider's terms also matter: testing a system you rent is usually fine, but testing the provider's own infrastructure is not.

Scope creep is the classic trapFinding an interesting, reachable system that is not named in your authorization does not make it in scope. If you can pivot to it, that is a finding to report — not an invitation to test it.

The Computer Fraud and Abuse Act (CFAA)

In the United States, the main federal anti-hacking law is the Computer Fraud and Abuse Act, codified at 18 U.S.C. § 1030. It makes it a crime to access a computer "without authorization" or to "exceed authorized access".

The CFAA's reach is enormous. A "protected computer" under the statute includes any computer used in or affecting interstate or foreign commerce, which effectively covers every internet-connected device in the country. Testing someone's web application, scanning their servers or probing their network all fall under the CFAA's umbrella. Without proper authorization, even well-intentioned security testing triggers federal criminal liability.

The statute also has a civil side: system owners can sue for damages. That matters because a decision by federal prosecutors not to charge you does not stop the company from suing you, and it does not stop a state prosecutor from charging you under that state's own computer-crime law.

For a small business, the practical lesson runs the other way: if you hire a tester, the contract protects you too. It proves the testing was authorized, limits what the tester may touch, and sets out how findings are handled. Our small business cybersecurity checklist covers the surrounding controls — backups, updates and access management — that make a test's findings worth acting on.

Van Buren v. United States: what the Supreme Court decided

In Van Buren v. United States, decided on June 3, 2021, the Supreme Court narrowed one of the CFAA's two key phrases. The case concerned a police officer who used his authorized access to a law-enforcement database for an improper purpose — looking up a license plate in exchange for money.

The Court held that a person "exceeds authorized access" only when they access areas of a computer that are off-limits to them, not when they misuse access to information they are otherwise entitled to reach. In plain terms: authorization is about which doors you may open, not about why you open them.

For ethical hackers, the practical meaning is straightforward. Written authorization and a clear scope are what keep the work lawful, and the scope is defined by the systems and areas you are allowed to reach. Testing a system that was never in scope — even if you were authorized to test a neighboring one — is the kind of access the statute targets.

The DOJ's good-faith security research policy

On May 19, 2022, the Department of Justice revised its charging policy for CFAA cases. For the first time, the policy directs federal prosecutors to decline prosecution where the evidence shows the defendant's conduct consisted of, and the defendant intended, good-faith security research.

The policy adopts the US Copyright Office's definition: accessing a computer solely for purposes of good-faith testing, investigation or correction of a security flaw, where the activity is carried out in a manner designed to avoid harm to individuals or the public, and where the information is used primarily to promote the security or safety of the class of devices, machines or online services involved. The DOJ's own Justice Manual 9-48.000 sets out the full charging policy.

Three limits matter. First, the policy is prosecutorial discretion, not immunity: it guides federal prosecutors, and a future administration can change it. Second, it does not affect civil CFAA liability or state laws. Third, claiming to be a researcher is not a free pass — the DOJ's announcement is explicit that discovering vulnerabilities in order to extort their owners, even if claimed as "research", is not in good faith.

The policy also clarified that violating a website's terms of service alone — embellishing a dating profile, using a pseudonym, checking sports scores at work — is not itself sufficient to warrant federal criminal charges. That was a real concern for researchers, and the clarification removed one of the biggest chilling effects on legitimate work.

Is ethical hacking legal in the UK and the EU?

In the United Kingdom, the Computer Misuse Act 1990 is stricter than many people expect. Section 1 makes it an offence to cause a computer to perform any function with intent to secure unauthorized access to computer material, knowing the access is unauthorized. The offence is committed on access alone — no damage or theft is needed — and it carries up to two years in prison on indictment.

Section 2 covers unauthorized access with intent to commit or facilitate further offences, carrying up to five years. Section 3 covers unauthorized acts that impair the operation of a computer. Unlike the DOJ policy in the US, the UK has no equivalent published prosecutorial policy protecting good-faith security research, which makes written authorization even more important for UK testers.

Across the EU, member states have their own computer-crime laws, most implementing the Council of Europe's Budapest Convention on Cybercrime. The details differ — some countries have explicit provisions for authorized security testing, others do not — so a tester working across borders needs authorization that is valid in each jurisdiction where the systems sit. When in doubt, assume you need permission in every country involved.

What about bug bounties and testing your own systems?

Bug bounty programs are the most common way independent researchers work legally. A program's published scope is a form of authorization: it names the systems, domains and vulnerability types that are in scope, and it usually includes safe-harbor language promising the company will not pursue legal action for in-scope, good-faith research.

Read the scope before you start. Common traps include testing subdomains that are not listed, testing third-party services the program does not cover, probing production data instead of test accounts, and disclosing a vulnerability publicly before the company has had time to fix it. Each of those can put you outside the safe harbor.

The safest places to learn are the ones built for it. Testing systems you own is legal. Dedicated practice platforms such as Hack The Box and TryHackMe provide machines you are explicitly authorized to attack. Capture-the-flag competitions are authorized by definition. If you want to learn, start there — not on a live website that never invited you.

How to hack legally: a checklist

Before you touch a system that is not yours, work through this list. If any item is missing, stop and fix it first.

Before you test anything that is not yours ☐ Get written authorization from someone with authority over the systems ☐ Define the scope: named systems, IP ranges, apps and methods ☐ Agree the time window and get amendments in writing if it slips ☐ Agree how findings are reported and how long they stay confidential ☐ Keep records: logs, screenshots and the signed agreement, for years If the scope is vague, get it clarified in writing before you act on an assumption.
A pre-engagement checklist for lawful security testing. Illustration by Cysoro.
  1. Get it in writing. A signed statement of work or rules-of-engagement document, or a bug bounty program's published scope. Verbal permission is not enough.
  2. Define the scope precisely. Named systems, IP ranges, applications, accounts and testing methods. If a system is not named, it is not in scope.
  3. Agree the time window. Testing after the engagement ends is unauthorized, even if you found the vulnerability during it.
  4. Agree the reporting rules. Who gets the findings, how quickly, and how long they stay confidential before any public disclosure.
  5. Minimize harm. Do not exfiltrate real customer data, do not disrupt services, and stop immediately if something goes wrong. The DOJ's good-faith definition requires activity designed to avoid harm.
  6. Keep records. Logs, screenshots, timestamps and the signed agreement, kept for years. If your work is ever questioned, the paper trail is your defence.

For companies hiring testers, the same checklist protects you. It also helps to know the basics of your own exposure first: check whether your credentials already appear in known breaches with our pwned password checker.

Make sure your home network is locked down too, by following our guide on how to secure your Wi-Fi.

What happens if you cross the line?

The consequences are real, and the history is instructive. In 2011, the programmer Aaron Swartz was charged under the CFAA for downloading millions of academic articles from JSTOR through MIT's network. The case became a symbol of the statute's breadth, and it ended in tragedy before trial. It is the case most often cited by researchers who argue the CFAA was used too aggressively — and one reason the DOJ later narrowed its charging policy.

Penalties under the CFAA can include years in prison and heavy fines, depending on the conduct and the damage caused. In the UK, basic unauthorized access carries up to two years, and access with intent to commit further offences up to five years. Civil lawsuits can follow even when prosecutors decline. And for a professional, the career cost of a conviction — losing certifications, clearances and employability — can exceed any sentence.

The demand for lawful ethical hackers is strong: the US Bureau of Labor Statistics puts the median pay for information security analysts at $129,180 (May 2025) and projects 21% employment growth from 2025 to 2035, with about 14,100 openings a year. That career is built on trust, and trust starts with the paperwork.

The bottom line

Ethical hacking is legal when it is authorized, scoped and documented. The techniques are the same ones attackers use; the law cares about permission, not technique. Get written authorization from someone with authority, stay inside the named scope and time window, minimize harm, and report confidentially.

If you are hiring a tester, put the same discipline in the contract — it protects your company as much as the tester. And if you are learning, practice on systems that invited you: your own lab, a practice platform or a bug bounty program. The fastest way to a career in offensive security is to never give anyone a reason to doubt which side of the line you are on.

Frequently asked questions

Is ethical hacking legal in the US?

Yes, when it is authorized. Testing systems with written permission from the owner, inside an agreed scope, is lawful. Testing the same systems without permission can violate the Computer Fraud and Abuse Act, even if your motive is to help.

Do I need written permission to hack legally?

Yes. Verbal permission is hard to prove and easy to dispute. A written agreement — a statement of work, rules of engagement or a bug bounty program's scope — names the systems, methods and time window you are allowed to test.

Is ethical hacking legal in the UK?

Yes, with authorization. The Computer Misuse Act 1990 makes unauthorized access to computer material an offence, with up to two years in prison on indictment for basic unauthorized access. Authorized testing done with the owner's permission is not an offence.

Can I get in trouble for reporting a vulnerability I found by accident?

Possibly, if you accessed a system without authorization to find it. The DOJ's policy directs federal prosecutors to decline good-faith security research cases, but that policy does not bind state prosecutors or civil lawsuits, and it does not protect research done in bad faith.

Is bug bounty hunting legal?

Yes, when you stay inside the program's published scope and rules. A bug bounty program is a form of authorization: it tells you which systems and vulnerability types are in scope and how to report. Testing anything outside that scope is unauthorized.

What is the difference between ethical hacking and penetration testing?

Ethical hacking is the umbrella term for authorized offensive security work. Penetration testing is one type of it: a scoped, time-boxed assessment that tries to exploit weaknesses in specific systems and reports the results.

Is it legal to practice hacking on my own computer?

Yes. Testing systems you own, or lab environments built for practice such as Hack The Box and TryHackMe, is legal. The line is crossed when you test systems that belong to someone else without their permission.

Can ethical hackers go to jail?

Yes, if they work without authorization or exceed their scope. Unauthorized access under the CFAA can carry prison time, and the UK Computer Misuse Act carries up to two years for basic unauthorized access and up to five years for access with intent to commit further offences.

Sources

  1. US Department of Justice — Justice Manual 9-48.000, Computer Fraud and Abuse Act
  2. US Department of Justice — Department of Justice Announces New Policy for Charging Cases under the Computer Fraud and Abuse Act
  3. legislation.gov.uk — Computer Misuse Act 1990
  4. NIST — SP 800-115, Technical Guide to Information Security Testing and Assessment
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against the DOJ Justice Manual 9-48.000 charging policy, the Computer Misuse Act 1990 text and NIST SP 800-115.

How we write and fact-check →

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free