In AppSealing Blog, AppSealing News

 

The instances of cyberattacks are not only growing in numbers but also in the nature of its complexity. Attackers are constantly on the lookout for a vulnerability to breach their target organization. 

According to the global consulting firm Accenture, USD 5.2 trillion of global value (2019–2023 estimates) is under threat due to cyberattacks.

On most occasions, businesses have to rely on more than just a basic virus scan. However, all companies need to test their defense mechanisms regularly to understand how prepared they are to handle a contingency. This is where penetration testing comes into play.

What is Penetration Testing

Penetration testing, or pen testing, is a form of ethical hacking where computer systems or a network of web applications are attacked by highly skilled security professionals to find vulnerabilities. The test can be automated, carried out manually, or even be a mix of both depending on the requirements. 

The idea behind penetration testing is to identify possible entry points in the organization’s network and breach the defense mechanism of the target. Once the system is hacked, the security professionals gather as much information as possible and prepare a report that helps the company to take corrective measures and fortify their walls. Since the testing is carried out by people trying to help the organization, it is also known as the white-hat attack. 

Why Penetration Testing is Important

No organization’s default security system is watertight. There are always tiny holes that need to be found and plugged. The importance of this method of cybersecurity can be gauged from the fact that in 2016, The Pentagon opened its doors to outsiders to test the defense of their unclassified computer systems. The 1,400 hackers who registered for the “Hack the Pentagon” program exposed 100 security threats that even an organization like the United States Department of Defense was not aware of earlier.

Here are a few reasons why organizations must employ pen testing professionals from time to time:

Discovering Vulnerabilities Before Attackers

A pen tester, under a controlled environment, carries out attacks the very same way hackers with malicious intent would do. They break their heads to find out vulnerabilities that could potentially cause damage to the organization. They filter issues like software errors, poor configurations, inaccurate system settings, and other shortfalls. This helps organizations to understand vulnerabilities and correct them as soon as possible to avert any major attacks.

Reducing Network Downtime

IT system downtime can burn a hole in the pockets of business organizations. According to a Gartner report, organizations lose up to USD 5,600 on an average per minute due to this reason. A regular pen test reduces the downtime drastically, thus keeping the organization’s engine running smoothly.

Building a Safer Ecosystem

Pen testers not only find faults in the organization’s system but also suggest ways to tackle them. Experienced testers help their clients to understand their flaws and engage with the firm’s technical experts to build better defense mechanisms to avert potential attacks.

Protecting Reputation

Several factors go into building brand value and consumer trust. Every security mishap involving customers’ data directly affects the brand value and sales and even brings bad repute for the company, which big organizations cannot afford.

Penetration Testing Parameters

Organizations that operate through robust IT infrastructure are always vulnerable to organized system attacks from hackers, attackers, unscrupulous rivals, political dissenters, etc. and are perpetually in search of vulnerabilities in security systems of an organization. These vulnerabilities eventually become parameters on which organizations test their preparedness to ward off future attacks.

There are various kinds of vulnerabilities that attackers exploit to run malicious codes, access drives of computers in their target servers or personal computers, modify data, and even inject viruses. 

Weak Passwords

Weak passwords are the lowest-hanging fruit for any potential attacker who wants to breach the target organization’s defense system and exploit it. 

Outdated Applications

Hackers often use outdated applications and systems as easy entry points. It is imperative to keep applications and operating systems constantly updated, as they contain important patches that safeguard systems. 

Injection Vulnerabilities

Attackers aim to gain database and server access by pushing in the malicious payload in the form of codes and scripts. Payloads are the part of the attack which inflicts the target. All attack vectors, like viruses and malware, contain at least one payload. The most widely exploited vulnerabilities are authorization for invalid inputs in submission forms, contact forms, and other input-based fields.

Encryption, Authentication, and Authorization

Encrypting data is needed to ensure there are no leaks during data storage and transmission. When organizations do not adhere to proper encryption protocols, such as TLS, SSL, etc., they become sitting ducks for attackers. 

Source: The Verge

Authentication shortfalls, such as weak, default passwords, and broken access control, are exploited by attackers to extract sensitive information.

Vulnerable Components

