Anyone about to hire a penetration test soon finds out that the word pentest covers very different kinds of work. Testing the internal network by simulating a malicious employee is one thing; testing the web application exposed on the internet is another, with its own goal, technique and cost. If you pick the wrong type, you end up with a report that does not answer the question that made you hire the test in the first place.
To keep your bearings, it helps to sort the types of pentest along three axes: the position of the simulated attacker (internal or external), the level of access and information the tester receives (black, gray or white box) and the target (application, API, network, cloud). With these axes clear, it gets easier to define a scope that answers your goal and to compare proposals that look the same at first glance but cover different things.
Internal and external pentests
The first axis is the starting point of the test. In an external pentest, the tester plays the role of an attacker on the internet, with no prior access, trying to compromise whatever is exposed (applications, services and the network edge). The question it answers is how much risk your public surface carries. An internal pentest starts from inside the network and simulates someone who already has some access, whether a malicious employee or an attacker who has already made it past the edge.
Because each one looks at a different risk, the two complement each other. Many companies invest only in the external test and forget that much of the damage in an incident happens after initial access, through lateral movement and privilege escalation inside the network. The internal pentest is what measures how well the environment holds up during that second stage of the attack.
Black, gray and white box
The second axis is how much the tester knows and receives before starting. This level of access affects the realism, the coverage and the cost of the test, and none of the options is best for everything: each one fits a different goal.
- In black box testing, the tester starts with no privileged information, just as a real external attacker would. More time goes into reconnaissance, but the test faithfully reproduces the scenario of someone who does not know the environment.
- In gray box testing, the tester receives credentials and some context, the same a regular user would have. It is a middle ground between realism and depth, and it is usually the format that offers the best value for money.
- In white box testing, the tester gets broad access to documentation, configuration and sometimes the code. This yields the most coverage per hour invested, which is why it is the format to choose when the goal is to find as many flaws as possible.
When to choose each level
It all depends on what you want to learn from the test. If the idea is to measure resistance to an attacker who arrives with nothing, black box makes sense. If the idea is to dig deeper into a critical application within the available budget, gray or white box covers more in less time, because the tester does not spend hours discovering what the company itself could have told them.
Black box has a practical limit: part of the contracted time goes to reconnaissance, and the clock runs the same for everyone. A large target tested in black box on a short deadline tends to end up with whole areas left uncovered, simply because the tester did not have time to get to them. If what you need is confidence in the depth of the analysis, sharing context usually pays off more than preserving the realism of an attacker who knows nothing.
Types by target
The third axis is the target. Each kind of target calls for its own skills and approach, which changes the effort involved and the profile of the people doing the work. So lumping very different targets into a single, poorly defined scope tends to water down the depth of the test across all of them.
- Web application, focusing on authentication, authorization, injection and business logic
- API, looking at the REST or GraphQL surface, input validation and access control
- Internal network, where exposed services, segmentation and lateral movement are what count
- Cloud environment, with attention to identity, public exposure and privilege escalation
- Mobile application, which includes the app, its communication with the server and local storage
- Social engineering, which involves controlled phishing simulations and testing of the human factor
Methodology, scope and authorization
What separates professional work from a legal risk is formalization, and it happens before any testing. A pentest is an activity authorized in writing, with a defined scope and rules of engagement agreed between the parties. Without explicit authorization from someone with the power to grant it, the same techniques stop being a contracted test and become unauthorized access. That is why the authorization document (often called the rules of engagement) is the basis for the whole job.
What to define in the scope
- Which domains, IP ranges, applications and accounts are included in the test
- What stays out, such as third-party systems and environments that must not be touched
- The execution window and the agreed times for the highest-impact actions
- What kind of action is allowed (active exploitation, for example) and what is expressly forbidden
- Emergency contacts on both sides, to pause the test if something goes off plan
- How to handle sensitive data that turns up during the test and which confidentiality rules apply
Note that the authorization has to come from whoever has authority over the assets being tested. If the system is hosted on a third party's cloud, or if the target is a SaaS application, you usually also need the provider's permission, because its contract may restrict security testing. Ignoring this detail exposes the company and the tester to consequences that have nothing to do with the technical result.
Test environment or production
Another scope decision is where the test runs: in production or in a mirrored environment. Production shows reality more faithfully, but it carries the risk of downtime and of side effects on real data. A staging environment reduces that risk, as long as it faithfully matches production (which does not always happen). The choice weighs your tolerance for impact against the fidelity of the alternative environment, and it has to be settled before the work begins.
Recognized standards and methodologies
A test that follows a method tends to be more complete than an improvised one, and it is easier to compare across vendors. Recognized methodologies define phases and a list of what needs to be covered, which lowers the chance that the tester forgets an entire class of flaw. They do not replace the tester's skill, but they raise the minimum level of the work and make it possible to audit coverage.
- OWASP Testing Guide and OWASP ASVS, for web applications, which provide vulnerability classes and verification levels
- OWASP API Security Project, focused on the specific surface of APIs
- PTES, which describes the phases of a penetration test from start to finish
- NIST SP 800-115, a technical reference for planning and execution
- MITRE ATT&CK, which standardizes how techniques are described in more adversarial tests
When comparing proposals, ask which methodology guides the work and how coverage will be demonstrated. A proposal that only promises to find vulnerabilities, without describing method and phases, gives little confidence that the whole target will be covered. The final report is also more useful when it ties each finding to a known reference: the internal team understands the nature of the flaw better and can compare results from one cycle to the next.
Red team and the focused test
Many people confuse a pentest with a red team exercise. A pentest has a defined scope and tries to find and prove as many relevant vulnerabilities as possible in a target, within a deadline. A red team pursues a specific objective (reaching critical data, for example) and also tests the company's detection and response capability, often without the defense team knowing about the exercise.
A red team makes sense for more mature organizations, ones that have already fixed the basics and want to put their entire security operation to the test. For most companies, a well-scoped pentest yields more, because it shows the flaws an attacker would exploit first. Moving to a red team before getting the basics right is usually money spent in the wrong place.
Practical checklist
- Define the goal of the test before choosing the format
- Decide between an external pentest, an internal one or both
- Choose the access level: black, gray or white box
- Define the target clearly (web, API, network, cloud)
- Do not mix very different targets in a shallow scope
- Formalize scope and authorization in writing
- Record the rules of engagement, with windows, contacts and forbidden actions
- Get authorization from whoever answers for the assets and, when applicable, from the provider
- Decide whether the test runs in production or in a mirrored environment
- Ask which recognized methodology guides the work
- Choose between pentest and red team according to your maturity
- Require a report with evidence, severity and a retest
Best practices
- Choose the type of test by the scenario you need to simulate
- Formalize authorization before any action, with no exceptions
- Combine external and internal testing to cover both stages of the attack
- Prefer gray box when you need a balance between realism and depth
- Scope one target at a time so the analysis is not diluted
- Work with a recognized methodology, so that coverage can be audited
- Leave the red team for after the basics are in place
- Repeat the pentest periodically, because the environment changes
Common mistakes
- Starting the test without formal authorization and without a written scope
- The activity stops being a contracted test and becomes a legal risk for both parties.
- Testing third-party assets without the provider's permission
- The provider's contract is breached, whatever the technical result.
- Testing only the external surface and forgetting the internal network
- Nobody assesses how well the environment holds up against lateral movement.
- Asking for black box while expecting maximum coverage
- The time spent on reconnaissance comes out of the depth of the analysis.
- Mixing many targets in a poorly defined scope
- The analysis stays shallow across all of them, and relevant flaws are left out.
- Hiring a red team before getting the basics right
- You spend a lot before fixing what an attacker would exploit first.
Authorship and review
Cesar Gargiulo
CEO and founder of GUARDIASEC. Technical and editorial lead for the content published in this library.
Published on . Found a technical error? Write to [email protected] and we will correct it and keep a record of the change.