Join our Newsletter — 33% off our NHI Course
Home› Guides› Black Box vs Grey Box vs White Box…
Guide Offensive Security & Testing

Black Box vs Grey Box vs White Box Testing: Which Pentest Knowledge Level to Buy

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 15 min read
On this page

The amount of information you give a penetration tester decides what the test can find, and most buyers make that choice by habit rather than by the question they need answered. Black box, grey box and white box are not quality grades: each emulates a different attacker, spends tester-days differently and misses different classes of finding. Choosing the wrong one wastes budget on reconnaissance you could have handed over, or produces a clean report that only proves an outsider could not get in during a short window. This guide is for security managers, application owners and procurement leads who scope and buy testing. It compares the three knowledge levels option by option, explains when realism matters more than coverage, and sets out how to run credentialed testing and test accounts safely. For what a penetration test is and how it runs, start with the Penetration Testing for Beginners page.

Key takeaways

  • Knowledge level is a scoping decision, not a methodology. Any test type (external, internal, web, API, cloud) can be run black, grey or white box; the choice changes what the tester-days are spent on.
  • Black box buys realism, not coverage. NCSC and PCI SSC guidance both note that withholding information can leave vulnerabilities undiscovered in the time allowed and may cost more to reach the same assurance.
  • Grey box is the sensible default for most applications. Role-based test accounts and documentation let the tester spend time on authorisation, business logic and privilege escalation, where serious findings usually sit.
  • White box gives the most assurance per day. Source code, configuration and architecture access find flaws a black box test cannot see, and suit pre-release and high-value systems.
  • Test accounts are identities with risk. Issue dedicated, role-matched, time-bound accounts, log their use and disable them when the test ends.

What the three knowledge levels mean

The terms describe how much the tester knows about the target's internals at the start. PCI SSC's Penetration Testing Guidance defines black-box testing as testing performed without prior knowledge of the internal structure, design or implementation of the object being tested, white-box testing as testing with that knowledge, and grey-box testing as testing with partial knowledge. NCSC uses the terms transparent (open) box, where full information is shared, and opaque (closed) box, where no information about the internals is shared, and notes that either can be applied to each type of test.

These labels are separate from two other choices that buyers often mix up with them:

  • Starting position: external (from the internet) or internal (from inside the network or from a user session). NIST SP 800-115 describes internal testers being given user-level access and the information similar users would have, sometimes extended to administrator privileges. See Internal vs External Penetration Testing.
  • Who knows the test is happening: NIST SP 800-115 distinguishes overt testing, with IT staff aware and able to limit impact, from covert testing, where only senior management knows. A covert exercise is closer to a red team engagement than to a knowledge-level choice.

Keeping the three dimensions apart avoids the common confusion of "black box" being used to mean "external, unannounced and unauthenticated" all at once.

Option by option comparison

FactorBlack boxGrey boxWhite box
Attacker model emulatedOutsider with no inside knowledge and no accountCustomer, employee, partner or attacker holding a stolen user credentialWell-resourced insider or attacker with leaked code and documentation, plus defender's own view
Information sharedTarget name, IP ranges or URL, rules of engagementRole-based accounts, API documentation, network or data flow diagrams, prior reportsSource code, infrastructure as code, configuration exports, architecture and threat model, access to engineers
CredentialsNoneOne or more accounts per role, often including a low-privilege and a tenant-boundary pairAll roles, plus read access to cloud consoles or configuration where in scope
Where tester-days goReconnaissance, discovery and guessing at structureAuthenticated functionality, access control, business logic, privilege escalationTargeted verification of code paths, configuration and design weaknesses
Coverage per tester-dayLowest: much effort goes on mapping what the client already knowsMedium to highHighest
Findings typically missedAnything behind authentication, unlinked endpoints, logic flaws, insecure code paths not reachable from outsideCode-level flaws with no visible symptom, unused but deployed features, hard-coded secretsReal-world detection and response gaps, social and physical routes (out of scope by design)
Relative cost to reach a given assuranceHighest, because days are spent on discoveryModerateLower per finding, but needs reviewer skill and preparation time
Best evidence forWhether the external attack surface is exposedWhether a compromised or malicious user can go further than intendedWhether the system is built securely before or after major change

PCI SSC states that PCI DSS penetration tests are typically performed as white-box or grey-box assessments because they give more accurate results and a more thorough view of posture than pure black box, which may need more time, money and resources to meet the requirements. NCSC makes the same trade-off in neutral terms: opaque box testing models an outside attacker more accurately, but the lack of information can leave vulnerabilities undiscovered in the time allocated.

Black box in depth