There are certain applications, frameworks, and software that are repeat offenders when it comes to compromising data. Such frameworks that are prone to exploitation are detected during a pen test.

Misconfiguration Issues

According to Cobalt’s “Pen Test Metrics 2018” report, misconfiguration is the most common vulnerability detected during pen tests.

Source: Cobalt

Attackers can wreak havoc on an organization’s system if they discover open ports, overexposed services, or network misconfigurations. Any such attack can cause harm to the integrity of the company and force users to quit using its applications.

Business Logic Vulnerabilities

It is an application vulnerability that surfaces due to security loopholes. Attackers target those areas of the application where developers are prone to make errors. This class of flaw is very difficult to detect through automated scans. A thorough pen testing by seasoned professionals is the company’s best bet of finding such loopholes.

 

Penetration Testing Teams

Pen testing is an elaborate and detailed process and is not carried out by just one person or team alone. Testers are broadly categorized into three teams: Red, blue, and purple. 

Although they are interconnected, each team has a distinctive and equally important role to play in the whole process. We define their roles below:

Red Team 

This is the team directly tasked with penetrating the organization’s defense barrier and gaining access to the systems. It can be compared to the stealth team in armed security forces. The team consists of highly skilled ethical hackers who are not associated with the target company in any way. The red team utilizes the latest hacking techniques and may even write their scripts to develop a virus to attack targets, much like how a hacker with malicious intentions does. They infiltrate the systems using both physical and virtual techniques while trying their best to evade detection. This team will go to any length, within the legal framework, to find an entry point to accomplish its task. 

This team generally utilizes open-source intelligence to carry out reconnaissance and gathers information on the target organization and its systems. On occasions, the red team may also carry out fake attacks to mislead the security system. Its members are trained to attack quickly and when they are least expected to do so, thus effectively mimicking a real-life attack. 

Blue Team

This team comprises highly skilled analysts form within the organization whose main role is to neutralize any attack to the company security system. This process shows how well the blue team is equipped to handle similar situations if and when they arise in a real-life scenario. They are tasked with the duty of finding out, handling, and weakening attacks orchestrated by the red team. It has to be on its toes all the time, foresee any emerging attack, and take necessary precautions to avert or minimize the damage. It needs to actively monitor traffic on the organization’s network and be ready to jump into action in the shortest possible time. 

Purple Team

The target organization’s top security professionals make up this team. Its primary task is to observe how effectively the red and blue teams are working with each other. If the purple team observes any issues with the functioning of either of the teams, it can provide suggestions for course correction. At times, it can support the blue team to beef up security and help it chalk out recovery plans in the case of attacks which can be utilized later. Eventually, the goal of the purple team is to learn about the vulnerabilities in the organization’s system and prepare a road map, which includes educating the current employees about security threats and reinforcing the security wall of the network.

 

Penetration Testing Method

Organizations employ different types of strategies to safeguard their networks, applications, and computers against cyberattacks. They involve using in-house and external professionals and agencies to mimic attacks as if they were taking place in a real-life scenario. Below are some strategies organizations employ to preempt hacking attempts:

Targeted Penetration Testing

In this type of testing, the organization’s IT professionals coordinate with pen testers and keep each other informed at all stages of the process. The tests are carried out on an open server so that all developments can be monitored, recorded, and analyzed by both parties.

External Penetration Testing

It is a very conventional approach to pen testing, where ethical hackers try to breach internal networks through external servers, clients, and people. The pen tester’s main objective is to gain access to a particular server through whatever means it can be done within legal limits. Testers may take advantage of a weak web application or even coax a user to divulge sensitive information, like passwords, over a phone call.

Internal Penetration Testing

The primary objective of internal pen testing is to analyze the company’s defense mechanism in case of an attack where the hacker has breached the initial network. The pen tester mimics internal attacks that often target the lesser important systems. Then, they launch an attack on the primary target with the help of the information gained earlier.

Blind Penetration Testing

Testers carry out an attack using publicly available information. It is as close it gets to a real attack, where ethical hackers have to work their way in taking cues from the information already at hand and not depend on any help from the organization even when it has authorized this type of testing.

