Skip to content

Black Box vs White Box vs Gray Box Penetration Testing

What black box, white box, and gray box penetration testing mean, what each finds, misses, and costs, and how to choose the right method.

Wahid IqbalBy , Head of ComplianceUpdated 7 min read

Web Application Penetration TestingFrom $5,200Fixed scope, free retest, no hourly billing.

Get my fixed price

Every penetration test has to answer one question before it starts: how much does the tester get to know? In a black box test the tester starts with no inside information. In a white box test, also called crystal box, the tester gets full access: credentials, documentation and often source code. In a gray box test the tester gets partial knowledge, usually a standard user account. That single decision, the “box”, shapes what the engagement finds, how long it takes, and what it costs. Here is what black box, white box, and gray box (also spelled grey box) penetration testing actually mean in practice, and how to pick.

Black box penetration testing

In a black box penetration test, the tester starts with what an outside attacker has: essentially nothing. No credentials, no architecture diagrams, no source code, often just a company name or an IP range. The tester has to discover the attack surface the same way a real adversary would: reconnaissance, enumeration, and probing.

What it’s good at. Realism. A black box test answers the question “what could an opportunistic attacker actually do to us from the internet?” It exercises your external visibility: what’s exposed, what’s discoverable, what’s misconfigured in plain sight. It also tests your detection: a black box tester generating recon noise should light up a well-tuned monitoring stack.

What it misses. Depth per dollar. Because the tester spends a large share of the engagement on discovery, less time goes to actually exploiting what’s found. Authenticated attack surface, everything behind a login, is mostly out of reach. A vulnerability that takes insider knowledge to find stays hidden, even though a patient real-world attacker (or a malicious insider) would eventually reach it.

When to choose it. First-ever assessments of your perimeter, testing detection and response, red-team-style objectives, and board-level “how exposed are we, really?” questions. It is the usual starting point for external network penetration testing.

White box penetration testing

In a white box penetration test (also called crystal box or clear box), the tester gets everything: credentials at multiple privilege levels, architecture documentation, and often source code. Nothing is hidden.

What it’s good at. Coverage and depth. With discovery time near zero, the entire engagement goes into finding and validating vulnerabilities. Business logic flaws, authorization gaps between user roles, subtle injection points several layers deep, insecure defaults in the deployment: the classes of bugs that cause real breaches are far more reliably found white box. If the test exists to make the application safer (rather than to simulate an adversary), white box finds the most issues per day of testing.

What it misses. The attacker’s-eye view. A white box test won’t tell you how discoverable your weaknesses are, and it doesn’t test your monitoring. It can also surface findings a real attacker would be unlikely to reach, which need honest severity ratings so they don’t distort remediation priorities.

When to choose it. Pre-launch web application penetration testing, critical systems where a miss is unacceptable, compliance tests of a business-critical application (most compliance tests run gray box), and secure development programs pairing testing with source code review.

Crystal box, clear box and glass box

Crystal box penetration testing is another name for white box testing. Like clear box and glass box, the name says the tester can see inside the system: its code, configuration and architecture. There is no difference in method or deliverable, so a quote for a crystal box test and a quote for a white box test should describe the same work. NIST SP 800-115 says of application testing that white box techniques “tend to be more efficient and cost-effective for finding security defects in custom applications than black box techniques,” and calls the combination of the two gray box testing.

Gray box penetration testing

Gray box penetration testing (spelled grey box penetration testing in British usage; the two are identical) sits deliberately in between: the tester gets partial knowledge, typically a standard user account and a scope briefing, but not source code or admin credentials. It models the most common real-world threat: an attacker who has phished one employee’s credentials, or a malicious customer with a legitimate account.

What it’s good at. The best cost-to-coverage ratio for most organizations. Authentication and authorization flaws, can user A read user B’s data, can a basic account reach admin functions, are exactly the bugs that cause most real application breaches, and gray box testing targets them directly while retaining a realistic attacker perspective.

