Network Pentesting for Beginners: Legal vs. Illegal

The tools used in a professional penetration test and in a criminal intrusion are often identical. What separates the two entirely is authorization β€” here's exactly what that means and how to stay clearly on the right side of it.

On this page
  1. Same tools, opposite outcomes
  2. The one thing that actually matters: authorization
  3. What the law actually says
  4. Testing your own network
  5. Testing someone else's β€” the right way
  6. Where to practice legally
  7. Red flags you're crossing a line

"Isn't port scanning illegal?" is one of the most common questions from anyone starting out in network security β€” and the honest answer is: it depends entirely on one thing, and it isn't the tool you're using.

Same tools, opposite outcomes

A port scanner, a vulnerability scanner, a packet sniffer β€” the exact same software runs in a Fortune 500 company's authorized annual security assessment and in an attacker's reconnaissance before a breach. Nmap doesn't know or care whether you're allowed to be scanning what you're scanning. Neither does LANsentry, or any other network tool. The software is neutral; what makes an action legal or illegal is who authorized it.

The one thing that actually matters: authorization

A penetration test is legal when β€” and only when β€” the owner of the system or network being tested has given clear, documented permission for exactly that testing, within an agreed scope, for an agreed time window. This is usually formalized in a signed "Rules of Engagement" or "Authorization to Test" document before a single scan is run, specifying:

Without this, running the exact same scan against the exact same target is not a "gray area" β€” it's unauthorized access, full stop, regardless of your intentions.

⚠️

"I was just curious" or "I was going to tell them about the vulnerability anyway" is not a legal defense. Good intentions do not retroactively create authorization. Get permission in writing before you scan, not after.

What the law actually says

The specific statutes vary by country, but the underlying principle β€” unauthorized access to a computer system is a criminal offense β€” is consistent across most jurisdictions:

RegionRelevant law
GermanyΒ§ 202a–c StGB (AusspΓ€hen von Daten, Hacking-Paragraph) β€” criminalizes unauthorized access to protected data/systems.
European UnionDirective 2013/40/EU on attacks against information systems β€” sets a baseline that EU member states implement in national law.
United StatesComputer Fraud and Abuse Act (CFAA) β€” criminalizes accessing a computer "without authorization or exceeding authorized access."
United KingdomComputer Misuse Act 1990 β€” criminalizes unauthorized access to computer material.

This is general information, not legal advice β€” if you're planning professional security testing work, involve a lawyer familiar with your jurisdiction to review your engagement contracts.

Testing your own network

Scanning, port-checking and vulnerability-assessing a network you own outright β€” your home network, your own company's infrastructure that you have the authority to test β€” is unambiguously fine, and honestly one of the best ways to learn. This is exactly the use case tools like LANsentry are built for: understanding what's actually running and exposed on your own network.

One nuance worth knowing: on a shared network (a flat, an office, a dorm), "your network" often isn't fully yours. Scanning a landlord's or employer's network, even the parts your own devices sit on, can still require their sign-off β€” ask first if there's any doubt.

Testing someone else's β€” the right way

If you want to test or assess a network, system, or application that belongs to someone else β€” a client, an employer, a friend's small business β€” the process is straightforward:

  1. Get it in writing before doing anything, even a "quick look."
  2. Define scope precisely. "Test our network" is dangerously vague β€” pin down IP ranges, domains, and explicitly excluded systems (production databases, third-party services you don't have authority over).
  3. Agree on technique boundaries. Some organizations exclude denial-of-service testing, social engineering, or physical access from scope.
  4. Keep the authorization documentation for the duration of the engagement and afterward β€” it's your proof of legitimacy if anything is ever questioned.

Where to practice legally

You don't need someone else's network to build real skills. Purpose-built legal practice environments exist specifically so beginners can learn without any authorization ambiguity:

Red flags you're crossing a line

If any of these apply, stop and get explicit written authorization before continuing:

Practice on the network you're authorized for β€” your own

LANsentry gives you a full, legal picture of your own network: every device, every open port, every known vulnerability β€” no ambiguity about authorization.