Penetration Testing: A 20-Step Guide by Top Security Experts

Most enterprises with online components engage in regular penetration testing, leveraging in-house teams or external organizations to try to breach their website’s defenses. 

The goal of penetration testing is to help you uncover any potential vulnerabilities before attackers can exploit them. At the enterprise level, any vulnerability can lead to data breaches, potential loss of certifications, and even monetary damages.

In this post, we’ll provide you with a comprehensive introduction to the concept of penetration testing. We’ll also share a 20-point guide you can follow if you want to train your team on what the pen testing process looks like. 

What is penetration testing?

Penetration testing, often referred to as “pen testing” or “pentesting”, is a simulated cyberattack against your enterprise network and systems to check for vulnerabilities that can be exploited. Essentially, the process involves assessing your system for potential weaknesses.

These weaknesses could be the result of poor or improper system configuration, known and unknown hardware or software flaws, and operational weaknesses in process or technical countermeasures. 

If done correctly, penetration testing can provide your business with a detailed overview of its system security and identify areas where improvements are needed. Depending on the scope of your network infrastructure, penetration testing can be an incredibly involved process.

For this reason, it’s not uncommon for enterprises to have entire internal teams for pen testing their system security. But, for a lot of businesses, it makes more sense to contract specialized services that focus solely on penetration testing.

Some enterprise businesses also offer “bounties” for discovering bugs and security vulnerabilities. Typically, these bounty programs follow very specific guidelines. In practice, they are a way of outsourcing pen testing.

examples of pen testing options

If your company has never engaged in pen testing, it’s likely that a skilled “white‑hat” hacker or pen tester could find more than one flaw in your systems. Discovering and patching these vulnerabilities in a controlled manner can greatly reduce the instances of future security breaches.

Why is penetration testing important? 

It’s essential for any business to ensure that their network and the services they use are secure. Of course, the importance of penetration testing increases dramatically with the size of the business. Simply put, the more sensitive data involved, the greater the need for comprehensive security audits and tests.

To be more specific, here are some of the main reasons why penetration testing is critical at the enterprise level:

  • It helps identify vulnerabilities before attackers do. Penetration testing simulates a real‑world attack. This enables organizations to identify and fix vulnerabilities before attackers can exploit them.
  • It verifies the effectiveness of defensive mechanisms. Penetration testing assesses the capability of defensive mechanisms and identifies the extent to which your system can protect its data and maintain functionality.
  • To satisfy compliance requirements. Many regulatory standards such as HIPAA, PCI DSS, and ISO 27001 require regular penetration testing to ensure that systems and data are secured.
  • To protect customer data and maintain trust. A security breach can have significant consequences, including damaging your organization’s reputation and losing hard‑won customer trust. Regular penetration testing can prevent breaches and thereby protect your reputation.

It’s also important to note that, to be effective, penetration testing needs to happen regularly. As your system and network evolves, new security weaknesses will come to light. That’s something that happens in every company.

An ongoing pentesting program will help you uncover new security issues before attackers can exploit them. Whether you opt for in‑house pen testing or outsource this task may depend on your organization’s budget, structure, and human capital.

What are the different types of pen tests?

There are multiple ways in which an organization can approach penetration testing. Which method you opt for will depend on what kind of security breach you want to test your website against. The most common types of penetration tests include:

  • White box pen tests. This is a comprehensive testing method where the tester is given full knowledge of the system being tested, including the source code, IP addresses, network infrastructure diagrams, and other necessary details. This approach is used to perform a thorough examination and identify vulnerabilities that may not be immediately obvious.
  • Black box pen tests. In black box tests, the tester is given no prior knowledge of the system that’s being tested. They must first gather information about the target and identify possible entry points. This simulates an attack from a malicious outsider who doesn’t have access to any prior knowledge of the system.
  • Gray box pen tests. This is a blend of both black and white box testing. The tester is given some information about the system, but not everything. Gray box testing is typically used to simulate an attack from someone with limited knowledge of the system, such as a user or a low‑privileged employee. It’s particularly useful for identifying vulnerabilities that could be exploited after an initial point of access is breached.

Executing different types of pen tests is the best way to protect your company against security breaches. When possible, it’s a good idea to schedule different types of tests to run regularly. If you’re working with an outside pen testing service, they should be able to adapt to whatever type of testing your network requires.

A 20‑step guide to penetration testing

In this section, we’re going to break down the process of a generic penetration test that you can adapt to your company’s needs. This is a three‑part process, involving preparation, testing, and patching any vulnerabilities you find.

