TExcelTAD
Home › Ethical Hacking & Penetration Testing Methodology › Test Windows, Stop Conditions and Data Handling

Test Windows, Stop Conditions and Data Handling

Three clauses of the rules of engagement decide whether an engagement ends well when something unexpected happens: when testing is allowed, what makes it stop, and what happens to the data the testers see. They are short, and they are the clauses most often written vaguely. This lesson makes each one concrete: a window check that knows about time zones, a stop-condition monitor fed by the client's health metrics, and a data-handling procedure for the moment a tester finds something they should not keep.

Test windows

A window has dates, daily hours, a time zone and exceptions: change freezes, month-end processing, a product launch. Testers in another country make the zone matter. The engagement below has servers and the client in Ho Chi Minh City (UTC+7) and testers in Berlin (UTC+1 in December); the window is 08:00–18:00 client time on working days, with one freeze day.

python · try it yourself
from datetime import datetime, timedelta, timezone, date

CLIENT_TZ = timezone(timedelta(hours=7), "UTC+7")
TESTER_TZ = timezone(timedelta(hours=1), "UTC+1")
WINDOW = {"from": date(2026, 12, 1), "to": date(2026, 12, 12), "hours": (8, 18),
          "weekdays_only": True, "freeze": {date(2026, 12, 4)}}

def allowed(moment):
    local = moment.astimezone(CLIENT_TZ)          # always judge in the client's zone
    d = local.date()
    if not WINDOW["from"] <= d <= WINDOW["to"]:
        return False, "outside dates"
    if WINDOW["weekdays_only"] and d.weekday() >= 5:
        return False, "weekend"
    if d in WINDOW["freeze"]:
        return False, "change freeze"
    lo, hi = WINDOW["hours"]
    if not lo <= local.hour < hi:
        return False, f"{local:%H:%M} client time"
    return True, f"{local:%H:%M} client time"

plans = [datetime(2026, 12, 1, 9, 0, tzinfo=TESTER_TZ),     # tester starts work in Berlin
         datetime(2026, 12, 1, 2, 30, tzinfo=TESTER_TZ),    # early start to catch the window
         datetime(2026, 12, 3, 11, 59, tzinfo=TESTER_TZ),
         datetime(2026, 12, 3, 12, 0, tzinfo=TESTER_TZ),
         datetime(2026, 12, 4, 3, 0, tzinfo=TESTER_TZ),
         datetime(2026, 12, 5, 3, 0, tzinfo=TESTER_TZ)]
for p in plans:
    ok, why = allowed(p)
    print(f"tester {p:%a %d %H:%M} UTC+1 -> {'GO  ' if ok else 'WAIT'} ({why})")
tester Tue 01 09:00 UTC+1 -> GO   (15:00 client time)
tester Tue 01 02:30 UTC+1 -> GO   (08:30 client time)
tester Thu 03 11:59 UTC+1 -> GO   (17:59 client time)
tester Thu 03 12:00 UTC+1 -> WAIT (18:00 client time)
tester Fri 04 03:00 UTC+1 -> WAIT (change freeze)
tester Sat 05 03:00 UTC+1 -> WAIT (weekend)

A tester who starts at 09:00 in Berlin is inside the window but has only three hours left (it is already 15:00 for the client); the useful working day starts at 02:00 Berlin time. The 12:00 Berlin plan on the 3rd is 18:00 for the client, the first minute outside [08:00, 18:00). Writing the window as a half-open interval in one named zone removes the argument.

Stop conditions

A stop condition is an event after which testing halts at once and resumes only when the client lead says so. Typical ones:

  • service degradation: error rates or response times beyond agreed thresholds, or a service down;
  • out-of-scope access: a request or a credential reached a system outside scope;
  • a real attacker: signs of a compromise that predates the test (unknown web shells, accounts, outbound connections);
  • sensitive data in unexpected volume, or data of a kind the RoE doesn't cover;
  • the client asks, through any listed contact.

The first can be automated when the client shares health metrics. The series below is a synthetic minute-by-minute record for the shop during a test; the thresholds come from the RoE (error rate above 2 % or 95th-percentile latency above 1500 ms for two consecutive minutes).

python · try it yourself
metrics = [  # (minute, requests, errors, p95 latency ms) - synthetic monitoring export
    (0, 1200, 3, 310), (1, 1180, 2, 295), (2, 1350, 4, 340), (3, 1400, 9, 420),
    (4, 1390, 31, 980), (5, 1420, 36, 1620), (6, 1100, 41, 1710), (7, 900, 12, 640),
    (8, 1210, 3, 320), (9, 1190, 2, 300),
]
ERR_LIMIT, P95_LIMIT, CONSECUTIVE = 0.02, 1500, 2

breaches, run = [], 0
for minute, req, err, p95 in metrics:
    rate = err / req
    bad = rate > ERR_LIMIT or p95 > P95_LIMIT
    run = run + 1 if bad else 0
    flag = "STOP" if run >= CONSECUTIVE else ("warn" if bad else "ok")
    print(f"min {minute}: {req:5} req  err {rate:6.2%}  p95 {p95:5} ms  {flag}")
    if flag == "STOP":
        breaches.append(minute)