What it misses. The extremes. It has less discovery realism than black box and less total coverage than white box. For most engagements, that’s an acceptable trade, which is why gray box is the default method for the majority of professional penetration tests, including most of ours (see our penetration testing methodology).

Side-by-side comparison

Black box Gray box White box
Tester knowledge None Partial (user accounts, scope) Full (credentials, docs, code)
What you provide A company name or IP range One or two standard user accounts and a scope briefing Accounts at several privilege levels, documentation, often source code
Realism Highest High Lower
Coverage per day Lowest High Highest
Finds authenticated flaws Rarely Yes, its specialty Yes, most thoroughly
Tests your detection Yes Partially No
Typical use Perimeter, red team Most application, network and compliance tests Critical apps, pre-launch

How the choice affects cost

Method changes where time goes, not just how much of it there is. A black box engagement spends budget on discovery; a white box engagement spends it on depth. For a fixed budget, expect a white or gray box test to produce meaningfully more findings, which is why “we want the most security value per dollar” almost always points to gray box, while “we want to know what an attacker sees” points to black box. Our pricing is fixed-scope either way, so the method conversation is about goals, not billable hours.

For reference, our published starting prices are $4,200 for an external network test, the usual black box scope, and $5,200 for a web application test, which we normally run gray box. A source code review, the usual companion to a white box test, starts at $4,800. On effort, the PCI Security Standards Council’s guidance notes that a black-box assessment “may require more time, money, and resources” to reach the same result.

Which method do PCI DSS and SOC 2 expect?

Neither makes one box mandatory. The PCI Security Standards Council’s Penetration Testing Guidance, written for an earlier version of the standard, says PCI DSS penetration tests “are typically performed as either white-box or grey-box assessments” because they “yield more accurate results” than a pure black-box assessment. SOC 2 does not prescribe a testing method. Gray box is the practical choice there, because it tests the access controls between roles and tenants that a black box test rarely reaches.

How to choose in one minute

  1. “What can an outsider do to us?” → Black box, external scope.
  2. “Is this application safe for our customers?” or “We need a test for an audit.” → Gray box (or white box if it’s business-critical).
  3. “We need maximum coverage before launch.” → White box.
  4. “Would we notice an attack in progress?” → Black box with a detection objective, or a full red team engagement.

The box is one line in a scoping conversation. Our guide on how to scope your first penetration test covers the rest.

Most real programs mix methods over time: gray box application testing annually, black box external testing to keep the perimeter honest, white box for the crown jewels. The method should follow the question you need answered, not the other way around. Where the tester starts is a separate decision from what the tester knows, covered in external vs internal penetration testing.

Frequently asked questions

What is crystal box penetration testing? Another name for white box penetration testing: the tester is given full knowledge of the target, including credentials, documentation and often source code. Clear box and glass box mean the same thing.

Is gray box or grey box the correct spelling? Both. Gray is the American spelling and grey the British one. The method is identical.

Which is cheaper: black box or white box penetration testing? For the same scope, neither is automatically cheaper. Black box spends more of the time on discovery, so reaching the same coverage usually takes longer. White box puts the time into depth but needs more preparation from you.

Which testing method do SOC 2 auditors expect? SOC 2 does not prescribe one. Gray box is the practical choice, because it tests the access controls between roles and tenants.

Not sure which fits your situation? Scope your assessment and we’ll recommend the right method with a fixed-scope proposal, or read our overview of the types of penetration testing first.

Wahid Iqbal

Written by

Wahid Iqbal, Head of Compliance

20+ years in the field. Focus: PCI DSS, ISO 27001 & ISO 22301. Part of the team that scopes, tests, and reports for our clients. Full profile →

Find out what an attacker sees.

Tell us what to test and see your fixed price.

Prefer the full scoping questionnaire? 
Start the conversation

Get a quick proposal

We are online