Black Box, Grey Box and White Box Testing
Black box, grey box and white box describe how much the tester knows before a penetration test: nothing, partial access, or full documentation and code. When each fits.
Updated This page as Markdown
In short
Black box, grey box and white box describe the information a penetration tester starts with. Black box: no knowledge beyond a target name, like an outside attacker. Grey box: accounts, architecture overview and documentation, the usual default. White box: source code, firmware, schematics and diagnostic databases, which gives the deepest coverage per day. The choice sets scope, duration and what kind of findings you can expect.
What are black box, grey box and white box testing?
The three terms describe the information base of a security test. In a black box test the tester knows only what an outside attacker would: a URL, an IP range, a device in a box. In a white box test the tester has everything the engineering team has: source code, firmware, architecture documents, schematics, credentials for every role. Grey box sits in between and is the most common form: user accounts, an architecture overview, API documentation and a contact for questions, but no code.
The terms come from software testing, where white box means testing with knowledge of the internal structure and black box means testing against the external behaviour only. In penetration testing they describe scope and starting conditions, not technique: the same tester uses the same tools and reaches the same depth of exploitation, just from a different starting point.
Where is it defined?
There is no single normative definition. The BSI study on penetration testing classifies tests along several criteria, the information base among them, and distinguishes black box from white box tests. NIST SP 800-115 uses the related distinction between overt testing, done with the knowledge and cooperation of the IT staff, and covert testing, done without their knowledge, and between external and internal viewpoints. The OWASP Web Security Testing Guide describes black box and grey box testing of web applications and argues for giving testers as much information as possible. The Penetration Testing Execution Standard treats the question in its pre-engagement phase, where the information provided is agreed together with scope and rules of engagement.
What it means in practice
Our default recommendation is grey box, moving towards white box wherever the material exists. The reason is efficiency: a pentest is bought by the day, and every day spent reverse engineering an undocumented protocol that the client could have documented in an afternoon is a day not spent finding vulnerabilities.
For embedded and automotive targets the difference is largest. On a power-electronics ECU with firmware images and a diagnostic database we can enumerate every UDS service, data identifier and routine on the first day and spend the rest on the SecurityAccess implementation and the parsers behind it. Without them, the first week goes into extracting and reverse engineering the firmware, which is interesting but tells the client less per euro. Black box has its place. A short black box phase at the start of an engagement shows what an attacker finds without help and tests how visible the product’s attack surface is. A full black box test is the right choice when the question is specifically about exposure, for example an external perimeter test, or when the client cannot share internals for contractual reasons.
The information base also changes the report. A black box report says what was reachable in ten days from outside. A white box report can say that a vulnerability class is absent from the code, which is the statement a product owner needs before a release or a compliance audit.
Common misunderstandings
Black box is not more realistic. Real attackers have unlimited time, buy devices, download firmware updates and read patents; a ten-day black box test simulates none of that. White box is not a code review: the tester still attacks the running system and proves exploitability, the code merely tells them where to look. And grey box is not a compromise for undecided clients. It is the form most tests should take.
FAQ
Frequently asked questions
Which approach finds the most vulnerabilities?
White box, by a wide margin, for the same budget. With source code, firmware or schematics the tester spends the days on analysis instead of on guessing. Black box answers a different question: what an outsider without insider knowledge can do in a fixed time. Both are legitimate, but they should not be compared by finding count.
Is white box testing realistic? Attackers do not have the code.
Attackers have time, and many have the firmware: it is in the update package or on the flash chip of a device bought online. A white box test compresses months of attacker effort into two weeks. The result is a statement about the product, not about one attacker on one day.
What do you recommend for an ECU or IoT device?
Grey box with white box elements: hardware samples, firmware images, interface documentation, diagnostic databases (ODX or CDD) and a contact for engineering questions. Keep a short black box phase at the start to see what an attacker finds without help, then open up.
Sources
Related pages
- ComparisonsBlack Box vs White Box Penetration Test: How Much Should the Tester Know?A black box test starts with no information, a white box test with code, documentation and accounts. What each finds and costs, and why grey box usually wins.
- GlossaryPenetration testA penetration test is an authorised, mostly manual attack on a system to find and prove exploitable vulnerabilities. Definition, types, process and the report.
- InsightsPentest Scoping Checklist: What to Clarify Before the TestA checklist for scoping a penetration test: targets, environments, accounts, test depth, exclusions, time window, legal authorisation, deliverables and retest.
- InsightsHow Long Does a Penetration Test Take? Durations by TargetTesting days by target, from 3 for an API to 30 for an ECU, plus the calendar time for scoping, report and retest, and what makes a pentest longer or shorter.
- ServicesWe break in. You get the proof and the fix.Hands-on penetration testing by OSCP-certified engineers: IoT devices, ECUs, industrial systems, web, cloud and networks. Fixed-price offer after a 15-min call.
- ServicesWhat a penetration test costs, in real numbers.What does a penetration test cost? Typical price ranges for web, API, mobile, cloud, network, IoT, hardware and automotive pentests, and what drives the price.
