In short
The terms “black box,” “gray box,” and “white box” describe the level of information provided to the penetration tester before a penetration test. In a black box test, the pentester starts from scratch, like an external attacker; in a gray box test, the pentester has access to user accounts or documentation; in a white box test, the pentester has access to the source code and architecture. The more the pentester knows, the further the test can go within the allotted time; for a web application, the gray box approach is often the best compromise.
The three approaches
| Black box | Gray box | White box | |
|---|---|---|---|
| Information Provided | None, except for the scope | Test accounts, roles, documentation | Source code, architecture, configurations |
| Simulated Scenario | Anonymous external attacker | Malicious client, employee, or partner, or a stolen account | In-depth review covering all key aspects |
| Strengths | Measure what an unknown attacker can achieve | Test the separation between users and roles | Find hidden vulnerabilities and their causes in the code |
| Limitations | Time spent on discovery rather than testing; limited coverage of authenticated areas | Depends on the quality of the accounts provided | It takes longer to conduct and requires access to the source code |
How to Choose
- To assess the vulnerability of a showcase website or an external scope: black box testing.
- For an application with customer areas, roles, or sensitive data: gray box testing, with at least two accounts per role to test access to other users’ data.
- For a critical component, such as an authentication or payment module: white box testing, or gray box testing supplemented by a targeted code review.
A common misconception is that the black box approach is more “realistic.” But a real attacker has all the time in the world, whereas the penetration tester works within a limited timeframe: providing the tester with information compensates for this difference rather than skewing the test.
Frequently asked questions
Why provide two accounts per role?
This is because some of the most serious vulnerabilities, such as IDOR, involve accessing another user’s data: at least two accounts are needed to verify that one user cannot read or modify data belonging to the other.
Sources
Find out where an attacker would get in.
Our AI agents actually attack your scope, fully automated, and hand you the proof of every vulnerability.
