The ultimate objective of any software developer is to create performant, secure, and usable applications. Realizing this goal requires every application to be tested thoroughly.
Testing is therefore a critical aspect of creating robust applications. Its what ensures the developed software meets the desired quality expectations.
This blog examines one of the vital testing methods: white box penetration testing. In this blog, well review the following:
What Is White Box Penetration Testing?
How Is White Box Pen Testing Performed?
Types of white box pen testing
White Box Pen Testing Techniques
White Box Pen Testing Tools
Advantages of White Box Pen Testing
Disadvantages of White Box Pen Testing
Differences Between White Box and Other Types of Pen Testing
Penetration testing, also referred to as ethical hacking or pen testing, is the process of performing an authorized attack on a system to identify security weaknesses or vulnerabilities.
White box is a type of penetration testing that assesses an applications internal working structure and identifies its potential security loopholes. The term white box is used because of the possibility to see through the programs outer covering (or box) into its inner structure. Its also called glass box pen testing, code-based pen testing, transparent box pen testing, open box pen testing, or clear box pen testing.
In this type of testing, the ethical hacker has full-disclosure of the applications internal configurations, including source code, IP addresses, diagrams, and network protocols. White box pen testing aims to simulate a malicious intruder who could have full familiarity with the target systems internal structure.
White box testing has three basic steps: prepare for testing, create and execute tests, and create the final report.
Preparation is the first step in the white box penetration testing technique. It involves learning and understanding the internal workings of the target application.
Performing successful white box testing requires the pen tester to have an in-depth knowledge of the inner functionalities powering the application. This way, itll be easier to create test cases to uncover security loopholes in the target software.
In this preparation phase, the tester acquaints themself with the source code of the application, such as the programming language used to create it and the tools used to deploy it.
After understanding how the application works internally, the pen tester then creates tests and executes them.
In this stage, the tester runs test cases that assess the softwares source code for the existence of any anomalies. The tester may write scripts to test the application manually, use testing tools for performing automated tests, or use other testing methods.
In the last stage, the pen tester creates a report that communicates the results of the entire testing process. The report should be provided in a format that is easy to understand, give a detailed description of the testing activity, and summarize the outputs of the testing tasks.
Creating the final report justifies the steps and strategies used, allows the team to analyze and improve the efficiency of the testing process, and provides a document for future reference.
There are several white box testing types that can be used to assess the internal functionalities of an application and reveal any security weaknesses.
WhiteSource Report DevSecOps Insights 2020 Download FreeReport
The main ones include the following:
Unit testing. The individual units or components of the applications source code are tested. It aims to validate whether each unit of the application can behave as desired. This type of white box testing is essential in identifying security anomalies early in the software development life cycle. Defects discovered during unit testing are easier and cheaper to fix.
Integration testing. This type of open box testing involves combining individual units or components of the applications source code and testing them as a group. The purpose is to expose errors in the interactions of the different interfaces with one another. It takes place after unit testing.
Regression testing. In regression testing, the pen tester performs further tests to verify that a recent change in the applications code has not harmed existing functionalities. The already executed test cases are rerun to confirm that previously created and tested features are working as desired. It verifies that the old code still works even after fixing bugs, adding extra security features, or implementing any changes.
A major technique for performing white box penetration testing is code coverage.
Code coverage is a metric that gauges the extent to which the source code has been tested. It computes the number of lines of code that have been validated successfully by a test scenario.
This is the formula for calculating it:
Code coverage = (Number of lines of code executed / Total number of lines of code) * 100
Suppose all your tests are passing with flying colors, but only capture about 55% of your codebase. Do the test results give you enough confidence?
With code coverage, you can determine the efficiency of the test implementation, quantitatively measure how your code is exercised, and identify the areas of your program not executed by test cases.
There are three main types of white box testing techniques and methods related to code coverage: statement, branch, and function coverage.
Statement coverage is the most basic form of code coverage analysis in white box pen testing. It measures the number of statements executed in an applications source code.
This is the formula for calculating it:
Statement coverage = (Number of statements executed / Total number of statements) * 100
Branch coverage is a white box pen testing technique that measures the number of branches of the control structures that have been executed.
It can check if statements, case statements, and other conditional loops present in the source code.
For example, in an if statement, branch coverage can determine if both the true and false branches have been exercised.
This is the formula for calculating it:
Branch coverage = (Number of branches executed / Total number of branches) * 100
Function coverage evaluates the number of defined functions that have been called. A pen tester can also provide different input parameters to assess if the logic of the functions could make them vulnerable to attacks.
This is the formula for calculating it:
Function coverage = (Number of functions executed / Total number of functions) * 100
Here are some common open source white box testing tools:
JUnit is a unit testing tool for pen testers using the Java programming language.
HtmlUnit is a Java-based headless browser that allows pen testers to make HTTP calls that simulate the browser functionality programmatically. Its mostly used for performing integration tests on web-based applications atop other unit testing tools like JUnit.
PyUnit is a unit testing tool for pen testers using the Python programming language.
Selenium is a suite of testing tools for automatically validating web applications across various platforms and browsers. It supports a wide range of programming languages, including Python, C#, and JavaScript.
Benefits of performing code-based penetration testing include the following:
The tests are deep and thorough, which maximizes the testers efforts.
It allows for code optimization and identification of hidden security issues.
Automating test cases is easier. This greatly reduces the time and costs of running repetitive tests.
Since white box testers are acquainted with the internal workings, the communication overhead between them and developers is reduced.
It offers the ability to identify security threats from the developers point of view.
Disadvantages of performing code-based penetration testing include the following:
White box testing is time-consuming and demanding because of its rigorous approach to penetration testing.
The tests are not done from the users perspective. This may not represent a realistic scenario of a potential non-informed attacker.
White box penetration testing is often compared to black box penetration testing. In black box testing, the pen tester does not have a deep understanding of the applications internal structures or workings. The term black box is used because its difficult to see through the programs outer covering (or box) when its completely closed.
One major difference between the two testing strategies is that black box pen testing does not have any prior information about the internal workings of the target system. A black box tester aims to penetrate the system just like an uninformed outside attacker does. Black box penetration testing is suitable when the pen tester wants to imitate an actual external attack scenario.
In penetration testing, white box is a useful approach to simulating the activities of an attacker who has full knowledge of the internal operations of the target system. It allows the pen tester to have exhaustive access to all the details about the system. This enables the pen tester to identify as many vulnerabilities as possible.
Of course, in some situations, you may opt for other pen testing methods, such as black box testing, to assume the stance of a non-informed outside potential attacker.
Recent Articles By Author
*** This is a Security Bloggers Network syndicated blog from Blog WhiteSource authored by Patricia Johnson. Read the original post at: https://resources.whitesourcesoftware.com/blog-whitesource/white-box-penetration-testing
Visit link:
The Most Comprehensive Guide to White Box Penetration Testing - Security Boulevard