TExcelTAD
Home › Security Foundations: Concepts, Law, Ethics & Your Lab › Authorization, Scope and Rules of Engagement

Authorization, Scope and Rules of Engagement

A penetration tester and a criminal can type exactly the same commands. What separates them is not skill, tools or intent but a piece of paper: written permission from someone entitled to give it, describing exactly what may be tested, when and how. Every offensive lesson in this track assumes you have that paper or are working in your own lab. This lesson shows what goes into it and how to check each action against it, so that "I thought it was in scope" never becomes your defence.

The short version of the ethics is in Security Careers & Ethics. Here we go one level deeper: who can authorise, how scope is written so it can be checked, and the traps that put careful people outside it. The legal background follows in the next lessons (US, UK and EU, Vietnam); the full engagement process is in Penetration Testing Methodology.

Three documents, three questions

Document Answers Typical content
Authorization letter (permission to test) May you test at all, and who says so? the client's legal name, the signer's name and role, a statement that they own or control the systems, the testers' names, dates, a contact for emergencies
Scope What may you test? address ranges, host names, applications, accounts you are given, and an explicit exclusion list
Rules of engagement (RoE) How may you test? allowed and forbidden techniques, time windows, rate limits, what to do with sensitive data, how to stop, how to report a critical finding at once

In small jobs the three are often one signed document attached to a contract. What matters is that each question has a written answer before you start.

Who can authorise? Only someone with the authority to grant access to those systems. A developer cannot authorise a test of the company's cloud account; a customer cannot authorise a test of their hosting provider's infrastructure; your manager cannot authorise testing a supplier's API. Cloud providers publish their own rules about which tests customers may run on their tenant (for example, many forbid denial-of-service testing without prior approval), and a third-party SaaS used by your client is usually out of reach unless that third party agrees too.

Writing scope that can be checked

Vague scope ("the website", "our network") is the most common cause of trouble. Good scope is a list a program could check:

  • Addresses as CIDR blocks (10.10.0.0/24) and single addresses, names as exact host names or explicit wildcards (*.app.lab.test).
  • Exclusions written out, even inside an in-scope range: the router, the backup servers, the payment host.
  • Time: dates, daily hours, and the time zone (a "9–17" window means nothing without one).
  • Techniques: what is allowed (discovery, web testing, authenticated testing with the accounts provided) and what is not (denial of service, social engineering of staff, physical access) unless written in.

Here is that list as data, and a checker that every planned action can be run past. Everything is lab data: 10.10.0.0/24, names under lab.test and one documentation address (203.0.113.50, RFC 5737) standing in for a third party.

python · try it yourself
import ipaddress
from datetime import datetime, timezone
from fnmatch import fnmatch

ROE = {
    "in_scope_nets": ["10.10.0.0/24"],
    "in_scope_names": ["lab.test", "*.app.lab.test"],
    "excluded_nets": ["10.10.0.1/32", "10.10.0.200/29"],     # router, backup servers
    "excluded_names": ["pay.app.lab.test"],
    "days": "2026-12-01..2026-12-12",
    "hours_utc": ((8, 0), (17, 0)),                           # [08:00, 17:00) UTC
    "techniques": {"discovery", "web-testing", "auth-testing"},  # no DoS, no phishing
}

LAB_DNS = {"lab.test": "10.10.0.10", "shop.app.lab.test": "10.10.0.30",
           "cdn.app.lab.test": "203.0.113.50", "pay.app.lab.test": "10.10.0.31"}

def in_any(ip, nets):
    return any(ip in ipaddress.ip_network(n) for n in nets)

