Penetration Testing

Difficulty: Intermediate

Question

What is black box penetration testing, and how does it compare with white box and grey box testing?

Answer

Penetration testing is an authorised, simulated attack on a system to find exploitable weaknesses before a real attacker does. Black box, white box and grey box describe how much knowledge and access the tester is given at the start. The choice shapes what the test realistically finds and how long it takes.

Black box testing

The tester gets no prior knowledge of internal workings, no source code, no architecture diagrams and often only a URL or an IP range. They approach exactly like an external attacker: reconnaissance, scanning, enumeration, then exploitation. This best simulates a real outside threat and tests your externally visible defences honestly. The trade-off is that it is time-consuming and may miss deep flaws simply because the tester runs out of time or never finds a hidden entry point. No finding does not prove no vulnerability.

White box testing

The tester gets full information: source code, architecture, credentials and configuration. This gives the most thorough coverage because they can trace every code path, review logic and find flaws a black box test would never reach. It is efficient and deep, but it does not model an external attacker's limited view and can produce findings that are hard to reach in practice. It overlaps with secure code review.

Grey box testing

A middle ground where the tester has partial knowledge, typically a standard user account and some documentation. This is often the most cost-effective option because it mirrors a realistic threat, such as a logged-in customer or a compromised low-privilege account, and focuses effort where it matters, for example testing for privilege escalation and broken access control.

Comparison

AspectBlack boxGrey boxWhite box
Knowledge givenNonePartial (user + some docs)Full (code, creds, design)
SimulatesExternal attackerInsider or compromised userAuditor with full access
CoverageShallow but realisticBalancedDeep and thorough
Time and costHigh per findingModerateEfficient for depth
Main limitationMay miss hidden flawsNot a full external viewLess realistic attacker view

Where these fit in practice

These knowledge levels sit inside a wider engagement. A proper test defines scope and rules of engagement (what is in bounds, allowed hours, whether social engineering or denial of service is permitted), follows phases of reconnaissance, scanning, exploitation and post-exploitation, and ends with a report of findings ranked by risk. It is distinct from a vulnerability scan, which is automated and just lists potential issues; a pen test confirms exploitability and chains issues together. Note that a 'red team' exercise goes further still, testing detection and response, not just finding vulnerabilities.

Common mistakes

  • Treating a vulnerability scan as a penetration test; scanning finds candidates, pen testing proves impact.
  • Running a test without written authorisation and a defined scope, which is both unsafe and potentially illegal.
  • Assuming a clean black box report means the system is secure, when it may just reflect limited time.
  • Skipping retesting after fixes, so you never confirm the holes are actually closed.
Black box vs grey box vs white box. The amount of knowledge given changes realism, coverage and cost.
AspectBlack boxGrey boxWhite box
KnowledgeNonePartialFull
SimulatesOutside attackerInsiderAuditor
CoverageRealistic, shallowBalancedDeep
Cost per findingHighModerateEfficient

Key points

  • Black box: no internal knowledge, simulates an external attacker, realistic but shallow.
  • White box: full code and access, deepest coverage, less realistic attacker view.
  • Grey box: partial knowledge, cost-effective, models an insider or compromised user.
  • A pen test proves exploitability; a vulnerability scan only lists potential issues.
  • Always define scope, rules of engagement and written authorisation first.

Common follow-up questions

  • How is a penetration test different from a vulnerability scan?
  • What is a red team exercise and how does it differ from a pen test?
  • What goes into the rules of engagement before a test starts?
  • Why does a clean black box report not guarantee the system is secure?

Interview tips

  • Define all three levels, not just black box, and compare them on realism vs coverage.
  • Mention scope and authorisation; it shows you understand testing is done responsibly.
  • Distinguish pen testing from scanning and red teaming to show broader awareness.

Concepts covered

Black Box, White Box, Grey Box, Vulnerability Scanning, Scope and Rules of Engagement

More Web Security (OWASP, JWT, XSS, CSRF) questions