Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 31 ยท Ethics, Law and Lab Setup

Law, Ethics and Authorization

Learn why written authorization, scope and rules of engagement matter in security testing, plus responsible disclosure and bug bounty etiquette.

The single most important skill in security testing is not technical. It is knowing when you are allowed to act. The difference between a penetration tester and a criminal is often one signed document. Two people can run the identical scan against the identical server: one is doing a paid, scheduled assessment, the other is committing an offense. Intent matters, but proof of permission matters first.

This lesson explains the pieces of that permission and how to stay inside them. It is general education, not legal advice. Laws differ by country and change over time, so if you do this work professionally, involve a lawyer and your client's legal team.

Why unauthorized testing is a problem

Most countries have computer misuse laws. Their wording differs, but the common idea is simple: accessing or disrupting a computer system without permission is an offense, even if you cause no damage, mean well, or "only looked." Some points apply almost everywhere:

  • "It was publicly reachable" is not the same as "I was invited." An unlocked door does not give a stranger the right to walk in.
  • Scanning alone may be treated as a hostile act by the owner, an internet provider, or a hosting company, and can get your account closed even where it is not a crime.
  • Testing can break things. A fragile device may crash when probed. That is a harm you may be responsible for.
  • Third parties matter. A company's cloud provider, payment processor or partner network may have its own rules, and your client cannot authorize testing of systems they do not own.

Before you touch anything

Written permission Signed by someone with authority.
Clear scope Exactly which systems are included.
Time window When testing is allowed to happen.
Contacts Who to call if something breaks.

If any of the four is missing, stop and ask.

1 / 2

The pieces of an engagement agreement

Professional testers work from a contract and a rules of engagement document. Names vary, but the content is consistent.

Item What it answers
Authorization letter Who owns the systems and who approves testing
Scope: in-scope Which IP ranges, domains, applications and buildings may be tested
Scope: out-of-scope What must never be touched (production payment systems, a partner's network)
Allowed techniques Is social engineering allowed? Denial of service? Password guessing?
Time window Dates and hours, and any blackout periods
Emergency contacts A named person reachable during the test
Data handling How findings and any captured data are stored, and when they are destroyed
Stop conditions When to pause (for example, signs of an outage or a real intruder)

The out-of-scope list is as important as the in-scope list. If you stumble onto a system that is not listed, the rule is simple: do not test it, note it, and ask.

Scope changes while you work

Real networks surprise you. A test of app.example.com may reveal old-admin.example.com. That host is not automatically in scope just because it is "related." Ask the client, get the change confirmed in writing, and then proceed. Verbal approval in a hallway is a classic cause of disputes.

Ethics beyond the law

Following the law is the floor. Professional ethics add expectations:

  1. Minimize harm. Use the least intrusive technique that answers the question. Prove a weakness exists without dumping real customer data.
  2. Protect what you find. Findings and any sensitive data you encounter are confidential. Store them encrypted and delete them as agreed.
  3. Be honest in reports. Do not exaggerate severity to look impressive, and do not hide your own mistakes.
  4. Stay in your lane. Do not use access gained in one test for another purpose.

Responsible disclosure

Sometimes you find a flaw outside any contract: while using a product, or while reading about a website. What now?

Coordinated (responsible) disclosure is the usual answer. You report the issue privately to the owner, give them reasonable time to fix it, and discuss publication afterward. Practical steps:

  1. Stop as soon as you realize you have found something. Do not dig further "to be sure."
  2. Look for a security.txt file (/.well-known/security.txt) or a security policy page for the contact.
  3. Send a clear, factual report: what you saw, where, and how to reproduce it using the minimum necessary steps. Do not include stolen data.
  4. Do not demand payment as a condition of silence. That looks like extortion.
  5. Agree on a timeline. Many programs and researchers use 90 days as a common starting point, shorter for actively exploited flaws.

Bug bounty etiquette

A bug bounty program is a public invitation: the company states what you may test and what rewards exist. It is a form of written authorization, but only within the program's terms.

  • Read the policy. Scope lists, banned techniques and safe-harbor language all differ.
  • Test with your own accounts. Never access other users' data; if you accidentally do, stop and report.
  • No denial of service, no spam, no social engineering unless the policy says so.
  • Report duplicates gracefully. Someone else may have been first.
  • Keep it private until the company says you may publish.

Read-only example: an authorization record

On a real engagement, many teams keep a short structured record they can check tools against. This block is only data; nothing here runs against a network.

YAML
engagement: acme-q3-external
authorized_by: "J. Rivera, CISO (signed 2026-09-01)"
window: "2026-09-15 22:00 to 2026-09-16 04:00 UTC"
in_scope:
  - 203.0.113.0/28
  - shop.example.com
out_of_scope:
  - 203.0.113.9        # hosted payment gateway, third-party owned
techniques_forbidden:
  - denial of service
  - social engineering
emergency_contact: "[email protected]"

The addresses use the 203.0.113.0/24 block, which is reserved for documentation. You will see it throughout this tutorial because it can never belong to a real target.

A stand-in: checking a target against the scope

Tools do not check authorization for you. A careful team builds a habit, and sometimes a script, that refuses to act on anything outside the list. This stand-in checks hostnames and IP addresses using only the standard library. It does not connect to anything.

Python Validate targets against an in-scope list

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Note the design choices. Unknown names are refused rather than guessed, the out-of-scope entry wins over the range, and the default answer is "no." A default of "no" is the safe default for any authorization check.

A stand-in: time windows

Permission is also limited in time. Here is the same idea for the testing window, using fixed example timestamps so the output is always the same.

Python Is this moment inside the testing window?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A server is reachable from the internet and has no password on its web page. May you test it?

    Reachability is not permission. You need authorization from the owner, regardless of how open the system looks.
  2. 2. During an authorized test you find a host that is not on the scope list. What should you do?

    Only listed systems are authorized. Unlisted hosts might belong to someone else, so note them and get the scope changed in writing.
  3. 3. What does coordinated disclosure usually involve?

    You report privately, give reasonable time to fix, and agree on publication afterward.
  4. 4. Why does the sample scope checker refuse unknown names by default?

    Authorization checks should fail closed. If a target is not clearly listed, the answer is no until someone confirms it.

Summary

  • Written authorization, defined scope, a time window and contacts must exist before any test.
  • Out-of-scope lists and written scope changes protect both the tester and the client.
  • Ethics go beyond law: minimize harm, protect findings, report honestly.
  • Responsible disclosure means private reporting, a fair deadline and no demands for payment.
  • Bug bounty programs authorize testing only within their stated rules.
  • A good tool habit is to fail closed: refuse anything not clearly in scope.

Next up: Building a Safe Lab.