Contents(7)HideShow
A penetration test comes in three approaches, and they do not answer the same question. Black box measures what an attacker finds knowing nothing, gray box what an inadequately monitored user can obtain, white box what the code and architecture reveal when read. Choosing means first deciding which question you want to settle.
The rest of this text describes what each approach proves, what it does not prove, and in which order to chain them. The general framework of the test is in our guide to penetration testing in 2026.
What is a black box test?
The tester starts from zero: they know a domain name and nothing else. They enumerate, guess, try, and behave like someone with no access. This is the only approach that measures what an external attacker actually sees, including what a site exposes unintentionally (a forgotten interface, a backup file, a readable server version).
Its weakness lies in time. A mission lasts a few days, a patient attacker works for weeks. What is not found during the mission is therefore not absent, only not found within the time limit. A black-box report reads as a floor, never as a ceiling.
This approach is the right one when the question is "what is visible from the outside, and what is enough to get in." It is wrong when the question is "is our code correct," because it does not answer that at all.
What is a gray box test?
The tester receives an account, sometimes part of the documentation, as a contractor, a new employee or an intern. They test what a legitimate user can do beyond what they should, which is the area where most real incidents occur: a permission poorly checked on the server side, an identifier that can be guessed, an administrative function accessible by changing a parameter.
The gray box is more productive per hour than the black box, because reconnaissance has already been done. It is also more representative of the insider threat and the third-party threat, which are the two most frequent entry paths after direct exploitation of a published vulnerability.
It assumes one condition: that the given account is representative. A test account created for the engagement, with special privileges, no longer measures anything. The report must state exactly what privileges the tester had, otherwise it is not reproducible.
What is a white-box test?
The tester reads the code, the configuration and the architecture. They see what no one sees from the outside: access controls written only on the client side, a key left in a repository, a processing path that accepts unvalidated input. This is the approach that finds the most defects per hour, and the one whose findings are the easiest to fix, because they point to a line.
Its risk is the mirror image of its strength: by dint of reading the code, one forgets to check whether the flaw is reachable from the Internet. A white-box report that lists twenty flaws unreachable in practice describes imperfect code and zero exposure. The sentence that must appear in every finding is the one that says how one gets there from the outside.
In what order should they be chained?
The order that gives the best result for a given budget comes in three stages. First a short black box, to establish what is visible and what is enough to get in. Then a grey box on the sensitive applications, with real accounts and their exact rights. Finally a white box on the areas where the grey box found something, to understand the cause and fix it at the root.
The reverse order is defensible when the code is already known and the question concerns a redesign: you start from the code, then verify from the outside that the fixes hold. What is not defensible is ordering all three at the same time on the same scope, without saying what each one is supposed to prove.
A useful reference point before ordering: what the site already shows about itself. Our catalogue of vulnerabilities
Which approach should you choose depending on your role?
A small business that sells online mainly needs a black box on its website and a grey box on its customer portal, because that is where its customer data is. A company with several sites and an internal IT department benefits from starting with the grey box, since its real incidents more often come from a misconfigured permission than from an exotic vulnerability. A software vendor needs the white box, because its customers will hold it accountable for its code.
One last case, common among freelancers and very small organizations: the site runs on off-the-shelf software. What matters then is not testing, it is updating. Our guide to checking a website's version
In all cases, the written scope takes precedence over the approach. A black-box test on a vague scope produces an unusable report, whereas a grey-box test on a precise scope produces actionable findings. Public frameworks say the same thing: the PTES
What should the report contain, regardless of the approach?
Three things, without which the document is useless. The proof of each finding: the request, the response, and what that makes it possible to obtain. The version boundary or the line of code concerned. And the gap between what was expected and what was obtained, written in plain language, without a technical identifier alone.
The report serves three readers who do not read the same page: the executive wants the impact and the order of remediation, the technician wants the reproduction, the insurer or auditor wants the date, the scope and the method. A report written for only one of these three readers will be reread, disputed, or filed away.
FAQ
Is the black box more expensive than the white box?
For the same scope, yes, because reconnaissance takes time and no shortcuts are given. But the cost per default found is often lower in white box, which finds more of them. The right criterion is not the price of the test, it is the price of the defect that is not found.
Can a penetration test be done without a test account?
Yes, that is the black box. As soon as you want to test permissions and internal paths, you need an account, with real and documented permissions. A tester working with an administrator account is not testing the gray box, they are testing the white box with convenient access.
Should you notify your hosting provider before a test?
Yes, and it is not a formality. A hosting provider or firewall that sees a scan may cut off access or raise an alert, and a test interrupted midway proves nothing. The scoping must name the source addresses, the intervention window and the contact person on both sides.
Is a gray-box test cheaper because it is shorter?
It often lasts less time, but it requires more preparation: creating accounts, defining permissions, access to a representative environment. The quote must state which of the two costs accounts for the difference, otherwise the comparison between two providers means nothing.
