A penetration test simulates a real adversary against a system to surface exploitable weaknesses. The setup question — where the test runs and under what rules — is at least as important as the skill of the testers. Setup decisions trade off realism, blast radius, data sensitivity, and cost. It is a key practice in Cyber Security alongside Threat Modelling and Threat Analysis.
Why a separate environment
Testing production directly is the most realistic option but carries clear downsides:
- Customer data is exposed to a third-party tester unless contracts explicitly permit it.
- Exploits that cause downtime, data corruption, or queue floods affect real users.
- Customer agreements and regulations (PCI DSS, ISO 27001, SOC 2 scope, GDPR) often prohibit certain test classes against production.
- Pentest noise pollutes monitoring and incident response — see SIEM and SOAR integration concerns.
A dedicated environment isolates risk while keeping the test useful — provided the environment closely resembles production.
Common environment patterns
DR-restored environment
Restore a recent backup into an isolated account, VPC, or subscription (e.g. via AWS Backup or Database Migration Patterns tooling). Pentesters work against real-shaped data on real-shaped infrastructure. This doubles as a Disaster Recovery Concept rehearsal — see RPO and RTO.
- Pros: realistic data shape, exercises the recovery path, surfaces issues that synthetic data misses (e.g. permission boundaries, role hierarchies, multi-tenant edge cases).
- Cons: data must be anonymised or pseudonymised before testers connect (see Anonymization Patterns); backup snapshot timing must align with the test window; running a parallel environment costs money; rebuilding it for each test adds operational overhead.
- Often combined with a data masking pipeline (potentially driven by AWS DMS) that runs as part of the restore (PII → fake values, payment tokens → dummy tokens, secrets rotated through Secrets Manager / KMS).
Pre-production clone
A long-lived environment that mirrors production topology, populated with synthetic or anonymised data.
- Pros: always available, cheaper per-test (cost amortised), no per-engagement restore work.
- Cons: drifts from production over time unless rigorously kept in sync; synthetic data can hide bugs that only manifest on real distributions.
- Common in mature SDLC pipelines where a staging/UAT environment already exists and is “promoted” for pentest use.
Time-boxed production test
Contractual permission to test against production within a defined window.
- Pros: maximum realism — same scaling, same dependencies, same configuration.
- Cons: high blast-radius risk; requires explicit customer notification or legal carve-out; aggressive techniques (DoS, fuzzing high-volume endpoints) generally excluded; out-of-hours window may not match where attackers actually probe. Rate Limiting thresholds may need temporary adjustment.
- Reserved for mature security programmes with rollback playbooks, on-call coverage during the test, and a clear stop signal.
Scoping models
The information given to testers shapes what they find:
- Black-box — no internal information. Mirrors an external attacker. Spends time on reconnaissance and discovery; deeper logic flaws may go unfound in the test window.
- White-box — full access to source code, architecture diagrams, threat models, credentials. Maximises depth of findings per hour. Closer to a thorough code review with active exploitation.
- Grey-box — partial information, often a low-privilege user account plus high-level architecture. Pragmatic balance for most engagements.
Grey-box is the most common commercial choice; it avoids paying testers to brute-force discovery while still preserving an outsider perspective on the application surface.
Rules of engagement
A Rules of Engagement (RoE) document is signed before any traffic flows. It typically covers:
- Scope — domains, IP ranges, applications, accounts that are in scope.
- Out-of-scope — third-party services (which would constitute attacking the third party), production payment processors, dependencies whose contracts forbid testing.
- Time windows — when testing may occur; quiet hours; freeze periods around major releases.
- Allowed techniques — explicit list. DoS, social engineering, and physical intrusion typically excluded unless separately commissioned.
- Data handling — how testers store evidence, how long they retain it, how they destroy it.
- Communication channels — primary contact, escalation path for “we found something critical right now”, out-of-band channel if production is broken.
- Stop conditions — circumstances under which the test pauses (live incident, suspected real attacker activity, data loss risk).
Avoiding noise (and not avoiding too much)
During the test window, defenders need to distinguish pentest traffic from real attacks:
- Pentest egress IPs added to monitoring allowlists so dashboards stay readable. See Monitoring Cloudflare Security Events and CloudTrail Auditing.
- Specific alerts suppressed or routed to a separate channel for the duration (CloudWatch alarms / CloudWatch Alarms SLO Driven).
- A parallel detection channel stays live for non-pentest activity — a real attacker piggybacking on the test window must still be detected. XDR and GuardDuty coverage should remain on.
- Some teams deliberately do not tell the SOC the exact pentest hours, treating the engagement as a simultaneous purple team exercise that measures detection and response.
Findings classification
Findings are categorised by severity, typically using CVSS scores (each finding may map to a public CVE or be a novel Vulnerability):
- Critical (CVSS 9.0–10.0) — immediate exploitation risk; remediate now.
- High (7.0–8.9) — exploitable with moderate effort or significant impact.
- Medium (4.0–6.9) — limited impact or requires significant preconditions.
- Low (0.1–3.9) — informational or hardening recommendations.
Classification should consider both the vulnerability (CVSS base) and environmental context (CVSS environmental metrics) — a “high” issue on an internal-only debug endpoint may be lower in practice than a “medium” on the public sign-up form.
Retest
After remediation, testers re-validate that:
- The fix actually closes the original finding.
- The fix did not introduce a new issue or weaken an adjacent control.
- Defence-in-depth assumptions still hold.
A finding is not closed until a retest confirms it. This is contractual in most engagements and is the only reliable evidence of remediation.
Standards and frameworks
- PTES — Penetration Testing Execution Standard. Phases: pre-engagement, intelligence gathering, threat modelling, vulnerability analysis, exploitation, post-exploitation, reporting. Map findings to STRIDE categories and MITRE ATT&CK tactics.
- OWASP Testing Guide — application-focused methodology, well-aligned with the OWASP Top 10. Watch for XSS, CSRF, SQLi, and RCE classes.
- NIST 800-115 — Technical Guide to Information Security Testing and Assessment, part of broader NIST guidance. Government-flavoured but broadly applicable.
- OSSTMM — Open Source Security Testing Methodology Manual. Heavier formalism, common in regulated industries — relates to Standards like ISO 27001.
Key takeaways
- Choose the environment based on data sensitivity, realism needs, and blast-radius tolerance.
- DR-restored environments double as a recovery-path test.
- A signed Rules of Engagement document avoids ambiguity about scope, techniques, and escalation.
- Suppress pentest noise without going dark on real attacks.
- Findings are not closed until a retest confirms remediation.
See also
- OWASP
- Vulnerability
- Threat Modelling
- Threats
- Rate Limiting
- TLS Certificate Authorities
- Apex Domain Limitations
- Security Posture
- Least Privilages
References
- Penetration Testing Execution Standard (PTES)
- OWASP Web Security Testing Guide (WSTG)
- NIST SP 800-115 — Technical Guide to Information Security Testing and Assessment
- FIRST CVSS specification