A black box test answers one question well: can an unknown outsider, starting from public information, find and exploit a way in within the test window? It is useful for an internet-facing estate you have never tested, for checking that attack surface management has not missed anything, and as evidence for stakeholders who ask "could someone just walk in?".

  • Strength: it finds what you do not know you have, such as forgotten hosts, exposed admin panels and shadow subdomains, because the tester is not anchored to your asset list.
  • Weakness: the clock runs out. If the tester spends half the engagement mapping an application and never gets past the login page, the report shows few findings, and that absence is easily misread as security.
  • Misleading realism: real attackers have unlimited time, phishing kits and leaked credentials. A short black box test is less realistic than it sounds, which is one reason assumed breach testing exists. See the Assumed Breach Testing Guide.

Grey box in depth

Grey box testing hands over what an authenticated user or a well-informed attacker would know. For web applications and APIs, PCI SSC encourages organisations to provide credentials so the tester can assume each application role and check whether a user in one role can escalate privileges or reach data they should not. It also recommends testing roles without authorised access to sensitive data, and in multi-tenant systems providing standard customer accounts so the tester can confirm a tenant can only reach its own data.

What to hand over in a grey box test

  • Accounts: at least two per role so horizontal access (user A reading user B's data) can be tested, plus one account per tenant boundary.
  • Documentation: OpenAPI or other API specifications, network diagrams for in-scope segments and data flow diagrams. PCI SSC lists network diagrams, data flow diagrams, exposed services and ports, and how users access the environment as useful inputs.
  • History: previous test reports and current vulnerability scan results. NCSC advises sharing a current vulnerability assessment with testers at scoping, so time is not spent rediscovering known issues.

Grey box is where most damaging application findings appear: broken object level authorisation, missing function level checks and abuse of legitimate workflows. The API Penetration Testing Guide covers what that testing looks like for APIs.

White box in depth

White box testing gives the tester the same view as the engineering team. OWASP's Web Security Testing Guide (v4.2) lists source code review as thorough, effective and accurate when done by competent reviewers, while noting it can miss issues in compiled libraries and that deployed code may differ from reviewed code. The same guide says a penetration test can only identify a small representative sample of all possible security risks and should not be the primary or only testing technique. A white box engagement combines the two: the tester reads the code and configuration to find likely weaknesses, then proves them against the running system.

  • Use it before release: for new products, major rewrites, authentication and payment flows, and cryptographic components, where assurance matters more than emulating an attacker.
  • Use it for configuration-heavy targets: cloud accounts, Kubernetes clusters and identity platforms, where a configuration review finds more in a day than external probing finds in a week. See the Cloud Penetration Testing Guide.
  • Prepare for it: grant read-only repository access, provide build instructions and nominate an engineer who can answer questions. Without preparation, white box days are lost to environment set-up.
  • Do not confuse it with SAST: automated static analysis is a tool, not a white box test. The Secure Code Review Guide explains how manual review adds context tools lack.

When realism beats coverage, and when assurance does

The choice comes down to the question the test must answer. Realism matters when you are testing people, detection and response; coverage matters when you are testing whether the system itself is built securely.

Question you need answeredRecommended knowledge levelWhy
Could an outsider find a way in from the internet?Black box externalTests discovery as well as exploitation; not anchored to your asset list
Would our SOC detect and stop a real intrusion?Black box or objective-based, covert; usually a red teamDefenders must not be tipped off; see Red Team vs Penetration Test vs Vulnerability Scan
Can a compromised user account reach data or admin functions?Grey box with role accountsPuts tester-days into authorisation and escalation
Is this application safe to release?White boxHighest coverage per day; finds design and code flaws
Are we meeting PCI DSS penetration testing requirements?Grey or white boxPCI SSC guidance notes these are typical and more thorough
Is the cloud or identity platform configured safely?White box configuration review plus grey box testingConfiguration is the attack surface
What would a specific threat actor achieve against us?Intelligence-led, often grey box startSee the Threat-Led Penetration Testing Guide

NIST SP 800-115 captures the same trade-off for covert testing: it is time-consuming and costly because of stealth requirements, often fails to identify many vulnerabilities, and tests what damage an adversary could do rather than finding every weakness. Overt testing is less expensive, carries less risk and is used more often.

Small and large organisations

  • Small organisations with one budget line: a grey box test of the main application and a short black box external test usually gives more value than an expensive black box test of everything.
  • Large organisations with a programme: rotate knowledge levels by purpose: white box at release for critical systems, grey box annually for applications, black box for periodic attack surface checks, and red teaming for detection and response.
  • Regulated firms: map each test to its requirement first using the Penetration Testing Requirements Map, then choose the knowledge level that produces the evidence the regulator expects.

Credentialed scope and test account hygiene

Grey and white box tests create identities that did not exist before: user accounts, API keys, cloud roles and sometimes privileged accounts. NCSC's guidance expects test team requirements, such as test accounts, to be prepared from the scoping output. Those accounts are a real attack surface during and after the test.

  1. Create dedicated accounts: never share a real employee's account or a production service account with testers. Name accounts so they are recognisable in logs, following your naming standard.
  2. Match roles exactly: PCI SSC notes that if new accounts are created for the tester, roles should be configured so the tester can test all intended functionality. Mirror production roles rather than granting admin "to be safe".
  3. Bind accounts to the window: set expiry dates for the test period, restrict source IP addresses where the platform supports it, and require MFA unless MFA itself is out of scope.
  4. Issue secrets safely: send credentials through a secrets manager share or separate channel, never in the statement of work or email thread, and rotate them if they are exposed.
  5. Log and monitor use: tag test accounts in the SIEM so the SOC can separate test activity from real attacks without suppressing alerts entirely.
  6. Close down: disable or delete accounts, revoke API keys and tokens, remove cloud role assignments and confirm test data has been purged on the last day. Record this in the engagement close-out.

Test data and reports carry similar risk: the Penetration Test Data Handling Guide covers retention and transfer.

How to scope and buy the right level

  1. Write the question first: one sentence on what the result must prove, for example "a customer cannot see another customer's orders".
  2. Choose the knowledge level from the question: use the table above, and record the reason in the statement of work.
  3. List what you will hand over: accounts by role, documents, code access, contacts and prior reports, with dates.
  4. Size the effort honestly: ask providers to state how many days they assume for discovery versus testing. A black box quote with the same days as a grey box quote will cover less.
  5. State the limitations you accept: for black box, accept that authenticated functionality may not be reached; for white box, accept that detection is not being tested.
  6. Agree reporting expectations: require a coverage statement showing which roles, endpoints and components were tested and which were not. See How to Read a Penetration Test Report.
  7. Plan retesting: retest fixes at the same knowledge level, using the same accounts if they are recreated, so results are comparable.

Provider selection, accreditation schemes and contract terms are covered in the Penetration Testing Provider Buyer's Guide.

Measuring whether the choice worked

  • Discovery to testing ratio: share of tester-days spent on reconnaissance; a high ratio on a known application suggests grey box would have been better.
  • Coverage achieved: percentage of in-scope roles, endpoints and components the report confirms were tested.
  • Findings by class: proportion of access control, business logic and configuration findings; a black box test of an authenticated application that reports none of these deserves scrutiny.
  • Repeat findings: issues found again at retest or the next annual test, which point to process gaps rather than test choice.
  • Test account close-out: percentage of test identities disabled within one business day of the test ending, target 100 percent.

Common failure patterns

  • Black box by default: buying black box because it "sounds realistic", then reading a short findings list as proof of security when the tester never got past authentication.
  • Withholding to "test the tester": holding back documentation the provider asked for, which turns paid days into rediscovery of what the client already knew.
  • One shared test account: a single account for all roles, so horizontal and vertical access control cannot be tested.
  • Test accounts left active: privileged test accounts and API keys still enabled months later, becoming orphaned identities. See the Penetration Testing Guide on credentials given to testers.
  • White box without preparation: code access granted on day one with no build instructions, so days are lost getting the application running.
  • Mixing up the dimensions: asking for "black box" when the real need was an unannounced detection test, or an external test, and getting neither.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev 5CA-8 Penetration Testing; CA-2 Control AssessmentsPenetration testing as an assessment control; scope and independence
NIST SP 800-53 Rev 5AC-2 Account ManagementCreation, monitoring and removal of tester accounts
NIST SP 800-115Sections 2.4.1 and 2.4.2External and internal testing; overt and covert testing trade-offs
CIS Controls v8.1Control 18 Penetration TestingProgramme of periodic external and internal tests
PCI SSC Penetration Testing GuidanceSections 1.3, 2, 4.1 and 4.2.1Definitions, typical white and grey box use, information sharing and role credentials
ISO/IEC 27001:2022 Annex AA.8.29 Security testing in development and acceptance; A.8.8 Management of technical vulnerabilitiesPre-release white box testing and ongoing vulnerability discovery

Practitioner checklist

  • Write the question each test must answer before choosing black, grey or white box.
  • Keep knowledge level, starting position and announced or covert status as three separate scoping decisions.
  • Default to grey box for authenticated applications and APIs, with at least two accounts per role.
  • Use white box for pre-release, high-value and configuration-heavy systems, and prepare code and environment access in advance.
  • Reserve black box for external attack surface questions, and accept its coverage limits in writing.
  • Share prior reports and current scan results so testers do not rediscover known issues.
  • Issue dedicated, role-matched, expiring test accounts and tag them in monitoring.
  • Require a coverage statement and the discovery versus testing day split in every report.
  • Disable all test identities and revoke keys on the final day, and record it in the close-out.

Standards and references

Related NHI Mgmt Group resources: Penetration Testing Guide · Penetration Testing Provider Buyer's Guide · Red Teaming for Beginners · Penetration Testing Methodologies Compared

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.