Preparation for penetration testing

Before you can begin penetration testing, it’s crucial to understand the depth and breadth of your project — this is the “preparation” phase. You’ll want to begin by defining the scope and laying the foundation. Now, let’s go over some key steps in doing that.

1. Define the scope of the penetration test

The very first step in preparing for a pen test is to define its scope. This includes identifying the systems, networks, and/or applications that will be included in the test. 

The scope should be agreed upon by all parties involved. Furthermore, it’s crucial to ensure that the test doesn’t inadvertently affect systems or data that fall outside the boundaries of the test. 

Here are some basic considerations to keep in mind when defining the scope of your project:

  • What are the objectives of the test? For instance, are you looking for any and all security issues, or are you focused on specific areas, such as compliance with certain standards?
  • Which systems, networks, or applications will be tested? Not every test needs to cover the entirety of your organization’s network. You might, for example, want to conduct a test of your site’s ecommerce functionality without digging into the other parts of it.
  • Which types of attacks will be included? For example, will you only perform technical attacks, or will you also include social engineering attacks?

This part of the process is essential because it helps establish expectations and keeps the testing process from derailing. The better defined the scope, the more likely it is that the testing will return a comprehensive report.

two people working on paperwork

2. Obtain signed consent and legal agreements

Before beginning a penetration test, it’s crucial to obtain signed consent from all relevant parties. This typically includes stakeholders and any outside parties involved in the testing process. The consent should explicitly state what’s being tested, what techniques will be used, and the potential risks this type of test carries.

Additionally, you may need to put legal agreements in place, such as non‑disclosure agreements (NDAs). These protect confidential information that may be exposed during the test. The agreements should also clarify issues such as liability in the event of damage or disruption caused by the test.

This is particularly important if you decide to contract outside pen testing services. Having NDAs in place will prevent third‑party testers from divulging any vulnerabilities they uncover during the process.

3. Gather information on infrastructure and technologies

Once the scope of the test is defined and the necessary consent forms and agreements are in place, the next step is to gather information on the infrastructure and technologies that will be tested. This might include:

  • Network architectures. This means network diagrams, IP addressing schemes, etc.
  • Details about the systems and applications. This information includes data on the operating systems the network uses, the software you rely on, software versions, etc.
  • Available user accounts or credentials. It’s important to define which user accounts have access to the parts of the system you intend on testing. This helps identify potential sources of human error.

This information gathering phase is sometimes referred to as “reconnaissance”. It can also involve techniques like passive scanning or looking up any available public information concerning your organization and its structure.

4. Identify the attack surface of the website or web app

The attack surface of a system is the sum of all the different points where an attacker could potentially get in or data could get out. In the case of a website or web app, the attack surface might include:

  • Pages or endpoints that accept user input. Open endpoints can potentially be exploited using techniques like SQL injection or XSS.
  • API endpoints. These endpoints can potentially be used by attackers to gain access to the system or to gain privileged information.
  • Authentication mechanisms. If your website’s authentication mechanisms don’t use security features such as two‑factor authentication (2FA) they can potentially be bypassed.
  • Cookies or session data. Cookies can be intercepted or manipulated to hijack a user session if they’re not protected.
  • Hidden directories or outdated files. If attackers can access these directories and files, they might be able to obtain sensitive information or gain insight into how to penetrate your site.

By identifying all of these possible points of attack, you can ensure that your pen test is comprehensive and doesn’t overlook any potential vulnerabilities.

Executing penetration testing

After you’ve completed the preparation phase, you’re ready for phase two, which involves identifying and validating potential threats. 

5. Perform vulnerability scanning to identify flaws

You’ll want to begin this more active stage of penetration testing by performing vulnerability scans to identify flaws.

WPScan homepage

If you’re not familiar with this approach, vulnerability scanning typically involves automated tools, such as WPScan. These tools are designed to cross-reference your systems against an updated database of known vulnerabilities, providing an insightful report of potential security flaws. 

Before performing a scan, you need to ensure that the scanner’s database is updated with the latest known vulnerabilities. Additionally, the scanning process should be carefully timed to occur during a period that minimally impacts your operations. Scanning reports should be adapted based on your specific infrastructure details.

6. Conduct manual testing to validate the flaws

After running automated vulnerability scans, it’s a good idea to conduct manual testing to validate the flaws found during the previous step. The goal of this process is to rule out any false positives.