Double-Blind Penetration Testing

This process, also known as zero-knowledge testing, is even more covert than blind testing. Testers have little or no knowledge about their target’s defense systems, and, likewise, the target company has no clue what approach, scale, and duration attackers will adopt to harm its systems. This approach needs highly skilled pen testers, as they have to rely on their experience to choose appropriate tools and methods to break into a company’s defenses.

 

Types of Penetration Testing

To expose loopholes in a company’s security system, there are three types of pen testing models which can be employed: black-box testing, white-box testing, and gray-box testing, which are described below:

Black-Box Testing

This is also known as the trial-and-error method in which security experts are not provided any details on the company’s network, software, or source code. In such a case, the hacker goes for a full attack against the network to find an entry point that can be exploited. This method requires a lot of effort and is time-consuming. Attackers have the luxury of time on their hands in real-life scenarios. Miscreants can devise a complex attack plan over several months and attack when it is least expected. Testers often rely on automated processes to ease their burden while carrying out this testing process.

White-Box Testing

It is the exact opposite of black-box testing. This method, also known as clear-box testing, grants complete access of the network to the tester. The security expert is provided with vital information about the company’s internal workings, software, and source code. Since the tester is loaded with information, the process becomes less tedious when compared to the previous method. Despite being a more comprehensive method, white-box testing has its drawbacks. Give the information overload, choosing a core area to focus on can be a huge task. The tester has to narrow down on the specific components that need to be analyzed against hacking attempts. This method requires more advanced software tools and analyzers.

Gray-Box Testing 

As the name suggests, this method employs principles of both black- and white-box testing. Neither complete details about the company’s system are divulged, nor is the tester kept in complete oblivion. Basic details, such as software code and other information that grants the tester access to the system, are provided. This method provides greater freedom to the tester who can choose to employ both manual and automated processes to find loopholes. It can recreate a scenario where a hacker has already gained internal access to the network. It helps the organization understand complex vulnerabilities and develop a more streamlined security plan. This is by far the most effective method and improves the chances of zeroing in on possible vulnerabilities that are a little harder to detect.

These types of pen testing can be further divided into more specific groups, such as:

Social-Engineering Tests 

In this pen-testing method, the tester encourages an employee or a third party to reveal sensitive information, like passwords, which can be used to break into the network. Even a tiny hint provided by an employee can go a long way in compromising the system. This has proven to be an efficient hacking technique that takes advantage of human weaknesses. Social-engineering tests can be carried out in two ways – remote and physical. In remote testing, the hacker uses technology like phone or phishing emails to gather information. In physical testing, the pen tester comes in actual contact with the person. A tester can disguise themselves as a company employee and extract vital information. Either way, the target company should provide the requisite permission before such tests are conducted.

Web-Application Tests

This is a far more complex test and requires thorough planning before implementation. Areas like web applications, browsers, and their plug-ins are put to test in this process.

Client-Side Tests 

The objective of these tests is to find out local threats. Miscreants exploit glitches in applications running in the system. Apart from third-party applications, threats can arise from careless practices used within the organization. Running uncertified operating systems is one such loophole. Therefore, comprehensive testing of the local system and network is very important.

Wireless-Network Tests 

As the name suggests, this process is carried out to analyze all wireless devices, such as smartphones, tablets, laptops, etc. which are connected to the organization’s server. Configuration protocols of wireless devices and access points should be tested and any violation should be detected.

 

Penetration Testing Phases

Pen-test is a comprehensive and meticulous process that varies with the kind of testing – whether it is internal or external. The testing process can be broadly broken into four phases: Planning, discovery, attack, and reporting.

Planning or Agreement Phase 

All activities conducted before the actual test take place during this phase. This is the stage where the tester and the company decide on the scale of operation and complete all the paperwork. Approvals, documents, and agreements, such as the non-disclosure agreement, are inked at this stage. Unlike a hacker, a tester is bound by legalities, timelines, and agreements. Several factors need to be taken into consideration at this stage while developing a sound course of action. An attacker in a real-life scenario would have ample time in their hands to find an entry point and exploit the vulnerabilities, but a tester has a limited period available – also taking into consideration the working hours of the business to carry out the process. The company may also limit the scope of the test fearing the financial impact on the business due to information leaks. The tester also has to work within the legal framework and strictly adhere to the conditions mentioned in the agreement signed by both parties.

