penetration testing TUTORIAL

“Penetration testing” is a method of evaluating the security of an IT infrastructure by simulating the actions of an attacker.

For this purpose exploit code, i.e., computer programs that take advantage of specific vulnerabilities in targeted systems or networks, are used; they must be adjusted to each individual case.

The use of “zero-day exploits”, which take place before official patches are available for detected vulnerabilities, may shorten the test time but poses a significant risk if they remain undetected afterward.

Penetration tests can also be carried out on single workstations or servers as well as client-server applications and entire IT infrastructures.

In any case penetration testing is primarily a means for threat analysis with regard to cyber-attacks and the identification of security risks.

Purpose Of Penetration Testing

The purpose of penetration testing is to identify the vulnerabilities in IT systems and networks in order to improve their security.

Penetration tests can be carried out in different areas: The system or network architecture, the confidentiality, integrity, and availability (CIA) of data, applications (e.g., web services), online transactions (e-commerce), operational technology (OT) networks, etc.

Scope Of Penetration Testing

Penetration tests are customarily divided into internal and external tests; further classifications are offered by some authors according to the time when they are conducted (time-based classification) or with regard to target-specific criteria (sector-based classification). Usually, both variants are combined so that it is possible to comprehensively assess IT security.

Time-based classification:

Preparatory (initial):

The goal of preparatory tests is to identify the attack surface and potential vulnerabilities in the target system or network. They are usually conducted before the actual penetration test and serve as a basis for planning further steps.


The purpose of exploratory tests is to gain an overview of the security posture of the target system or network. They are usually executed early in the test phase, often even before identifying any vulnerabilities, in order to develop an understanding of how the system works and what might be possible attacks.


The objective of targeted tests is to exploit known vulnerabilities in order to determine whether they can be exploited and, if so, to what extent. The aim is to gain a detailed understanding of the vulnerability so that a risk assessment can be made.


Regulatory tests are conducted in order to meet certain requirements for IT security, for example, those set by the Payment Card Industry Data Security Standard (PCI DSS). They focus on specific vulnerabilities and exploit known attacks that are relevant to the respective target systems.


The goal of the final tests is to evaluate the achieved security level and identify any remaining vulnerabilities. They are usually carried out after patches or other security measures have been applied in order to determine their effectiveness.

Sector-based classification:


Penetration tests in telecommunications are concerned with the security of voice and data communications, including mobile networks.

Banking and Financial Services:

Penetration tests in banking and financial services focus on the security of online banking, credit card processing, and other transactions.

Public Sector:

Penetration Testing in the public sector includes all levels of government as well as critical infrastructures such as energy and transportation.


Penetration tests in the enterprise target individual businesses or organizations.

The goals of penetration testing can be summarized as follows:

1. To identify vulnerabilities in IT systems and networks

2. To improve the security posture of IT systems and networks

3. To reduce the risk of cyber attacks

4. To meet certain requirements for IT security, for example, those set by the Payment Card Industry Data Security Standard (PCI DSS)

5. To evaluate the achieved security level and identify any remaining vulnerabilities.

The benefits of penetration testing are:

1. Improved security posture

2. Reduced risk of cyber attacks

3. Compliance with certain requirements for IT security

4. Evaluation of the achieved security level and identification of any remaining vulnerabilities.

Factors to consider when planning a penetration test:

1. The scope of the test, that is, which systems or networks will be tested and what areas will be examined

2. The time frame for the test

3. The resources needed for the test, including personnel, tools, and information about the target systems

4. The extent to which the results of the test may be disclosed, including whether any vulnerabilities identified will be disclosed and whether remedial action will be required from system owners.

In addition, administrators should consider how the penetration test itself might affect operations. Penetration tests that require a great deal of time or resources can have a negative impact on operations, particularly if they occur during normal business hours.

However, if a penetration test is conducted outside normal hours it may help identify security holes but could have an adverse effect on productivity due to anything from decreased bandwidth to increased downtime during patching activities.

Thus adequate preparation is important for minimizing the disruption caused by penetration testing while still obtaining meaningful results.

The following points summarize best practices for administrators conducting penetration testing:

