6. Penetration Testing Process

Process - Term for directed sequence of events. In operational/organizational context: Processes are referred to more precisely as work, business, production, or value creation processes.

Deterministic Process - Each state is casually dependent on, and determined by the previous states and events. Stochastic Process - One state follows from other states only with a certain probability.

We use the definition of the penetration testing process from the social sciences to represent `a course of events connected` with `deterministic processes`. This is because all of our steps are based on the events and results we can discover or provoke.

A penetration testing process is defined by successive steps and events performed by the penetration tester to find a path to the predefined objective.

Information Gathering

Information gathering describes how we obtain information about the necessary components in various ways. We search for information about the target company and the software and hardware in use to find potential security gaps that we may be able to leverage for a foothold.

Vulnerability Assessment

Once we get to the Vulnerability Assessment stage, we analyze the results from our Information Gathering stage, looking for known vulnerabilities in the systems, applications, and various versions of each to discover possible attack vectors. Vulnerability assessment is the evaluation of potential vulnerabilities, both manually and through automated means. This is used to determine the threat level and the susceptibility of a company's network infrastructure to cyber-attacks.

Exploitation

In the Exploitation stage, we use the results to test our attacks against the potential vectors and execute them against the target systems to gain initial access to those systems.

Post-Exploitation

At this stage of the penetration test, we already have access to the exploited machine and ensure that we still have access to it even if modifications and changes are made. During this phase, we may try to escalate our privileges to obtain the highest possible rights and hunt for sensitive data such as credentials or other data that the client is concerned with protecting (pillaging). Sometimes we perform post-exploitation to demonstrate to a client the impact of our access. Other times we perform post-exploitation as an input to the lateral movement process described next.

Lateral Movement

Lateral movement describes movement within the internal network of our target company to access additional hosts at the same or a higher privilege level. It is often an iterative process combined with post-exploitation activities until we reach our goal. For example, we gain a foothold on a web server, escalate privileges and find a password in the registry. We perform further enumeration and see that this password works to access a database server as a local admin user. From here, we can pillage sensitive data from the database and find other credentials to further our access deeper into the network. In this stage, we will typically use many techniques based on the information found on the exploited host or server.

Proof-of-Concept

In this stage, we document, step-by-step, the steps we took to achieve network compromise or some level of access. Our goal is to paint a picture of how we were able to chain together multiple weaknesses to reach our goal so they can see a clear picture of how each vulnerability fits in and help prioritize their remediation efforts. If we don't document our steps well, it's hard for the client to understand what we were able to do and, thus, makes their remediation efforts more difficult. If feasible, we could create one or more scripts to automate the steps we took to assist our client in reproducing our findings. We cover this in-depth in the Documentation & Reporting module.

Post-Engagement

During post-engagement, detailed documentation is prepared for both administrators and client company management to understand the severity of the vulnerabilities found. At this stage, we also clean up all traces of our actions on all hosts and servers. During this stage, we create the deliverables for our client, hold a report walkthrough meeting, and sometimes deliver an executive presentation to target company executives or their board of directors. Lastly, we will archive our testing data per our contractual obligations and company policy. We will typically retain this data for a set period or until we perform a post-remediation assessment (retest) to test the client's fixes.

Stage Description
1. Pre-Engagement The first step is to create all the necessary documents in the pre-engagement phase, discuss the assessment objectives, and clarify any questions.
2. Information Gathering Once the pre-engagement activities are complete, we investigate the company's existing website we have been assigned to assess. We identify the technologies in use and learn how the web application functions.
3. Vulnerability Assessment With this information, we can look for known vulnerabilities and investigate questionable features that may allow for unintended actions.
4. Exploitation Once we have found potential vulnerabilities, we prepare our exploit code, tools, and environment and test the webserver for these potential vulnerabilities.
5. Post-Exploitation Once we have successfully exploited the target, we jump into information gathering and examine the webserver from the inside. If we find sensitive information during this stage, we try to escalate our privileges (depending on the system and configurations).
6. Lateral Movement If other servers and hosts in the internal network are in scope, we then try to move through the network and access other hosts and servers using the information we have gathered.
7. Proof-of-Concept We create a proof-of-concept that proves that these vulnerabilities exist and potentially even automate the individual steps that trigger these vulnerabilities.
8. Post-Engagement Finally, the documentation is completed and presented to our client as a formal report deliverable. Afterward, we may hold a report walkthrough meeting to clarify anything about our testing or results and provide any needed support to personnel tasked with remediating our findings.

