How to scope a penetration test
The decisions that make a test worth its price are made before the tester starts, and most of them are yours.
Scoping a penetration test means deciding what the tester may attack, from where, as whom, when, and what they must never do. A good scope starts from the question you need answered, lists every target exactly, supplies the accounts the tester needs, and writes the rules down before anyone signs. Most weak tests were weak at this step.
Updated · 8 minute read
Start with the question, not the product
"We need a pen test" is a request for a product. The scope comes from the question behind it. Write that question at the top of the scope in one sentence, and check every later change against it.
A customer's vendor review usually wants to know whether its data can be reached by other customers or from the internet. An ECC control wants evidence that your systems are tested periodically and that findings are fixed. A new release wants to know whether the new feature opened a hole. Each question points to a different test, a different target list and a different depth. When the provider suggests adding or removing something, check it against your one sentence.
If your question is "which known vulnerabilities do we have", you need a vulnerability scan, not a penetration test. If it is "would we notice a real attacker", you need a red team exercise from a specialist team, which is a different exercise from the one this guide scopes, and you probably need to fix the basics first. The guide on scans and tests covers the difference.
Every target, typed exactly
"The website" is not a target. A target is something a tester can type: a URL, an API base address and version, a mobile build number, an IP range or hostname, a cloud account identifier. List each one, then list the exclusions with a reason for each.
Exclusions need reasons because they end up in the report. A payment page hosted by your payment provider is theirs, not yours. A legacy server that falls over under load might be excluded from active testing and noted in the report instead.
One rule decides a lot here: you can only authorise testing of systems you control. A software service you subscribe to belongs to its vendor. Your hosting provider's terms may require notice before testing, or restrict some kinds of test. Check both before the scope is final, not on day one of the test.
- Web applications by URL, including the admin path if there is one
- APIs by base URL and version, with the documentation if it exists
- Mobile apps by platform and build number
- Networks by IP range or hostname, marking which ranges are internet-facing
- Cloud accounts by account or subscription identifier, if configuration is in scope
Where the tester starts
Testers describe their starting point three ways. Black box means only a URL or address range. Grey box adds working accounts and basic documentation. White box adds architecture diagrams and possibly source code. Grey box is usually the best value.
Black box sounds realistic, but a real attacker has months and your tester has days. Much of a short black box test is spent finding the login page. Grey box puts the testing days into finding flaws rather than into reconnaissance a real attacker would do anyway. White box finds the most, and it is the right choice for high-risk applications.
For any application with more than one customer or more than one role, one line in the scope matters more than any other: two accounts for each role, in two separate customer accounts. That is how a tester checks whether one customer can see another's data, and whether an ordinary user can do what only an administrator should. Without the second account, that flaw is very hard to find.
Have the accounts created and tested before the window opens. A test that loses its first day waiting for credentials has lost a fifth of a five-day test.
Staging or production
Testing a staging environment is safer, and only useful if staging matches production: the same version, the same configuration, the same integrations. Testing production is more realistic and needs more care. Many organisations test staging for depth and run a lighter check on production.
If you copy production data into staging, mask the personal data first. In Saudi Arabia, that data is covered by the PDPL wherever it sits.
Production testing needs a window outside business hours, confirmed backups, a named person on call, and a stop condition written into the rules. The lighter production check exists to confirm the two environments match.
The rules of engagement, in writing
The rules of engagement are the part of the scope that protects both sides: when testing happens, from which addresses, what is forbidden, how data is handled, when to stop and whom to call. Write them down and have both sides sign.
Each rule below answers a question someone will ask at three in the morning if it was left unwritten.
| Rule | What to write |
|---|---|
| Dates and hours | The window, with the time zone. For example, Sunday to Thursday, 22:00 to 04:00 Riyadh time. |
| Source addresses | The provider's IP addresses, so your team can tell the test from a real attack. |
| Forbidden actions | No denial of service. No destructive changes. No social engineering or physical access unless listed. |
| Data handling | Prove access with a record count or one redacted record. Never download a data set. |
| Stop conditions | If a production service slows or fails, stop and call the named contact. |
| Critical findings | Reported the same day by phone, not saved for the final report. |
| Contacts | Named people on both sides, with numbers that work at night. |
| Evidence | Where screenshots and notes are stored, and when they are deleted. |
Size the effort honestly
Testing effort is driven by the number of roles, the number of features and API endpoints, and how much business logic the application carries. Ask each provider to show its days per target, and compare those rather than the totals.
Two proposals for the same scope at very different prices usually differ in days, and fewer days means less of your application actually tested.
Be wary of a large application quoted at a small, fixed number of days. The gap is often filled by an automated scanner.
Agree the report before the test
Agree what the report will contain before you sign: an executive summary a manager can act on, the scope as tested, the method, and for each finding the target, a scored severity, evidence, steps to reproduce and remediation advice. Agree the retest terms at the same time.
The scope as tested should include anything that could not be tested and why. Each severity should name its scoring method, for example CVSS, with its version.
Ask for a redacted sample report and compare it with that list. The guide on what a good report contains gives twelve lines to hold it against.
A sample scope paragraph
A finished scope fits in one paragraph: the objective, the targets, the starting point, the environment, the window, the exclusions and how critical findings are reported. The paragraph below shows one done properly. The names are placeholders.
Objective: confirm that a customer cannot reach another customer's data in the portal or its API, and that neither can be compromised from the internet. Targets: the customer portal at portal.example.com and its API at api.example.com/v2, documented in the attached specification. Starting point: grey box, with two customer users and one customer administrator in each of two test tenants, and one internal support account. Environment: staging, running the current production release, refreshed from production with personal data masked. Window: Sunday to Thursday, 22:00 to 04:00 Riyadh time, over two weeks. Excluded: the payment page hosted by the payment provider, and denial-of-service testing. Critical findings: by phone to the IT manager the same day.
The scope checklist
Eleven items settle a scope. Tick each one before anyone signs the test order. An item left open usually costs testing days once the window has started.
- The question, in one sentence
- Every target, typed exactly
- Exclusions, each with a reason
- Hosting and software vendor terms checked
- Starting point: black, grey or white box
- Two accounts per role, in two tenants, created and tested
- Environment chosen; production data masked if copied
- Rules of engagement written and signed
- Days per target shown by each provider
- Report contents and retest terms agreed
- Authorisation letter signed
Questions from the person signing
How long should a test take?
It depends on the scope, not the calendar. A single web application with a few roles is typically days of testing; a platform with an API, mobile apps and many roles is weeks. Ask each provider for days per target and compare those.
Should our IT team know the test is happening?
Usually yes, so they do not treat it as an attack or block it halfway. Testing whether your team notices an attack is a different exercise, a red team run by specialists under its own rules.
Can we test our cloud provider or a software service we use?
Not their platform. You can test your own configuration and your own applications, subject to the provider's terms.
Should we test production or staging?
Staging, if it truly matches production; production, with more care, if it does not. Many organisations do both at different depths.
What if the tester finds something critical on day one?
The rules of engagement should already say: a same-day phone call to a named person, who decides whether to fix it immediately or let testing continue around it.
Where to go next
Commissioning a penetration test
The scope, the provider comparison, the report reading and the retest, run with you from the buyer's side.
Read moreGuideWhat a good report contains
Twelve lines to hold a sample report against before you sign, and the final one before you pay.
Read moreGuideScan or penetration test
If your question is which known weaknesses you carry, a scan answers it. Which test answers which question.
Read morePart of one system
Every division keeps records to the same standard, so the second one you need works the way the first one did.
Have the scope written on your side
A scoping session turns the question behind the test into a scope, rules of engagement and an authorisation you can hand to any qualified provider.