Skip to content

Black box vs white box penetration testing: which to choose

Black box, grey box and white box penetration testing compared. What each one means, what NIST and OWASP say, the trade-offs, and how to pick the right approach for your app.

Axrok Team9 min read

When you ask for a penetration test quote, a tester will soon ask how much you want to share. Do you want them to start with nothing but a URL, with a couple of user accounts, or with the source code and architecture diagrams? Those three answers line up with the labels black box, grey box and white box testing. This post explains what each one means, where the terms come from, and how to choose without overpaying for realism you do not need or underpaying for coverage you do.

Key takeaways

  • The labels describe how much the tester knows about the target before they start. They are not three different products with different quality.
  • Black box means no inside knowledge. Grey box means some, usually user accounts and basic documentation. White box means substantial knowledge, often including source code.
  • More knowledge usually means more coverage for the same testing time. Less knowledge gives a more realistic outside view, but spends time on discovery.
  • Most web application and API tests for SaaS products are best run grey box. Black box and white box each have a clear place.
  • "Black box" is not the same as "covert". Whether your IT team knows about the test is a separate decision.

What the three terms mean

The clearest definitions come from NIST, which uses them in its glossary with references to NIST SP 800-53A Rev. 5.

  • Black box testing. NIST defines black box testing as a test methodology that assumes no knowledge of the internal structure and implementation detail of the assessment object. In NIST's assessment language it is also called basic testing.
  • Grey box testing. Gray box testing assumes some knowledge of the internal structure and implementation detail. NIST also calls it focused testing.
  • White box testing. White box testing assumes explicit and substantial knowledge of the internal structure and implementation detail. NIST calls it comprehensive testing, and lists other names such as clear box and glass box testing.

In practice, the difference is what you hand over at kickoff.

Approach What the tester usually gets What it is good at
Black box Target names or IP ranges, nothing else Showing what an outsider can find and reach
Grey box Test accounts for each role, API documentation, a short walkthrough Finding access control and business logic flaws in the authenticated app
White box Source code, architecture and configuration details, developer access to ask questions Deep coverage of code paths that are hard to reach from outside

Black box testing: the outside view

In a black box test the tester sees roughly what an attacker on the internet sees. They map your domains and exposed services, find login pages and APIs, and try to get in.

The benefit is realism about your external footprint: forgotten subdomains, an old admin panel, or an open staging server. Our post on domain hijacking prevention covers one class of issue that often turns up this way.

The cost is time. The tester has to discover what you could have told them in five minutes. On a fixed-length engagement, every hour spent on discovery is an hour not spent testing the logic of your application. And if the tester never gets past the login page, large parts of the product are never examined at all.

The OWASP Web Security Testing Guide makes this point directly. Its introduction notes that while black-box penetration test results can be impressive and useful for showing how vulnerabilities are exposed in production, they are not the most effective or efficient way to secure an application. It is difficult for dynamic testing to cover the whole code base, and vulnerabilities can sit in the source that a black-box engagement would miss.

Black box testing makes the most sense when you want an outsider's view of your internet-facing estate, when you are unsure what is exposed, or as an outside check alongside regular grey or white box testing.

Grey box testing: the common middle ground

In a grey box test the tester gets some of what a real user or partner would have. For a SaaS product that usually means one account for each role (for example, a normal user, an admin, and a user in a second tenant) plus API documentation such as an OpenAPI file.

This is where many of the most serious web application bugs are found. Broken access control sits at the top of the OWASP Top 10:2025, and you cannot properly test whether user A can read user B's data unless the tester has both accounts. The same goes for tenant isolation, role changes, and multi-step workflows like checkout or approval flows.

It also matches a realistic threat: someone who already has an account, through a free trial or a stolen login.

The OWASP guide notes that in many penetration tests the tester is given one or more valid accounts on the system.

For most web apps and APIs, grey box gives the best coverage for the time you buy. Our API penetration testing guide for SaaS explains why role and object level testing matters so much for APIs.

White box testing: the deepest coverage

In a white box test the tester has substantial inside knowledge. That can mean read access to the repository, infrastructure as code, architecture diagrams, and a developer who can answer questions.