Pre-Engagement

Stage of prep for actual pentest. During this stage, many questions are asked and boundaries are set. Some contractual agreements are made. Client informs us about what they want to be tested and we explain in detail how to make the test as efficient as possible.

  1. Scoping questionnaire
  2. Pre-Engagement meeting
  3. Kick-off meeting

NDAs

Type Description
Unilateral NDA This type of NDA obligates only one party to maintain confidentiality and allows the other party to share the information received with third parties.
Bilateral NDA In this type, both parties are obligated to keep the resulting and acquired information confidential. This is the most common type of NDA that protects the work of penetration testers.
Multilateral NDA Multilateral NDA is a commitment to confidentiality by more than two parties. If we conduct a penetration test for a cooperative network, all parties responsible and involved must sign this document.

Exceptions can be made in urgent cases where we jump into the kick-off meeting.

It's essential to know who in the company is permitted to contract us for a penetration test.

Chief Executive Officer (CEO) Chief Technical Officer (CTO) Chief Information Security Officer (CISO)
Chief Security Officer (CSO) Chief Risk Officer (CRO) Chief Information Officer (CIO)
VP of Internal Audit Audit Manager VP or Director of IT/Information Security

7 essential Important documents that dictate a penetration test:

|Document|Timing for Creation| |1. Non-Disclosure Agreement (NDA)|After Initial Contact| |2. Scoping Questionnaire|Before the Pre-Engagement Meeting| |3. Scoping Document|During the Pre-Engagement Meeting| |4. Penetration Testing Proposal (Contract/Scope of Work (SoW))|During the Pre-engagement Meeting| |5. Rules of Engagement (RoE)|Before the Kick-Off Meeting| |6. Contractors Agreement (Physical Assessments)|Before the Kick-Off Meeting| |7. Reports|During and after the conducted Penetration Test|

These documents should be reviewed and adapted by a lawyer after they have been prepared.

Scoping Questionnaire

After initial contact is made with the client, we typically send them a Scoping Questionnaire to better understand the services they are seeking. This scoping questionnaire should clearly explain our services and may typically ask them to choose one or more from the following list:

☐ Internal Vulnerability Assessment ☐ External Vulnerability Assessment
☐ Internal Penetration Test ☐ External Penetration Test
☐ Wireless Security Assessment ☐ Application Security Assessment
☐ Physical Security Assessment ☐ Social Engineering Assessment
☐ Red Team Assessment ☐ Web Application Security Assessment

Aside from the assessment type, client name, address, and key personnel contact information, some other critical pieces of information include:

How many expected live hosts?
How many IPs/CIDR ranges in scope?
How many Domains/Subdomains are in scope?
How many wireless SSIDs in scope?
How many web/mobile applications? If testing is authenticated, how many roles (standard user, admin, etc.)?
For a phishing assessment, how many users will be targeted? Will the client provide a list, or we will be required to gather this list via OSINT?
If the client is requesting a Physical Assessment, how many locations? If multiple sites are in-scope, are they geographically dispersed?
What is the objective of the Red Team Assessment? Are any activities (such as phishing or physical security attacks) out of scope?
Is a separate Active Directory Security Assessment desired?
Will network testing be conducted from an anonymous user on the network or a standard domain user?
Do we need to bypass Network Access Control (NAC)?

Contract - Checklist