def check(target, when, technique):
    start, end = ROE["days"].split("..")
    if not start <= when.date().isoformat() <= end:
        return "NO  outside the test dates"
    lo, hi = ROE["hours_utc"]
    if not lo <= (when.hour, when.minute) < hi:
        return "NO  outside the daily window"
    if technique not in ROE["techniques"]:
        return "NO  technique not allowed"
    try:
        ip = ipaddress.ip_address(target)
    except ValueError:                      # a host name, not an address
        name = target.lower().rstrip(".")
        if name in ROE["excluded_names"]:
            return "NO  host explicitly excluded"
        if not any(name == p or fnmatch(name, p) for p in ROE["in_scope_names"]):
            return "NO  name not in scope"
        ip = ipaddress.ip_address(LAB_DNS[name])   # a name is only as in scope as its address
        if not in_any(ip, ROE["in_scope_nets"]) or in_any(ip, ROE["excluded_nets"]):
            return f"NO  name resolves to {ip}, outside scope: ask"
        return "yes"
    if in_any(ip, ROE["excluded_nets"]):
        return "NO  address explicitly excluded"
    if in_any(ip, ROE["in_scope_nets"]):
        return "yes"
    return "NO  address not in scope"

t = lambda s: datetime.fromisoformat(s).replace(tzinfo=timezone.utc)
requests = [
    ("10.10.0.25",        t("2026-12-02T09:30"), "discovery"),
    ("10.10.0.1",         t("2026-12-02T09:30"), "discovery"),
    ("10.10.0.203",       t("2026-12-02T09:30"), "web-testing"),
    ("10.10.1.25",        t("2026-12-02T09:30"), "discovery"),
    ("shop.app.lab.test", t("2026-12-03T16:59"), "web-testing"),
    ("cdn.app.lab.test",  t("2026-12-03T10:00"), "web-testing"),
    ("pay.app.lab.test",  t("2026-12-03T10:00"), "web-testing"),
    ("mail.lab.test",     t("2026-12-03T10:00"), "auth-testing"),
    ("lab.test",          t("2026-12-03T17:00"), "web-testing"),
    ("10.10.0.40",        t("2026-12-04T11:00"), "denial-of-service"),
    ("10.10.0.40",        t("2026-12-15T11:00"), "discovery"),
]
for target, when, tech in requests:
    print(f"{target:<18} {when:%m-%d %H:%M}  {tech:<17} {check(target, when, tech)}")
10.10.0.25         12-02 09:30  discovery         yes
10.10.0.1          12-02 09:30  discovery         NO  address explicitly excluded
10.10.0.203        12-02 09:30  web-testing       NO  address explicitly excluded
10.10.1.25         12-02 09:30  discovery         NO  address not in scope
shop.app.lab.test  12-03 16:59  web-testing       yes
cdn.app.lab.test   12-03 10:00  web-testing       NO  name resolves to 203.0.113.50, outside scope: ask
pay.app.lab.test   12-03 10:00  web-testing       NO  host explicitly excluded
mail.lab.test      12-03 10:00  auth-testing      NO  name not in scope
lab.test           12-03 17:00  web-testing       NO  outside the daily window
10.10.0.40         12-04 11:00  denial-of-service NO  technique not allowed
10.10.0.40         12-15 11:00  discovery         NO  outside the test dates

Read the refusals, because each is a real-world mistake:

  • 10.10.0.1 and 10.10.0.203 are inside 10.10.0.0/24 but excluded (the router and the backup block 10.10.0.200/29, which covers .200 to .207). Exclusions win over inclusions.
  • 10.10.1.25 is one digit away from scope. Typos in a target list are a classic way to attack somebody else.
  • cdn.app.lab.test matches the wildcard, but its address belongs to someone else: a CDN, a cloud load balancer or a SaaS vendor. A name is only as in scope as the address it points to. The right move is to stop and ask.
  • lab.test at 17:00 is one minute late: the window is [08:00, 17:00).
  • Denial of service is not in the technique list, so it is forbidden even against an in-scope host.

A template you can reuse

Keep a copy of this in your learning journal and fill it in even for your own lab; the habit is the point.

