The right penetration test is the one that answers a specific question about your systems. Most disappointing tests were bought the other way round: someone picked an item from a vendor's menu, usually "web application test, five days", and found out afterwards that it did not cover the thing they were worried about.
Choosing well takes three decisions. What you want to learn, which systems hold the answer, and how much access to give the tester. This post walks through each one and ends with a worked example. For definitions of the individual test types, see the map of penetration testing types.
Start with the question, not the menu
Write down the sentence you want the report to confirm or disprove. Then pick the test that can do that.
| The question you need answered | The test that answers it |
|---|---|
| Can a stranger on the internet get into anything we run? | External test, black-box, starting with discovery of everything you expose |
| Can one customer read or change another customer's data? | Gray-box web application and API test, using accounts in at least two separate customers |
| Can a normal user give themselves admin rights? | Gray-box application test with one account per role |
| If an employee's laptop is compromised, how far does the attacker get? | Internal test from an assumed-breach starting point |
| If one cloud workload is taken over, what else can it reach? | Cloud test focused on identities, roles and network paths |
| Would we notice a real intrusion, and how fast? | Red team exercise |
| Is this new feature safe to release? | A narrow test of the changed code paths and anything they touch |
| Will this satisfy our auditor or a customer's security review? | A test scoped to what the framework or customer expects, confirmed with them first |
Two of these deserve a comment. The auditor question is legitimate, but it is about paperwork and not about risk. Pair it with one of the others, or you may get a report that passes the audit and tells you little. And the red team question is only worth asking once the basics are in place. If an ordinary test still finds serious flaws in an afternoon, a stealthy month-long exercise will find the same flaws at a much higher price.
Four facts that narrow the choice
Once you have the question, four facts about your company settle most of the remaining decisions.
- Where the valuable data lives. If it sits behind your application's login, test the application with credentials. If it sits on file servers in an office network, test that network from the inside.
- What changes most often. A network perimeter that has looked the same for two years needs less frequent attention than an API that ships new endpoints every week. Put the most testing where the most change is.
- Who will read the report. A customer's security team, a SOC 2 auditor and a PCI assessor each expect different things. PCI DSS, for example, expects both internal and external testing of the card data environment. Ask what is required before you scope, not after.
- What was tested last time. If last year's test covered the main application, look at what it left out: the admin console, the mobile app, the partner API, the cloud account itself.
Decide how much to tell the tester
For application tests, gray-box is the sensible default. Give the tester user accounts for each role and, if you have it, an API specification. Most damaging application flaws are authorization flaws, and those can only be found by someone who is logged in and can compare what two different users are allowed to do.
Use black-box when the question is about exposure, meaning what an outsider can find and reach. It is a good fit for the external perimeter and a poor fit for judging the depth of an application's access controls. The trade-offs are laid out in black-box penetration testing.
Use white-box, with source code, for the components where a mistake would be most costly. Authentication, payment handling and tenant isolation are the usual candidates. Reading the code lets the tester confirm that a check exists on every path, not only on the paths they happened to try.
A worked example
Take a business-software company with sixty staff. The product is a web application with a public API, hosted in one cloud provider. Everyone works remotely on managed laptops. Large customers ask for a penetration test report in their security questionnaires, and the company is working toward SOC 2.
A sensible plan for this company:
- Core test. Gray-box web and API testing, with two customer tenants and every user role. This answers the question its customers care about most: whether their data is isolated from other customers.
- Exposure check. A black-box look at everything reachable from the internet under the company's domains, to catch forgotten staging sites and old subdomains.
- Cloud identity review. A test of what a compromised application server could reach using its assigned role.
- Left out. Wireless and physical testing, because there is no office. A classic internal network test, because there is no internal network to speak of.
Change one detail and the plan changes. If the same company ran its product in its own data center with an office network and a Windows domain, an internal test would move to the top of the list.
Scoping mistakes that waste a test
A well-chosen test can still be undermined by how it is scoped. These are the common ways.
- Testing an environment that does not match production. If you test staging, know how its configuration and integrations differ.
- Providing one account. With a single user, nobody can check whether user A can reach user B's records.
- Excluding the awkward parts. Admin panels, support tooling and third-party integrations are left out because they are inconvenient to set up. They are also where controls tend to be weakest.
- Spreading the time too thin. Twenty applications in five days means a few hours each. It is better to test three properly and schedule the rest.
- Forgetting the retest. A fix that has not been attacked again is a hope. Agree up front how and when a retest happens.
Put the answers in writing in the rules of engagement so the tester and your team are working from the same document. When you are ready to compare providers, how to choose a penetration testing company covers what to ask.
Key takeaways
- Start from the question you want answered. The test type follows from it.
- Put testing where your valuable data and your fastest change are.
- Gray-box is the default for applications, black-box for exposure, white-box for the highest-risk components.
- Skip test types that have no target in your environment, and spend the saved time on depth.
- Scope decides the value of a test. Two tenants, every role, production-like configuration and a planned retest matter more than the label on the quote.