Checkpoint Description
☐ NDA Non-Disclosure Agreement (NDA) refers to a secrecy contract between the client and the contractor regarding all written or verbal information concerning an order/project. The contractor agrees to treat all confidential information brought to its attention as strictly confidential, even after the order/project is completed. Furthermore, any exceptions to confidentiality, the transferability of rights and obligations, and contractual penalties shall be stipulated in the agreement. The NDA should be signed before the kick-off meeting or at the latest during the meeting before any information is discussed in detail.
☐ Goals Goals are milestones that must be achieved during the order/project. In this process, goal setting is started with the significant goals and continued with fine-grained and small ones.
☐ Scope The individual components to be tested are discussed and defined. These may include domains, IP ranges, individual hosts, specific accounts, security systems, etc. Our customers may expect us to find out one or the other point by ourselves. However, the legal basis for testing the individual components has the highest priority here.
☐ Penetration Testing Type When choosing the type of penetration test, we present the individual options and explain the advantages and disadvantages. Since we already know the goals and scope of our customers, we can and should also make a recommendation on what we advise and justify our recommendation accordingly. Which type is used in the end is the client's decision.
☐ Methodologies Examples: OSSTMM, OWASP, automated and manual unauthenticated analysis of the internal and external network components, vulnerability assessments of network components and web applications, vulnerability threat vectorization, verification and exploitation, and exploit development to facilitate evasion techniques.
☐ Penetration Testing Locations External: Remote (via secure VPN) and/or Internal: Internal or Remote (via secure VPN)
☐ Time Estimation For the time estimation, we need the start and the end date for the penetration test. This gives us a precise time window to perform the test and helps us plan our procedure. It is also vital to explicitly ask how time windows the individual attacks (Exploitation / Post-Exploitation / Lateral Movement) are to be carried out. These can be carried out during or outside regular working hours. When testing outside regular working hours, the focus is more on the security solutions and systems that should withstand our attacks.
☐ Third Parties For the third parties, it must be determined via which third-party providers our customer obtains services. These can be cloud providers, ISPs, and other hosting providers. Our client must obtain written consent from these providers describing that they agree and are aware that certain parts of their service will be subject to a simulated hacking attack. It is also highly advisable to require the contractor to forward the third-party permission sent to us so that we have actual confirmation that this permission has indeed been obtained.
☐ Evasive Testing Evasive testing is the test of evading and passing security traffic and security systems in the customer's infrastructure. We look for techniques that allow us to find out information about the internal components and attack them. It depends on whether our contractor wants us to use such techniques or not.
☐ Risks We must also inform our client about the risks involved in the tests and the possible consequences. Based on the risks and their potential severity, we can then set the limitations together and take certain precautions.
☐ Scope Limitations & Restrictions It is also essential to determine which servers, workstations, or other network components are essential for the client's proper functioning and its customers. We will have to avoid these and must not influence them any further, as this could lead to critical technical errors that could also affect our client's customers in production.
☐ Information Handling HIPAA, PCI, HITRUST, FISMA/NIST, etc.
☐ Contact Information For the contact information, we need to create a list of each person's name, title, job title, e-mail address, phone number, office phone number, and an escalation priority order.
☐ Lines of Communication It should also be documented which communication channels are used to exchange information between the customer and us. This may involve e-mail correspondence, telephone calls, or personal meetings.
☐ Reporting Apart from the report's structure, any customer-specific requirements the report should contain are also discussed. In addition, we clarify how the reporting is to take place and whether a presentation of the results is desired.
☐ Payment Terms Finally, prices and the terms of payment are explained.

Rules of Engagement - Checklist

Checkpoint Contents
☐ Introduction Description of this document.
☐ Contractor Company name, contractor full name, job title.
☐ Penetration Testers Company name, pentesters full name.
☐ Contact Information Mailing addresses, e-mail addresses, and phone numbers of all client parties and penetration testers.
☐ Purpose Description of the purpose for the conducted penetration test.
☐ Goals Description of the goals that should be achieved with the penetration test.
☐ Scope All IPs, domain names, URLs, or CIDR ranges.
☐ Lines of Communication Online conferences or phone calls or face-to-face meetings, or via e-mail.
☐ Time Estimation Start and end dates.
☐ Time of the Day to Test Times of the day to test.
☐ Penetration Testing Type External/Internal Penetration Test/Vulnerability Assessments/Social Engineering.
☐ Penetration Testing Locations Description of how the connection to the client network is established.
☐ Methodologies OSSTMM, PTES, OWASP, and others.
☐ Objectives / Flags Users, specific files, specific information, and others.
☐ Evidence Handling Encryption, secure protocols
☐ System Backups Configuration files, databases, and others.
☐ Information Handling Strong data encryption
☐ Incident Handling and Reporting Cases for contact, pentest interruptions, type of reports
☐ Status Meetings Frequency of meetings, dates, times, included parties
☐ Reporting Type, target readers, focus
☐ Retesting Start and end dates
☐ Disclaimers and Limitation of Liability System damage, data loss
☐ Permission to Test Signed contract, contractors agreement