text
AUTHORIZATION TO PERFORM SECURITY TESTING
Client (legal name): ............................................
Authorised by (name, role): ................ Signature/date: ....
Statement: I own or am entitled to authorise testing of the systems below.
Testers: ............................ Company: .....................
Dates and hours (with time zone): ..................................
IN SCOPE   addresses: ..............  names: ..........  apps/accounts: ........
EXCLUDED   addresses: ..............  names: ..........  third-party services: ...
ALLOWED    techniques: ...............................................
FORBIDDEN  techniques: DoS, social engineering, physical, data exfiltration beyond proof
Rate limits / quiet hours: .........................................
Sensitive data found: stop, record minimum evidence, notify ........ within .. hours
Critical finding: notify .................... by phone at once
Emergency stop contact (24/7): .....................................
Evidence handling and deletion after report: .........................
Report due: ........  Retest: ........

How violations are noticed

Scope mistakes are rarely invisible. Defenders see out-of-scope traffic in firewall and IDS logs, cloud providers flag scans of their address space, and the third party whose CDN you hit will report it to its abuse contact. A professional team therefore keeps its own activity log: source address, target, time, technique, for every action. If something breaks or someone complains, the log shows exactly what was done and that it matched the RoE. Testers announce their source addresses to the client in advance so the blue team can tell test traffic from a real attack.

Pitfalls

  • Permission from the wrong person. An enthusiastic engineer's "go ahead" in a chat is not authorisation. Get it from someone who controls the systems, in writing.
  • Shared infrastructure. Hosting, CDNs, email providers, identity providers and payment processors are third parties. Their own terms decide what you may do.
  • Scope drift. You find credentials that open a new system. Finding them is a result; using them on a system outside scope is a new, unauthorised act. Report and ask.
  • Bug bounty scope is still scope. A public programme's page is the authorization document; its exclusions and rules apply exactly (Responsible Disclosure, Bug Bounties and security.txt).
  • Your own lab is not your employer's network. Owning the laptop doesn't mean you may scan the office Wi-Fi it is connected to; that is why your lab runs on isolated virtual networks.

Practice

  1. Add a rule to the checker: the RoE allows at most 50 requests per minute for web-testing. What data would the function need, and where should the check go?
  2. A client's scope says *.shop.lab.test. Is shop.lab.test itself in scope under the checker? Under the plain reading of the wildcard?
  3. During an in-scope test you find a public storage bucket full of customer records, hosted by a cloud provider. What do you do?
Answers
  1. A count of requests per (technique, minute) from the activity log; check it after the technique test and refuse with "rate limit reached". Real tools enforce this with their own throttling options, and the log proves it.
  2. No: fnmatch("shop.lab.test", "*.shop.lab.test") is false because the pattern needs a dot before shop. The plain reading is ambiguous too, which is exactly why scope should list the apex name separately if it is meant.
  3. Stop, don't download or browse further than needed to describe it, record minimal evidence (the URL, a listing count, the time), and notify the client contact at once as the RoE says for sensitive data. Whether the bucket itself may be examined is the client's and the provider's decision.

Test yourself

Who can authorise a penetration test of a company's servers?

  1. Any employee of the company
  2. Someone with authority over those systems, in writing
  3. The tester, if the intent is good
  4. Anyone, as long as no data is changed

Scope includes 10.10.0.0/24 and excludes 10.10.0.200/29. Is 10.10.0.205 in scope?

  1. Yes, it is in the /24
  2. No, it is in the excluded /29 (.200 to .207)
  3. Only during the daily window
  4. Only for discovery

cdn.app.lab.test matches the in-scope wildcard *.app.lab.test, but resolves to an address owned by a CDN provider. What should you do?

  1. Test it: the name is in scope
  2. Stop and ask: the address belongs to a third party that has not authorised testing
  3. Test it slowly
  4. Test only at night

Which document answers 'how may we test' (techniques, rate limits, what to do with sensitive data)?

  1. The invoice
  2. The rules of engagement
  3. The security.txt file
  4. The final report