Gray Box vs. Black Box vs. White Box Testing
The balance of white/black box security testing is a decision you will ultimately make based on your budget, risk concerns, and internal policies. This article is intended to help a client think through the benefits of white box testing and the downsides to full black box testing, as well as provide several real-world examples to demonstrate the points.
Note: The primary purpose of this article is to inform our clients of the differences between the three types of testing, but hopefully it will provide value to others as well.
Gray Box Testing
- somewhere in the middle of black box and white box testing
- all of the testing we perform would technically be considered gray box
Black Box Testing
- testing performed “just like the attacker”, meaning there is (typically) no access or assistance given or privileged information that is known ahead of time prior to testing.
- pure black box testing either costs more time (and therefore money), or thoroughness has to be reduced
- we would discourage you from wasting your money on pure black box testing
White Box Testing
- the tester has been granted full access to all systems/areas being tested and “knows what you know”
- testing is more thorough and the mitigation recommendations we give are more specific to your environment
- campus access badge, computer account (user level and admin level) and access to every detail of your environment (ex. technical documents, blueprints, etc.).
White box testing is always going to give you the best ROI. A security tester’s objective is to help you find your weaknesses and address them. Being granted access to all portions of your environment and information greatly reduces the time spent on the recon and enumeration phases. Furthermore, every stage of testing benefits, as testing outcomes are much easier to determine and the mitigation recommendations we give are more specific to your environment.
Common Oppositions to White Box Testing
- By granting the tester the access/information, they bypass the recon and enumeration phases. PEN Consultants does not bypass any phase or test when granted a higher level of access. 100% of the same testing occurs. Verification effort is what is greatly reduced.
- White box testing is testing insider threat as opposed to outsider threat. The two are actually independent of one another. An outsider’s perspective engagement will primarily focus on what an external threat is capable of, regardless of the level of inside knowledge we have ahead of time.
- An outside attacker will not have this access and information. How is this a fair assessment? This is were the bulk of the ROI is realized. An advanced threat will spend months (sometimes years) performing recon and testing various things in and against your environment. We want to ensure you do not have to pay for months/years of testing when days/weeks of testing can perfectly simulate what could have been done with an extended period of time and budget. The risk levels presented to you in the Findings and Recommendations Report for each finding take into account the difficulty for an attacker to come across a certain piece of information…even if we were given it directly.
- I don’t trust someone outside our organization with that level of information. Whether you grant access/information ahead of time or not, tester will gain access to much, if not all, of it anyway. When dealing with security testing vendors, you should thoroughly vet any organization that will be given (or gain) access to your privileged information. Read more about that here: https://penconsultants.com/compare
Here are a few real-world examples:
- Port scans and service detections are simplified when the testing includes access to netstat and tasklist/ps on the back-end.
- Injection type attacks (ex. SQLi, XXE, etc.), are almost always blind to a certain degree. Depending on the degree of blindness, the white box approach can greatly speed up verification of suspected injection vulnerabilities.
- Having access to and the ability to scan source code of an application is far superior than fuzzing the running application. The former is a scientific and repeatable process; the later is bordering on luck to find vulnerabilities.
- For phishing/social engineering engagements, the collection and verification of the target email address, phone numbers, titles, etc. can be time consuming, and therefore, costly. A client should ask themselves what their primary concern is – attacker generating a list of valid contacts vs. their users’ ability to distinguish between legit/evil messages – and provide the piece that is not of concern. In other words, why pay for the tester to generate and verify a list of contacts if your reaction to it will be, “So what, that information is mostly public anyway.”
- Another piece of a phishing/social engineering engagement that can contribute significantly to the costs is determining what your workstation load(s) looks like. The client providing a break down of client workstations (Win, Mac, Linux) and testing payloads for us prior to a phishing campaign saves us from having to carry out one (or more) recon campaigns to acquire the information on our own. As with an attacker, we certainly can go through all of the steps, but it really doesn’t provide you any value…and can double, or even triple, the cost for that service.
- Having a client provided floor plan prior to a physical social engineering engagement saves us the time (and you the costs) of acquiring one through black box means (ex. surveillance ahead of time).
A real-world testing scenario
One of PEN Consultants’ developed pretext for a physical social engineering engagement is as follows:
- Disable the air conditioner serving the IT closet the night before engagement
- Wait for the phone call to the HVAC service company and intercept it
- Impersonate a HVAC technician to gain physical access
- Tap into the corporate network and/or other actions
Although this seems like a straight forward assessment, and is certainly real-world, there are a number of factors that can greatly influence the pricing – a few thousand dollars, to many thousands of dollars. Here are a few of the areas in which a client’s provided information/help can influence the pricing:
- Floor Plan
- White box (no additional costs): Client provides the floor plan showing the location of the IT closet
- Black box (extra costs, no ROI): Find the floor plan online, acquire through the building contractor, recon in the days/weeks before, etc.
- Name of the HVAC service company
- White box (no additional costs): Client provides it
- Black box (extra costs, no ROI): Weeks before, we disable an outdoor condenser and surveil the area until the HVAC service company arrives
- Location of the condenser (outside) that serves the IT closet
- White box (no additional costs): Client provides it
- Black box (extra costs, little/no ROI): Weeks before, we surveil all condensers and determine which serves the IT closet – the IT closet is generally the largest heat source in the building, and therefore, that unit will run most frequently
- Means to intercept the communication channel between the target and HVAC company
- White box (no additional costs): Client’s maintenance employee (assuming there is one) can intercept and forward the call, or client could convince the HVAC company’s dispatcher to intercept and forward the call
- Black box (extra costs, little/no ROI): Ex. We tap the Client’s phone line at the demarc, tap the HVAC company’s phone line at their demarc (real-world, but no legal way to perform this), etc.
Featured image is a derivative work from the following images: OpenClipart-Vectors @ https://pixabay.com/vectors/cardboard-box-cardboard-box-moving-147605/