Discovery Phase

This is the stage where the actual testing and information gathering takes place. This phase can be further divided into three parts: footprinting, scanning, and enumeration phases, followed by vulnerability analysis.

Footprinting is gathering information about the target involving non-invasive processes. Scanning the internet for information on the organization is often an overlooked process but can lead to a goldmine of relevant information. Since no attempt is made to break into the system, the tester remains undetected. If the tester puts in a concentrated effort, useful information like IT setup details and device configurations can be dug up, which can come in handy while carrying out the actual break-in.

Then come the scanning and enumeration stage in which the tester invades the security system of the target to gather information like operating system details, network paths, live ports, and the services operating in them. The tester has to smartly break into the system while ensuring the traffic on the network does not spike up and alert the system administrator. Only those tools that have been tried and tested before should be employed by the tester. To minimize the possibility of false positives in the later stages, the tester has to find out the precise details about the operations system and services running on the system and record them in the reports.

Once adequate information is gathered, the pen tester should try to identify loopholes in the defense mechanism of the target. This component is called vulnerability analysis. The efficacy of this process largely depends on the knowledge and skill levels of the tester. Keeping up with the latest trends and developments is essential for any tester to be successful. A tester may use automated processes to find out an entry point and exploit it. The pen tester may also try to use random inputs to check for discrepancies in the system output. It should be kept in mind that the whole process of pen testing is not solely tool reliant, so the testers have to be on top of their game to make the operation successful.

Attacking phase

This is the make or break phase of the pen testing process. It is intriguing and challenging in equal parts. This phase can be broadly classified into the exploitation part and the privilege escalation part.

In the exploitation part, the tester tries to find ways to take advantage of loopholes in the security system found out in the previous phase. The tester must have prior knowledge of C or other scripting languages, such as Python or Ruby. This phase must be carried out tactfully as even one misstep can bring the whole production system crashing. The exploits must be first carried out in a controlled environment before attacking the system. Organizations may not want certain sensitive areas of their systems exploited at all. The tester has to tread carefully and provide sufficient information while explaining the impact of the vulnerability on the network. There are proficient exploitation frameworks available commercially that the tester can make use of. A pen tester should try to make the most of these frameworks and not use them merely for carrying out exploits. In some cases, an exploit may not lead to root access, pushing the tester to analyze further to reach the threat.

As mentioned earlier, on certain occasions the exploit does not lead to root access. In such cases, the tester is required to carry out deeper analysis and gain information that grants them administrative privileges. The tester could be required to take the aid of additional software to attain special privileges. This is what is known as privilege escalation. Pen testers should also consider targeting other systems in the network once access is gained. This process is called pivoting and helps in understanding the real impact of an exploit on a company’s security mechanism. However, it requires prior permission and clearance from the target organization, and the tester needs to keep a record of all the exploits carried out.

Reporting Phase

This is the final stage in the pen testing process and can be carried out along with the other phases or completed at the very end. This is probably the most important phase of the whole process because the organization pays the tester precisely for this report.

The final report must be elaborate and prepared to keep in mind that all technical aspects are lucidly explained for the management. The technical details, including all the successful exploits carried out, must be mentioned with adequate evidence in the form of screenshots. A clear recovery path must be recommended as well. 

 

Penetration Testing Tools

Pen-testing tools are software applications used by testers to carry out their activities efficiently. Depending on their goals, testers opt for tools that they feel best suit their requirements. There are countless testing tools, both paid and free, available on the web. Given below is a list of some of the widely used pen-testing tools:

Metasploit

It is an open-source framework widely used by both the red and blue teams. As it is an open-source, Ruby-based framework, Metasploit can easily be tailored for almost all operating systems. The framework is powerful and can detect vulnerabilities in network servers with ease. Once the loophole is detected, the framework’s extensive database helps testers carry out the exploit. Metasploit has changed the landscape of pen-testing. Earlier, testers had to break in manually using various tools. They had to write their code and inject them into the network. This framework has eased the process and now is the go-to tool for most testers and even hackers. It has around 1,700 exploits over 25 platforms, that include Java, Android, PHP, and Cisco among others.