print("first stop at minute", breaches[0] if breaches else None)
min 0:  1200 req  err  0.25%  p95   310 ms  ok
min 1:  1180 req  err  0.17%  p95   295 ms  ok
min 2:  1350 req  err  0.30%  p95   340 ms  ok
min 3:  1400 req  err  0.64%  p95   420 ms  ok
min 4:  1390 req  err  2.23%  p95   980 ms  warn
min 5:  1420 req  err  2.54%  p95  1620 ms  STOP
min 6:  1100 req  err  3.73%  p95  1710 ms  STOP
min 7:   900 req  err  1.33%  p95   640 ms  ok
min 8:  1210 req  err  0.25%  p95   320 ms  ok
min 9:  1190 req  err  0.17%  p95   300 ms  ok
first stop at minute 5

At minute 4 the error rate crosses 2 % (a warning); at minute 5 both thresholds are breached for the second minute running, and the test stops. What follows is fixed by the RoE: pause every tool, call the technical contact, note the exact last actions from the activity log, and wait. Here the service recovered at minute 7, shortly after the testing tools paused. That pattern suggests the test caused the problem, which is valuable information (the shop can't absorb 1,400 requests a minute without errors) and goes into the report.

Data handling

Testers routinely see data they should not keep: customer records in an exposed backup, passwords in a script, health data in a log file. The RoE turns that moment into a procedure:

  1. Stop browsing that data. Proving the exposure needs a few facts, not the content.
  2. Record the minimum: location, type of data, approximate count, the timestamp, how it was reached. A redacted screenshot showing one masked record is usually enough.
  3. Don't copy files or records off the client's systems. If evidence must contain data, mask it at once (a***@lab.test, last four digits only).
  4. Notify the named contact within the agreed time, by the agreed channel.
  5. Store all evidence encrypted, on engagement-specific storage, for the agreed retention period, then delete it and confirm in writing.

The legal background matters here: under data-protection laws such as the GDPR, seeing personal data while testing is processing it, which is why the contract stack includes a data processing agreement. Evidence collection is covered in detail in Evidence Collection and Cleanup.

How problems are detected

Window breaches show up in the blue team's logs and in the testers' own activity log, which should record times in UTC with the client zone shown. Degradation shows up in the client's monitoring before anyone phones; sharing a dashboard with the testers turns it into a stop signal instead of a complaint. Data mishandling is the hardest to see from outside, which is why the procedure is written in advance and the evidence store is audited at the end.

How it is prevented

Tools that refuse to run outside the window (a wrapper that calls allowed() before each job), stop thresholds agreed with numbers, a monitoring view shared with the testers, and an evidence store that only accepts encrypted, labelled files.

Pitfalls

  • Daylight saving. A window written as "UTC+1" is wrong half the year in Berlin. Name the client's zone (Europe/Berlin, Asia/Ho_Chi_Minh) and let the library compute the offset, or write the window in UTC.
  • Long jobs that run past the window. A scan started at 17:50 still sends packets at 18:30. Estimate durations and stop jobs at the boundary.
  • "Stop" without "resume". The RoE must say who can restart the test and how that is recorded.
  • Evidence on personal laptops. Engagement data belongs in encrypted engagement storage, not in a tester's downloads folder.

Practice

  1. Add a check to allowed() that refuses any job whose estimated end falls outside the window. What extra input does it need?
  2. In the metrics, change minute 4's errors to 20. When does the monitor now stop, and why?
  3. You find customers_2025.csv on an open file share in scope. Write the five lines you put in the activity log.
Answers
  1. The job's expected duration: compute end = start + duration and require both allowed(start) and allowed(end - timedelta(seconds=1)) (the window is half-open), and the same date.
  2. 20/1390 = 1.44 % is below 2 % and p95 980 ms is below 1500, so minute 4 is ok; minutes 5 and 6 breach, and the stop comes at minute 6.
  3. For example: time (UTC); path \\files01.lab.test\public\customers_2025.csv, reached anonymously; type: customer names and e-mail addresses (header row and one masked record seen); size about 48 000 lines from the listing, not opened further; client contact notified by phone at (time), stopped browsing the share, file not copied.

Test yourself

The window is 08:00-18:00 UTC+7 and a tester in UTC+1 plans to start at 09:00 local time. Is that inside the window?

  1. No, it is before the window opens
  2. Yes, but only three hours remain: 09:00 UTC+1 is 15:00 UTC+7, and the window closes at 18:00
  3. Only on weekends
  4. Time zones don't matter for windows

Which of these is a stop condition?

  1. Finding the first vulnerability
  2. Signs that a real attacker compromised the system before the test
  3. Lunch break
  4. A slow scanner

You find a file of customer records. What is the right first action?

  1. Download it as evidence
  2. Stop browsing it, record the minimum, don't copy, notify the contact
  3. Delete it to protect the customers
  4. Post a redacted copy in the team chat

Why is 'UTC+1' a poor way to write a window for a client in Berlin?

  1. It is too short
  2. Daylight saving changes the offset to UTC+2 in summer; name the zone or use UTC
  3. Berlin uses UTC
  4. Testing tools can't read it