1. Prior to the test, identify which systems and networks will be tested, what areas will be examined, and the time frame for the test

2. Obtain written permission from authorized system owners before beginning the test

3. During the test, take care not to disrupt normal operations or cause damage to systems

4. After the test is completed, carefully analyze the results and take appropriate remedial action

5. Document all aspects of the test including its objectives, scope, methodology, and results.

In order to understand how a penetration test works, it is necessary to first understand some basics of security.

A security system can be thought of as a series that protects an organization’s assets.

The assets can be anything of value to the organization, including data, systems, and networks.

The security system is made up of three components:

The first component is the security perimeter, which is designed to keep unauthorized users from accessing the organization’s assets

The second component is the security infrastructure, which includes all the technologies and processes used to protect the organization’s assets

The third component is the security policy, which defines how the security infrastructure should be used and sets out the rules and procedures for protecting the organization’s assets.

The purpose of a penetration test is to identify vulnerabilities in an organization’s security system by attempting to circumvent them.

A successful penetration test will identify vulnerabilities that could allow unauthorized users to gain access to the organization’s assets.

Penetration testing can be divided into two categories:

Black-box penetration tests and white-box penetration tests. Black box penetration testing, or external testing, is when the security professional has no knowledge of the system being tested.

White box penetration testing, or internal testing, occurs when the security professional is provided with information about the target environment prior to conducting the test.

The following table lists the advantages and disadvantages of both types of penetration tests.

Black-box Penetration Testing


1. Useful for identifying vulnerabilities that may be difficult to detect with other forms of testing

2. Uncovers many types of security problems

3. Challenges testers to find vulnerabilities through creative means

4. Reveals the level of security awareness and technical skills of the organization’s employees


1. Cannot be used to assess the security of internal systems

2. Does not identify vulnerabilities that are known to the attacker

3. May cause damage or disruption to systems being tested

4. Results may be less accurate than those from other forms of testing

White-box Penetration Testing


1. Can be used to assess the security of both internal and external systems

2. Identifies vulnerabilities that are known to the attacker

3. Easier to verify the accuracy of results

4. Less likely to cause damage or disruption to systems being tested


1. Cannot be used to identify vulnerabilities that are difficult to detect with other forms of testing

2. May not uncover many types of security problems

3. Does not challenge testers to find vulnerabilities through creative means.

The best way for an administrator or system owner to conduct a penetration test is by hiring experienced security professional.

By hiring a third party the organization ensures that the tester will have no prior knowledge about those systems being tested and will operate under strict rules of engagement as established by the company.

In addition, it will allow the administration more control over what areas are looked at during the test so they can ensure their more sensitive information remains secure.

Finally, this course of action ensures accuracy in the outcome of the test by having another party verify it.

There are many different penetration testing methodologies, each with its own goal and scope.

Some examples include targeting the organization’s wireless access point or attempting to exploit known vulnerabilities in commonly used software.

Oftentimes, when organizations perform penetration tests they limit themselves to only one methodology; however, performing multiple types of penetrations tests can provide a more thorough assessment of their security systems.


1. Black Box Testing (Internal)

2. White Box Testing (External)

3. Gray Box Testing (Partly Internal/Partly External)

4. Web Application Penetration Testing

5. Wireless Penetration Testing

6. Exploitation Frameworks for Vulnerability Scanning

7. Reverse Engineering Malware

The most important thing to remember when conducting a penetration test is that the objective is to identify vulnerabilities, not exploit them.

It is also important to have a clear understanding of the organization’s security policy and the rules of engagement for the test.

By following these simple guidelines administrators can ensure that their systems are tested in a safe and secure manner.

In conclusion, penetration testing is an important tool that can be used to identify vulnerabilities in an organization’s security system.

There are two types of penetration tests: black box and white box. Black box tests are conducted without any knowledge of the target environment, while white-box tests are conducted with information about the target environment.

Gray box tests are conducted partially with knowledge of the environment. There are many different penetration testing methodologies that can be used to conduct a penetration test based on scope and goals.

Any organization should consult an experienced security professional when they decide to perform a penetration test, otherwise, the results may be less than accurate.

By using this information administrators can be better equipped to successfully approach their own penetration tests for optimal results.