Visit Website: Metasploit

Wireshark

It is a packet sniffer/network protocol analyzer that lets the tester view the happenings in the network in real-time with the minutest of details. This open-source project, which has been developed through contributions over the last two decades, effectively deep-scans several web protocols with ease. It is part of the kit of most testers due to its protocol analysis features that make accessing traffic in real-time hassle-free. Wireshark can break down data packets and determine their characteristics and map their origin and destination. This helps in detecting loopholes within the system. It is adept in handling SQL injections and buffer overflows risks and is efficient in testing wireless networks. Its USP, however, remains the ability to break down traffic to the finest details.

Visit Website: Wireshark

Kali Linux

This Linux distribution contains a powerful set of tools for pen-testing, which has over 600 ethical hacking components. It is a highly advanced testing suite available on Linux machines. The tester needs to be well-versed in TCP/IP protocols to operate these tools effectively and carry out activities like code injection and password sniffing. This suite of tools is meant for brute force attacks. For many testers, it is a one-stop solution for all their needs. There are provisions for vulnerability analysis, wireless attacks, passwords cracking, spoofing, sniffing, and even hardware hacking in this versatile suite of tools. To make things better, other popular pen-testing tools, like Metasploit and Wireshark, can easily be run on Kali Linux.

Visit Website: Kali Linux

John the Ripper

It is a free testing tool used to crack passwords written mostly in C. John the Ripper auto-detects encryption, runs it through a plain-text file containing commonly used passwords, and comes to a halt after detecting a match. This tool can help organizations detect weak passwords and revamp their protection policies. The tool comes with an inbuilt list of common passwords in over 20 languages.

Visit Website: John the Ripper

Netsparker Security Scanner

It is one of the most popular pen-testing web applications. Testers can use Netspaker to detect anything from cross-site scripting to an SQL injection in websites and web applications. It can scan up to 1,000 applications in one go. It employs a proof-based scanning mechanism, guaranteeing maximum accuracy. This application is equipped to scan common modern web applications, including HTML5, Web 2.0, and even password-protected web assets. Once it detects vulnerabilities, the software assigns them a severity level to help the tester focus on areas that need immediate attention. The management system of the software gives testers greater freedom in creating and assigning roles, carrying out retests, and taking corrective measures. 

Visit Website: Netspark Security Scanner 

Aircrack-ng

This open-source tool is the first choice of the testers who want to break into a wireless network. Pen testers can use this tool to monitor and analyze the Wi-Fi security mechanism of a target, collect data packets, and convert them into text files for further study. Testers can easily break into WPA and WEP security protocols using this tool. Originally developed for Linux, Aircrack-ng now is compatible with operating systems like Windows, FreeBSD, OS X, Open BSD, Solaris, and eComStation. Although it is effective in cracking keys on the WEP and WPA-PSK networks, the tool loses its functionality when it comes to testing non-wireless networks.

Visit Website: Aircrack-ng

Acunetix Scanner

It is an automated pen-testing tool that is used to detect cross-site scripting and SQL injections. The framework is advanced and capable of digging out tough-to-detect vulnerabilities. Its sophisticated AcuSensor technology, manual penetration tool, and vulnerability management system ease black- and white-box testing and improve the correction process. Another advantage of using this tool is that it can scan thousands of web pages in an instant and also be operated locally or through a cloud network set-up.

Visit Website: Acunetix Scanner

Burp Suite

It is a Java-based web penetration testing system that acts as an interception proxy. The framework has become a go-to tool for the pen testers who want to identify vulnerabilities and detect attack vectors affecting an organization’s web applications. Testers can route their traffic through Burp Suit’s proxy server, which then acts as a gatekeeper recording each request relayed between the developer and the target web application. Testers, then, can pause and analyze every individual request and discover injection points. Its myriad features have made the framework increasingly popular.

Visit Website: Burp Suite

Nessus