Manual testing involves a meticulous process of confirming discovered vulnerabilities and searching for issues that the automated tools might have overlooked. Exploiting the discovered vulnerabilities manually can help determine the actual risk associated with them. 

7. Assess the security of APIs, plugins, and integrations

The security of any system is only as strong as its weakest link. That means, the use of third‑party code, APIs, or plugins can introduce vulnerabilities into your systems.

Usually, organizations don’t have access to the source code for most of the third‑party tools they use. This limits their ability to assess the security standards of these tools. Even so, it’s possible to test their security using probing methods. This way, you can ensure your organization doesn’t put sensitive information at risk by using them.

Assessing third‑party tools involves first reviewing the configuration and permissions associated with them. Then, you’ll test them for known vulnerabilities and evaluate the security measures used during data transmission and storage.

8. Analyze the source code, logic, and dependencies

Static application security testing (SAST), commonly known as a code review, involves a deep dive into an application’s source code, dependencies, and application logic. It’s a highly beneficial component in identifying potential security missteps in any tools you use.

This process involves scrutinizing the source code for common security issues (such as code injection vulnerabilities), analyzing the application logic to detect potential security flaws, and examining dependencies, like libraries and frameworks, for known vulnerabilities.

If you don’t have access to the source code for a tool, you’re limited in how much you can test it. As we mentioned, most third‑party services don’t provide access to the source code.

But in the case of WordPress tools, such as plugins, you’re free to analyze their source code in its entirety. This is because WordPress uses an open‑source license that applies to derivative software, which means you can analyze and modify its code in any way you see fit.

9. Evaluate resilience to a DDoS attack

Understanding if your system is capable of handling a distributed denial of service (DDoS) or brute force attack can be crucial in preparing for potential cybersecurity threats. DDoS attacks overwhelm a system with traffic, causing it to be inaccessible. 

You can test your network’s preparedness with a stress test. This involves overloading the network with traffic and seeing if it starts to slow down, drop packets noticeably, or demonstrate any other secondary effect that impacts how it works and limits access.

While conducting a DDoS stress test, it’s important to ensure that the process does not disrupt regular operations. This process should be carried out with caution and after securing prior permissions.

10. Test the authentication and authorization process

Authentication and authorization mechanisms ensure only that validated users access your system and only the resources necessary for their role. In the context of penetration testing, it’s important to verify these mechanisms for their strength and reliability.

Attempting to bypass login systems, scrutinizing password policies, and assessing the handling of password resets are parts of the testing process. Authorization testing involves validating that users can only reach the resources to which they are granted access. 

Typically, this process includes checking for any potential horizontal and vertical privilege escalation and ensuring that the application manages sessions correctly. Otherwise, users might be able to get access to privileges outside of their roles.

11. Identify user accounts, roles, and permissions

User roles — such as admin, user, and guest — are defined with specific permissions in any system. As part of penetration testing, it’s necessary to verify that these roles are appropriately segregated and that one role can’t access resources designed for another.

dropdown of WordPress user roles

This is one of the most common security issues that pen testers find in organizations. In practice, no user should have an account that has more privileges than are needed to carry out their tasks. 

If users have access to elevated levels of permissions, they can cause a lot of damage inadvertently. For example, an employee might accidentally delete key files in a website or modify a page they shouldn’t have access to. Testing for this can help strengthen the security posture of your system.

12. Target users with social engineering attacks

Social engineering involves bypassing traditional network attack methods and trying to gain access through the human element. If you run a large organization, you’ve probably trained employees on how to deal with spam messages, particularly ones that request any type of access or privileged information. Those messages are a rudimentary form of social engineering.

Typically, social engineering involves pretending you’re a member of an organization or someone that should logically have access to it. Pen testers will communicate with your employees, pretending to be either coworkers or third parties, and try to get access to information or parts of the system they shouldn’t be able to get into.

Social engineering is one of the most common methods of attack, particularly at the enterprise level. If attackers can’t break into the system using vulnerabilities and security exploits, the next best route is to try and deceive their way in.

To avoid this type of attack, you’ll need to train members of your organization on how to recognize social engineering and what to do if they find themselves being targeted. Typically, the best course of action is to ignore the communication attempts, but log them or inform superiors about them.

Patching vulnerabilities found through penetration testing

Once you’ve identified security weaknesses and threats, you’re still not done. Now, you’re ready to close your security gaps and strengthen your defenses.

13. Attempt to exploit each identified vulnerability

If penetration testing helps you identify vulnerabilities in your system, you’ll need to test them. That applies whether the vulnerabilities are uncovered using automated or manual testing. 

