26 November 2026

White Box Penetration Testing: A Guide for Engineers

White Box Penetration Testing: A Guide for Engineers
7 min. readBy Borg

The short answer: a white box penetration test is a pentest where the tester has the source code and knows how the application is built. NIST defines it as a test methodology that "assumes explicit and substantial knowledge of the internal structure and implementation detail of the assessment object" (NIST CSRC glossary). The tester reads the code to find where authorisation, business logic, and data handling can go wrong, then proves each issue against the running application. It is the right choice when your biggest risks are access control and logic bugs that are hard to see from outside.

White box, grey box, and black box at a glance

The three terms describe how much the tester knows before they start. NIST's glossary gives a one-line definition for each.

ApproachWhat the tester knowsNIST definition
Black boxNothing about the internals; works from outside like an attacker"A test methodology that assumes no knowledge of the internal structure and implementation detail of the assessment object" (NIST)
Grey boxPartial context, such as accounts, API specs, or some documentation"A test methodology that assumes some knowledge of the internal structure and implementation detail of the assessment object" (NIST)
White boxSource code, architecture, and how the application is meant to work"A test methodology that assumes explicit and substantial knowledge of the internal structure and implementation detail of the assessment object" (NIST)

NIST also uses the names basic, focused, and comprehensive testing for these three depths. Its glossary says comprehensive testing is "also known as white box testing" (NIST). You will also see the term written as whitebox or white-box. They mean the same thing.

Why white box testing finds different bugs

A black box tester has to guess how the application works from what it returns. A white box tester can read the authorisation check, or see that it is missing.

OWASP's Web Security Testing Guide puts it plainly: with the source code, "a tester can accurately determine what is happening (or is supposed to be happening) and remove the guess work of black-box testing" (OWASP WSTG v4.2). The same guide lists the issues "particularly conducive to being found through source code reviews": "concurrency problems, flawed business logic, access control problems, and cryptographic weaknesses".

Access control is where this matters most. In the OWASP Top 10:2025, broken access control holds the top spot, and OWASP reports that "100% of the applications tested were found to have some form of broken access control" (OWASP Top 10:2025, A01). Our own data points the same way: "79% of findings are in auth, APIs, and business logic" (Borg).

White box pentest vs code review vs SAST

These three are often confused. They answer different questions.

  • Static analysis (SAST) scans code for known patterns. OWASP notes that "static source code analysis alone cannot identify issues due to flaws in the design, since it cannot understand the context in which the code is constructed" (OWASP WSTG v4.2).
  • Manual code review reads the code for security issues. OWASP describes it as "the process of manually checking the source code of a web application for security issues" (OWASP WSTG v4.2). It does not, on its own, prove that an issue is exploitable in the deployed app.
  • A white box pentest uses the code to decide what to attack, then attacks the running application to prove what is real. The output is a set of validated vulnerabilities with evidence, not a list of possible weaknesses.

For a deeper look at how code context feeds dynamic testing, see our explainer on code-aware application security testing.

What a white box pentest should cover

For a web application or API, a useful white box pentest goes after the classes that need application context to find. These are the classes we cover in our own whitebox pentests (Borg):

  • Authentication: login bypasses, session weaknesses, and token issues.
  • Authorisation: IDORs, privilege escalation, and broken access control. Our guide to IDOR testing for APIs goes into the method.
  • Injection: server-side injection across application inputs.
  • Data exposure: sensitive data leakage and overly permissive APIs.
  • SSRF: requests reaching internal or cloud infrastructure.
  • Cross-site scripting: reflected, stored, and DOM-based XSS.
  • Business logic: workflow abuse, race conditions, and logic flaws.
  • Configuration: exposed secrets, debug endpoints, and insecure configuration.

How to prepare for a white box pentest

A white box test is only as good as the context you give it. Before testing starts, agree these points with your tester:

  1. Code access. Decide which repositories are in scope and grant read access. Include the services behind the web app, not only the frontend.
  2. A target environment. Agree whether testing runs against staging, production, or both, and what each one can tell you. Our post on preview environment security testing covers what authenticated checks against a preview or staging build can tell you.
  3. Test accounts for every role. Authorisation bugs show up between roles and tenants, so provide at least two accounts per role, in separate tenants where your product has them.
  4. Context on intent. Short notes on how roles, sharing, and billing are meant to work help the tester spot where the code does something different.
  5. A route for findings. Agree where validated findings go (your issue tracker, for example) and how fixes get retested.

How often to run one

A single white box pentest is a snapshot of one version of your code. If you ship every week, the code it tested is out of date within days. That is why we recommend running white box pentests on a recurring basis, as part of continuous coverage, and pairing them with a review on every pull request so new changes are checked before they merge. Our explainer on continuous pentesting explains the model.

How we run whitebox pentests at Borg

Our whitebox pentests "test applications and APIs with source context" (Borg). In practice that means four things:

  • Application context: we "understand auth, permissions, APIs, and business logic".
  • Targeted testing: we "focus on the areas most likely to be exploitable".
  • Live exploitation: we "validate vulnerabilities against the running application".
  • Verified findings: each one comes with "evidence, reproduction steps, and remediation guidance".

On our homepage we say "every vulnerability is confirmed with evidence and reproduction steps before it reaches your team" (Borg). Each finding moves from reported to mitigating, retest, and fixed in our Odin platform (Borg).

Between pentests, our PR security reviews review every pull request before it reaches production. Your first 25 reviews are free, then $1 per PR. If you would rather we run the testing for you, our Forward Deployed Security service provides "ongoing testing, remediation support, and verified fixes across your environment".

Frequently asked questions

What is white box pentesting?

A white box pentest is a penetration test where the tester has the source code and internal documentation. NIST describes it as testing that "assumes explicit and substantial knowledge of the internal structure and implementation detail of the assessment object" (NIST).

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

A black box tester starts with no knowledge of the internals and works from outside. A white box tester has the code and uses it to decide what to attack. NIST defines black box testing as assuming "no knowledge of the internal structure and implementation detail" (NIST).

What is black box, white box, and grey box testing?

They are three levels of tester knowledge: none (black box), some (grey box), and substantial (white box). NIST calls them basic, focused, and comprehensive testing.

Is a white box pentest the same as a code review?

No. A code review reads the code for issues. A white box pentest uses the code to plan attacks, then proves each issue against the running application.

Do companies usually do white box testing in pentests?

It depends on what the test is meant to show. Black box tests show what an outside attacker can reach. White box tests go deeper into authorisation and logic, which is why OWASP's testing guide says that when testing web applications, especially in-house ones, "the source code should be made available for testing purposes" (OWASP WSTG v4.2).

Borg on
Social Media

Borg specializes in securing complex, high-risk digital systems.