It is a remote security-scanning tool that has been in existence for over two decades and used by scores of testers and companies for security purposes. The testing tool carries out over 1,200 checks on a single device in the network and checks if any vulnerabilities can be exploited by hackers to break in. It is one of the best vulnerability scanners out there and suited for experienced testers owing to its complex interface. The tool is adept in detecting software flaws, missing patches, and malware. It narrows down vulnerabilities but does not allow the tester to exploit them.

Visit Website: Nessus

 

Limitations of Penetration Testing 

Even if an organization regularly conducts pen tests, its system will not become foolproof due to certain limitations of the testing process. A pen test cannot eliminate all vulnerabilities, because, at the end of the day, the quality of the test depends on several factors, including the skill set of the testing team. Here are a few drawbacks in pen-testing processes that cast doubts over their overall effectiveness:

Skill and Experience of Testers

Penetration tests can be broadly divided into three sections: network, system, and web. It is highly unlikely that an objective result can be obtained if a tester specializes in one area and has only working knowledge of the other two. Since the dynamics of security structures keep changing at a rapid pace, it is difficult to find someone who is an expert in all three areas. 

Time Constraint

Testers have a given period within which they have to find vulnerabilities, breach the systems, and prepare reports. Attackers are not bound by a time frame. They can plan an attack in leisure and carry it out when the target least expects it. Testers are also burdened with the task of recording every step they take and gather evidence in the form of screenshots and documentation. An attacker, on the other hand, can carry out attacks without being bothered about making diary entries or similar laborious requirements.

Custom Exploits

Not all security systems can be breached using the standard pen-testing framework. Advanced systems need to be cracked by creating a custom attack plan with customized scripts. Writing a custom code is an advanced skill. To avail the services of such highly skilled testers, a company needs to allocate a substantial budget.

Access Limitations

Companies often draw lines that the testers cannot cross. Only certain servers and segments that the organization has allowed to be scrutinized can be attacked by testers. But, in a real-life scenario, attackers are not bound by any contract or restrictions. This limits the actual efficiency of the test and may give the organization a false feeling of the system being watertight.

 

How often Should Penetration Testing be Conducted

Since pen testing is a tedious process, there cannot be a one-size-fits-all approach, and organizations have to look into factors like size, budget, regulations/compliance, company policies, and infrastructure before calling in the “good guys” to hack their system.

Most companies wake up to its need when it is too late. Only after facing a major attack, companies realize the need for thorough system analysis. Post attack, they often burden their IT teams to trace the source, analyze the overall damage, and plug the leak. But, all this can probably be avoided if a pen test is conducted before an attack takes place, thus saving time, effort, and eventually money. 

As networks update their infrastructure, the complexity of threats rises as well. Therefore, a one-time penetration test is an exercise in futility. It is an ongoing process, and, depending on the factors mentioned earlier, organizations need to devise a testing plan that suits their requirements.

Penetration testing is also oftentimes confused with vulnerability scanning and some consider them to be the same concepts. However, the basic difference between the two is that vulnerability scan searches systems and reports on known vulnerabilities, whereas penetration testing is much more aggressive and attacks the organization’s systems and replicates real-life attacks. You may learn more about the differences between the two from our earlier post – vulnerability scanning vs penetration testing.

 

Conclusion

Security experts recommend that all organizations should undergo a penetration test ideally once a year to ensure that their network is in good health. Despite its limitations, pen-testing remains the most efficient way to mimic a real-life attack and test the defense mechanism of the target organization. However, given that it is carried out in a controlled environment and its efficiency is dependent on the testers’ skills, the results of this exercise should be taken with a pinch of salt. Organizations should also understand that pen testing is not an alternative to the existing application security testing system, but it is there to supplement it. The information thus gathered can help companies plan their security budget in a better manner and developers create software/applications that withstand similar attacks in the future.

Govindraj Basatwar
Govindraj Basatwar
Govindraj is a Global Sales Head for AppSealing at INKA Entworks. He keenly follows the innovation and development in cybersecurity, IT, content and application security, and software development, and loves to educate everyone about the what, why, and how of major incidents in the cybersecurity world. His views on industry trends and best practices have been featured in articles, white papers, and had been a keynote guest at multiple security events.

Leave a Comment