In some scenarios, vulnerabilities that you run into might be hard to reproduce. That’s often because they only occur under very specific scenarios. This “re‑testing” process can help you determine which vulnerabilities need patching and which ones need further testing to determine their severity.

This may involve leveraging known exploits, writing custom exploit code, or using automated tools. During this stage, caution should be taken to ensure that exploitation attempts don’t cause unnecessary disruption to the operational environment.

14. Assess the severity and impact of each exploit

After successful exploitation, the penetration tester needs to assess the severity and impact of each vulnerability. Severity refers to the potential kind of damage that could be inflicted if an attacker exploits the vulnerability, whereas impact refers to the extent of harm that would result from this exploitation.

This evaluation often includes considerations like data loss, system downtime, reputational damage, regulatory fines, and the resources needed for remediation. Simply put, some vulnerabilities are more dangerous than others.

Assessing severity will help you plan a course of action. That means determining which security issues you need to address first and planning the resources you’ll devote to them.

15. Assess the organization’s incident response processes

This includes assessing how well the organization’s security team detects and responds to the simulated attacks. It helps determine whether the organization’s incident response plan is effective, if security alerts and logs are properly managed, and whether security teams are prepared to handle real‑world security incidents.

If your organization doesn’t have an incident response process, now is the time to implement one. Having processes in place prepares everyone for security incidents. Eventually, every enterprise faces one.

The more detailed the process is, the better your team’s response will be. Moreover, you can also re‑adjust the process depending on how your team reacts to simulated or real world attacks.

16. Document each vulnerability and its severity

Documentation is an essential part of a pen test. Each identified vulnerability, along with its severity and impact, should be documented. 

The documentation should provide clear and detailed information about where and how the vulnerability was found, the potential risks if it’s not addressed, and suggested remediation steps. 

This information will be used to generate the final report. The more detailed the documentation is, the more it can help you optimize response processes and teach employees how to deal with similar issues.

17. Create guidelines to resolve each vulnerability

After the vulnerabilities are documented, the penetration tester should provide clear and actionable recommendations to remediate each identified vulnerability. These remediation guidelines can include specific steps to mitigate the vulnerability, such as patching software, reconfiguring systems, changing security policies, or improving security controls. 

woman working on a stack of papers

These recommendations need to be tailored to the organization’s environment and capabilities. If you’re working with an external pen testing service, you may need to work with them to discuss potential limitations due to the organization’s structure and come up with alternative solutions.

Internal testing teams will have a better idea of how to approach and fix each vulnerability based on their experience with your systems and networks. If your organization is currently outsourcing pen tests, it might be worth considering bringing the process in‑house at some point in the future.

18. Verify vulnerability fixes and retest the exploits

Once the identified vulnerabilities have been addressed, it’s important to verify the fixes and retest the exploits. This process ensures that the remediation efforts have been successful and that the vulnerabilities are no longer present.

For this testing to be effective, you need to replicate the original penetration tests as closely as possible. This is to ensure that you’re reproducing the same circumstances in which the exploits were discovered and to ensure the vulnerability is truly patched.

If the vulnerabilities persist when you’re retesting the exploits, it means the recommendations made in the pen testers’ reports may not be adequate. That means you’ll need to replicate the security issue and come up with alternative solutions.

19. Document a final penetration testing report

The final step in the penetration testing process is to compile and deliver a final report. This report should include all the vulnerabilities that were identified, their severity and impact, the exploitation attempts, and the recommendations for remediation. It should also provide an overview of the organization’s incident response capabilities and any areas that need improvement.

This report marks the end of the penetration testing cycle. Your organization should refer to this report when implementing solutions for vulnerabilities and when analyzing the potential causes behind them. That means it needs to be as detailed as possible and get into the hands of every stakeholder involved in your organization’s security team.

20. Implement real‑time vulnerability monitoring

After the penetration test, it’s important for the organization to implement real-time vulnerability monitoring. This process involves regularly scanning the environment for vulnerabilities and monitoring system logs and security alerts for any signs of potential attacks. 

How you decide to implement real‑time vulnerability monitoring will depend on how your organization is structured. Enterprise organizations using WordPress should use the continuously‑updated database provided by WPScan. Small businesses and individuals could use Jetpack Protect, which draws information from the same WPScan database.

Real-time monitoring helps you identify vulnerabilities as soon as they appear — a key to a proactive security approach. 

Frequently asked questions 