The OWASP guide is clear about why this helps. It says that with the source code a tester can accurately determine what is happening and remove the guesswork of black-box testing. It lists issues that are particularly suited to source code review, including concurrency problems, flawed business logic, access control problems and cryptographic weaknesses.

The trade-offs are practical rather than technical:

  • You need to be comfortable sharing code, which may need legal or customer sign-off
  • The tester needs the skills to read your language and framework
  • The report reflects the code that was reviewed, and OWASP points out that the code actually deployed may differ from the code analysed

White box testing is worth considering when the application handles payments, health data or other high-impact data, when authorization rules are complex, or when earlier testing points to deeper design problems.

Do not confuse knowledge with secrecy

There is a second, separate question: does your own team know the test is happening?

NIST SP 800-115, the Technical Guide to Information Security Testing and Assessment, calls these overt and covert testing. Overt testing happens with the knowledge and consent of the IT staff. Covert testing happens without the IT staff knowing, but with the full knowledge and permission of upper management. NIST notes that covert testing focuses on the damage an adversary could cause and on how staff respond, rather than on finding every vulnerability, and that it is more time-consuming and costly. Overt testing, it says, is less expensive, carries less risk and is used more often.

So you can have a black box test that is overt (your team knows, but the tester gets no inside information) or a grey box test that is covert (the tester has accounts, but your security team has not been told). Decide each question on its own merits. For most companies buying their first or second test, overt is the right choice.

The UK NCSC's penetration testing guidance agrees: how much knowledge testers get beforehand and how much system administrators know about the test can both vary within the same test regime.

How to choose

Ask three questions.

  1. What are you trying to learn? If the question is "what can someone on the internet find and break into?", start with black box on your external footprint. If it is "can a customer see another customer's data?", you need grey box at least.
  2. What is the test for? For a SOC 2 or ISO 27001 audit, auditors and customers mostly care that the scope was sensible and the findings were handled. A grey box test of the in-scope application usually serves that well. See our guides on SOC 2 penetration testing requirements and what to put in scope.
  3. How much time are you buying? On a short engagement, giving the tester accounts and documentation stops them burning days on discovery. If you are paying for testing hours, more information usually means more findings for the same budget.

A common pattern that works well:

  • Grey box testing of the main web application and API as the core of the engagement
  • A short black box pass on your external attack surface to catch anything you forgot
  • White box review of the most sensitive parts, such as authentication or payment logic, when the risk justifies it

Whatever you choose, write it into the scope document so the report states what the tester knew. Our checklist on how to prepare for a penetration test covers what to hand over for each approach.

FAQ

What is the difference between black box and white box penetration testing?

Black box testing gives the tester no inside knowledge of the system. White box testing gives them substantial inside knowledge, often including source code and architecture details. NIST defines them by how much knowledge of internal structure and implementation detail the tester is assumed to have.

Is black box testing more realistic?

It is more realistic about an outside attacker with no account. It is less realistic about attackers who already have a login, such as a malicious customer or someone using a stolen account. Many serious SaaS bugs need a valid account to find.

Which approach is best for a SaaS web application?

For most SaaS apps, grey box is the best starting point. Accounts for each role let the tester check access control and tenant isolation, which the OWASP Top 10:2025 lists as the top risk category.

Do we have to share our source code?

No. White box testing is optional. A grey box test can still be thorough. Share code when the application is high risk or when previous testing points to deeper problems, and only after any legal or customer approvals you need.

Is a black box test the same as a covert or red team test?

No. Black box describes what the tester knows. Covert, in NIST SP 800-115 terms, describes whether your IT staff know the test is happening. The two are separate choices.

Talk it through

If you are planning a test and are not sure how much to share with the testers, we are happy to talk it through. Book a free 15-minute call through our contact page or email zayan@axrok.com, and we can help you work out whether a black, grey or white box penetration test fits what you need to learn.

Sources

  • Penetration testing
  • Security strategy
  • Scoping

Want this looked at in your environment?

Book a free 15-minute call. A founder reads every enquiry and replies personally.