On this page
Black box, white box and grey box describe how much the testers know before they start. In a black-box test they get almost nothing beyond a target name, so they work like an outside attacker. In a white-box test they get full access: source code, architecture documents, credentials for every role and time with your engineers. A grey-box test sits in between, typically user accounts and some documentation. More knowledge means deeper coverage in the same number of days; less knowledge means a more realistic picture of what a stranger could find. For most applications, grey box gives you the best balance.
This guide defines each approach, compares them side by side, walks through the trade-offs and gives you a practical way to choose.
Why the amount of knowledge matters
Every penetration test is time-boxed. You are paying for a fixed number of tester days, and the question is how those days are spent.
Knowledge changes that split. Without information, testers spend a large share of the engagement on discovery: finding hosts, guessing endpoints, registering accounts and working out what the application does. With information, they skip straight to the parts that hurt: authorization between tenants, payment logic, admin functions, the cryptography in your token handling.
Neither is “better” in the abstract. Discovery is part of what real attackers do, so a test that skips it can miss what is exposed by accident. But a test that spends most of its time on discovery may never reach the code paths where your worst bugs live.
What is black-box penetration testing?
In a black-box test, the testers receive only what an external attacker would have: usually a domain, an application URL or an IP range, plus the rules of engagement. No accounts, no documentation, no source code.
A typical black-box engagement looks like this:
- Reconnaissance. Map domains, subdomains, live hosts, exposed services and technologies. Our subdomain enumeration guide covers how this is done.
- Unauthenticated testing. Probe login, registration, password reset and any public API endpoints. Look for exposed admin panels, debug endpoints, old versions and leaked files.
- Self-registration, if allowed. Where the application lets anyone sign up, testers create their own accounts and continue as a normal user would.
- Exploitation. Confirm and chain what they find, with proof of concept.
What it is good at: showing what is visible and exploitable from the outside. It finds forgotten subdomains, exposed services, misconfigured storage, information leaks and weaknesses in the unauthenticated surface.
Where it falls short: coverage of anything behind a login is limited, and so is coverage of roles the testers cannot create for themselves. If your application is invitation-only or B2B, a black-box test may never get past the login page.
See how we run it on our black-box penetration testing page.
What is white-box penetration testing?
In a white-box test, testers get as much information as you can share:
- Source code, or read access to the repositories.
- Architecture and data-flow diagrams.
- API specifications (OpenAPI, GraphQL schemas, Postman collections).
- Accounts for every role, including administrators.
- Infrastructure and deployment details, such as cloud configuration or container definitions.
- Access to developers for questions.
Testers combine manual code review with dynamic testing. They read the authorization middleware and then try to break it in the running application. They find the one endpoint that skips the tenant check, the hard-coded secret in a config file, the unsafe deserialization in a background job.
What it is good at: depth and completeness. White-box testing is the most efficient way to find flaws in authorization, business logic, cryptography and input handling, including in code paths that are hard to reach from outside. It also gives your developers precise fixes, because findings point at specific lines.
Where it falls short: it tells you less about real-world discoverability. It needs more preparation from your side, and a large codebase needs more days to review properly. It also does not replace reconnaissance: a white-box review of one application will not tell you about the staging server someone left online.
Learn more about our white-box penetration testing approach.
What is grey-box penetration testing?
Grey-box testing gives the testers partial knowledge. A common package is:
- One or two accounts for each user role.
- API documentation or a Postman collection.
- A short walkthrough of the application and its most important flows.
- Basic architecture notes, such as which services sit behind the API gateway.
This mirrors a very realistic threat: a malicious customer, a compromised user account or an insider with ordinary access. It also lets testers cover authenticated functionality systematically without having to discover it first.
What it is good at: the best coverage-to-cost ratio for most web applications, APIs and mobile apps. Testers can test horizontal and vertical access control properly (can user A read user B’s invoice, can a viewer call an admin endpoint), because they have accounts in each role.
Where it falls short: it can miss issues that only source code reveals, and the external discovery phase is usually lighter than in a dedicated black-box test.
Read more on our grey-box penetration testing page.
Black box vs white box vs grey box: side-by-side comparison
| Aspect | Black box | Grey box | White box |
|---|---|---|---|
| Information given | Target name and scope only | Accounts, docs, some architecture | Source code, full docs, all roles |
| Simulates | External attacker | Malicious user or compromised account | Insider or attacker with leaked code |
| Time spent on discovery | High | Moderate | Low |
| Depth behind authentication | Limited | Good | Very good |
| Finds business logic flaws | Sometimes | Yes | Yes, most thoroughly |
| Finds code-level issues (secrets, crypto, unsafe libraries) | Rarely | Sometimes | Yes |
| Shows real-world exposure | Best | Good | Limited |
| Preparation needed from you | Minimal | Moderate | Significant |
| Typical fit | Perimeter, public apps, red-team style checks | Most web apps, APIs and mobile apps | High-risk systems, fintech, auth and crypto code |
The trade-offs in more detail
Realism vs coverage
Black box is the most realistic simulation of an outsider, but realism is not the same as safety. Real attackers have unlimited time. Your testers have a fixed number of days. If they spend most of them guessing, you get a realistic test of a very patient attacker’s first week, not a thorough test of your application.
Grey and white box trade some realism for coverage. That is usually the right trade, because the goal of most tests is to find and fix as many serious weaknesses as possible, not to measure how long discovery takes.
Cost per finding
For the same budget, more knowledge usually produces more validated, high-impact findings. Testers do not waste time on dead ends, and they can focus on the code paths you know are sensitive. White-box tests can take longer in total, especially for large codebases, but the time goes into analysis rather than discovery.
Effort on your side
Black box needs little more than a scope and an authorization letter. Grey box needs accounts in each role, test data and a stable environment. White box needs repository access, documentation and an engineer who can answer questions. Plan for that preparation before the start date, or testers will lose days waiting.
Risk of false confidence
A clean black-box report does not mean the authenticated application is secure. It means testers could not get in from outside in the time available. Make sure anyone reading the report, including customers and auditors, understands which approach was used. A good report states it clearly in the scope section; our guide to writing a penetration test report covers what that section should include.
How to choose the right approach
Start with the question you need answered, then work back to the approach.
| Your question | Approach to consider |
|---|---|
| What can someone on the internet find and break? | Black box, with strong recon |
| Can one customer reach another customer’s data? | Grey box, with accounts in several tenants |
| Is our authentication, authorization or crypto code sound? | White box |
| We need third-party evidence for a customer or auditor | Usually grey box, unless they specify otherwise |
| We just shipped a major new feature | Grey box focused on that feature, or white box for high-risk code |
| We have no idea what is exposed | Start with attack surface discovery, then black box |
A few rules of thumb:
- Default to grey box for web applications, APIs and mobile apps. It covers the most likely real threat (an authenticated user abusing access) at a sensible cost.
- Add white box for the code that would hurt most if it failed: authentication, payments, multi-tenant isolation, encryption and anything regulated.
- Use black box for internet-facing infrastructure and as a periodic check on what your organization exposes by accident.
- Do not choose black box just to save preparation time. If your application is mostly behind a login, you will pay for days that never reach it.
Combining approaches
The approaches are not mutually exclusive. A common, effective pattern is:
- A black-box phase at the start to map and test the external attack surface.
- A grey-box phase for authenticated testing of each role.
- Targeted white-box review of the most sensitive components.
This gives you the outside-in view and the depth in one engagement, with one report and one retest cycle.
Questions to settle before the test starts
Whichever approach you choose, agree these points in writing:
- Scope: exact URLs, API base paths, IP ranges and mobile app builds, plus anything explicitly out of scope.
- Environment: production or staging, and whether staging matches production closely enough to trust the results.
- Accounts and data: how many roles, how many accounts per role and whether testers may create or delete data.
- Testing windows and contacts: when testing may run and who to call if something breaks.
- Critical findings: how and when they are reported. They should reach you immediately, not wait for the final report.
- Retest: how fixes will be verified once your team has deployed them.
How WhyXpose runs black-, grey- and white-box tests
Whichever approach you choose, AI-guided recon and AI triage speed up discovery and filter out noise, and WhyXpose testers then carry out manual, hacker-style testing aligned with OWASP, SANS and CREST methodologies, using whichever level of knowledge fits your goal. Each finding is delivered through the WhyXpose platform with a severity, a CVSS 3.1 vector (see our CVSS 3.1 scoring guide), proof of concept and remediation guidance, and your developers can discuss fixes and request retests in the comment thread on each finding.
Compare the options on our penetration testing services page, or contact us to talk through which approach suits your scope.
Put this guide into practice
Black-box, grey-box or white-box: tell us what you ship and we will recommend the approach that fits your goal.
Compare services and approaches