By now, you likely have a good command of penetration testing. But, if you have any lingering doubts on the matter, this section will answer them. 

Is penetration testing the same as ethical hacking?

Yes, the terms “penetration testing” and “ethical hacking” are often used interchangeably, but there are slight differences in their connotations.

Ethical hacking is a broader concept that encompasses all activities performed by security professionals to identify and fix vulnerabilities in systems, networks, and applications. It’s conducted by “ethical hackers” who are authorized to perform security assessments. Ethical hacking includes using various methods to test and improve security, such as vulnerability scanning, penetration testing, social engineering, and more.

On the other hand, pen testing is a specific type of ethical hacking that involves simulating cyberattacks on a computer system, network, or web application to identify vulnerabilities that could be exploited by attackers. Pen tests are one of many techniques that an ethical hacker might use to assess the security of a system.

What tools and resources do penetration testers typically use?

Penetration testers use a variety of tools and resources to identify vulnerabilities and assess security. These pen testing tools often include software designed to automate certain tasks, scripts to exploit known vulnerabilities, and frameworks for conducting a wide variety of tests.

Some common examples of pen testing tools you might find in a pen tester’s toolkit include packet sniffers, network mappers, and password‑cracking software.

What are common website vulnerabilities that penetration tests uncover?

Penetration tests often uncover a variety of security weaknesses in websites. Some of the most common include:

  • SQL injections. This occurs when an attacker inserts malicious SQL code into a query. It’s one of the most dangerous vulnerabilities, as it can allow an attacker to view, manipulate, and delete data in the backend database.
  • Cross‑site scripting (XSS). This vulnerability allows an attacker to inject malicious scripts into web pages viewed by other users. A successful XSS attack can lead to the attacker hijacking user sessions, defacing websites, or redirecting the user to malicious sites.
  • Cross‑site request forgery (CSRF). CSRF tricks the victim into submitting a malicious request. It uses the identity and privileges of the victim to perform an undesired function on their behalf.
  • Unvalidated redirects and forwards. These flaws can be used to force users to perform undesired actions or visit malicious websites without their knowledge.
  • Command injections. These occur when an application allows user‑supplied input within a command it executes. An attacker can manipulate the command to make the system perform undesired actions.
  • Server‑side request forgery (SSRF). An SSRF vulnerability allows an attacker to make requests to internal resources that should not be accessible, leading to data exposure or remote command execution.

These are just a few examples. There are many other potential vulnerabilities in web applications, and new ones are being discovered all the time. That’s why regular and thorough testing is crucial to maintain the security of a website.

How often should I conduct a pen test to maintain security?

The frequency of penetration testing should depend on various factors such as the size of the organization, the complexity of the network, and the type of data being protected.

Large organizations with complex networks and systems might consider quarterly or bi‑annual penetration testing. These tests should generate security reports that can be acted on quickly to patch any vulnerabilities they discover.

two people working on a laptop

What types of reports can I expect after a penetration test?

The type of report that you get after a pen test will depend on the kind of test that was conducted and whether it was carried out by an in‑house team or an external organization.

Typically, pentesters will deliver a full report that includes a breakdown of the ways in which they tried to breach the company’s security. They’ll inform you which methods succeeded, if any, and also include a summary that outlines all the uncovered vulnerabilities and their suggestions for how to “patch” them.

WPScan: Vulnerability scanning for enterprise WordPress websites

Vulnerability scanning is a key step in any penetration testing process. How you carry out this type of scan will depend on what kind of system your organization works with.

If you use WordPress, you can employ a tool such as WPScan. WPScan maintains the largest database of WordPress vulnerabilities. Developers, pen testers, and other security experts contribute to this open‑source database, which means it’s always up‑to‑date with the latest vulnerabilities that can affect WordPress sites.

WPScan information page

You can leverage WPScan using the CLI Scanner tool. This is a command line tool that enables you to connect to the database and scan your website to see if it detects any matches for known vulnerabilities.

Leverage penetration testing to secure your network

When most people hear about penetration testing, they might think about giant tech enterprises and massive online businesses. The truth is, pen testing can benefit enterprises at any level. As your business grows, the benefits of regular pen testing multiply. This is because any vulnerability can lead to potentially catastrophic security breaches.

If you want to carry out pen testing with an in‑house team, you can use a comprehensive guide to help you navigate the process. You’ll need to start with preparation, move on to identifying vulnerabilities, and wrap up by improving your security defenses.

Posted by

Get News and Tips From WPScan

Blog at WordPress.com.