Penetration Testing 101 | TryHackMe Pentesting Fundamentals
Introduction
Before diving into the technical, hands-on aspects of ethical hacking, it’s important to first understand the responsibilities of a penetration tester and the processes involved in conducting penetration tests (pentests). These tests focus on identifying vulnerabilities in a client’s application or system.
Cybersecurity is increasingly relevant in every area of life, as we often hear about hacks or data breaches in the news. It affects everyone, from individuals needing strong password policies to protect their emails, to businesses and organizations that must safeguard their devices and data from potential threats.
A penetration test, or pentest, is an ethical method used to evaluate and analyze the security measures in place to protect such assets and information. This process involves using the same tools, techniques, and methods that a malicious actor might use, making it somewhat similar to a security audit.
As noted by Security Magazine, there are over 2,200 cyberattacks daily — equivalent to one attack every 39 seconds. This underscores the importance of cybersecurity and penetration testing in today’s digital world.
The Ethics of Penetration Testing
The legal and ethical landscape of cybersecurity, particularly in penetration testing, is often a complex and controversial area. Terms like “hacking” and “hacker” typically evoke negative perceptions, largely due to their portrayal in popular culture and the actions of a few malicious individuals. This makes the idea of legally accessing a computer system seem counterintuitive — so what exactly makes it legal?
A penetration test is, by definition, an authorized evaluation of a system’s security, approved by the system’s owners. The legality of such tests is straightforward: anything outside the agreed-upon scope is considered unauthorized and illegal.
Before any penetration test begins, the penetration tester and the system owner have a formal discussion to define the scope. This includes agreeing on the specific tools, techniques, and systems that will be tested. This agreement establishes the boundaries within which the test will be conducted and ensures legal compliance.
Companies offering penetration testing services must also operate within legal frameworks and industry standards. For instance, the UK’s National Cyber Security Centre (NCSC) has the CHECK accreditation program, which ensures that only accredited companies can legally conduct penetration tests on public sector and critical national infrastructure (CNI) systems.
While legality is clear-cut, ethics often presents a more nuanced challenge. Ethics involves the moral evaluation of right and wrong, and some actions, though legal, may conflict with a penetration tester’s personal values.
Penetration testers may encounter ethically ambiguous situations, such as accessing sensitive data within a database or executing a phishing attack on an employee to assess human vulnerabilities. While these actions are legal if part of the agreed scope, they may still feel ethically uncomfortable.
Hackers are often categorized into three “hats” based on their ethical stance and motivations:
Understanding the ethical and legal distinctions in cybersecurity is critical for penetration testers, as they must navigate both legality and personal ethics in their work.
Rules of Engagement (ROE)
The Rules of Engagement (ROE) is a critical document created at the start of a penetration testing engagement. It sets the guidelines and boundaries for how the penetration test will be conducted. This document typically contains three main sections, each responsible for outlining essential aspects of the test to ensure that both legal and ethical parameters are respected.
Here’s an explanation of the typical sections included in an ROE document:
These sections collectively determine how the penetration test will be carried out, ensuring that all parties understand and agree on the boundaries, tools, and goals of the engagement.
For more in-depth examples of ROE documents, the SANS Institute provides a comprehensive template that can be accessed online. It’s an excellent resource for seeing how these elements are structured in practice.
Penetration Testing Methodologies
Penetration tests can target a broad range of systems, applications, and objectives, making each test unique. There is no universal approach that fits all scenarios. The specific steps a penetration tester follows during an engagement are referred to as the methodology, and an effective methodology is one that is tailored to the situation.
For example, the steps taken to assess the security of a web application would be vastly different from those used to test the security of a network. A well-designed methodology takes into account the specific target, its environment, and the particular vulnerabilities that might be present.
Here are some common types of penetration testing, each requiring a unique methodology:
In each case, the penetration tester must select tools and techniques that align with the specific context of the test. An adaptable, situation-specific methodology ensures that the engagement is both effective and relevant to the security goals of the organization.
OSSTMM
The Open Source Security Testing Methodology Manual (OSSTMM) offers a comprehensive framework of testing strategies that cover various aspects of cybersecurity, including systems, software, applications, and even the human element. This methodology is designed to assess the security of how these components interact and communicate, ensuring a thorough evaluation of potential vulnerabilities.
Key areas of focus in the OSSTMM include:
领英推荐
By using the OSSTMM framework, penetration testers can systematically test the communication pathways and interactions between systems, ensuring a holistic approach to security.
OWASP
The Open Web Application Security Project (OWASP) is a community-driven framework specifically designed for testing the security of web applications and services. This framework is widely recognized and frequently updated to reflect the evolving landscape of web security threats.
OWASP’s primary goal is to help organizations identify and mitigate common security vulnerabilities in web applications. A key resource produced by OWASP is the OWASP Top Ten, which is a regularly updated report that highlights the most critical security risks faced by web applications. This report not only lists these vulnerabilities but also provides:
The OWASP framework is an essential tool for developers, security professionals, and penetration testers alike, as it focuses solely on securing web applications and services. The constantly evolving nature of OWASP’s reports and resources ensures that organizations can stay up to date with the latest threats and security practices in the world of web security.
NIST Cybersecurity Framework 1.1
The Cyber Assessment Framework (CAF) is a comprehensive tool designed to assess the risks posed by various cyber threats and evaluate an organization’s defenses against them. It is structured around fourteen key principles and is specifically aimed at organizations providing “vitally important services and activities,” such as critical infrastructure, banking, and other essential sectors.
The CAF helps organizations ensure their systems are robust against potential cyber threats by focusing on several critical areas:
The CAF is a vital tool for organizations that operate critical services, helping them to identify potential weaknesses in their cybersecurity posture and implement effective strategies to manage and mitigate risks.
Scopes of Penetration Testing
Black-Box Testing
In Black-Box Testing, the tester has no knowledge of the internal structure, workings, or code of the application or service being tested. The tester interacts with the application as an ordinary user would, focusing on functionality and the user interface, such as clicking buttons and verifying whether the application responds as expected. Since no programming or deep system knowledge is required, the tester evaluates the system purely from an external perspective.
This type of testing can significantly extend the time spent during the information gathering and enumeration phase, as the tester needs to discover the application’s attack surface without any prior insight into its inner workings.
Grey-Box Testing
Grey-Box Testing combines elements of both black-box and white-box testing, making it a popular approach for penetration testing. In this method, the tester is given partial knowledge of the internal structure of the application, but they still interact with the system in a manner similar to black-box testing. The tester uses this limited knowledge to better understand the system’s behavior and potential vulnerabilities, enabling more focused testing and problem resolution.
This approach saves time compared to black-box testing, as the partial knowledge allows for more efficient identification of vulnerabilities. Grey-box testing is particularly useful for systems with well-hardened attack surfaces, where the extra insight into the application helps pinpoint weaknesses more effectively.
White-Box Testing
White-Box Testing is a thorough and detailed testing process, typically carried out by someone with programming knowledge and a deep understanding of the application’s internal structure. The tester evaluates the software’s internal components, such as code, logic, and specific functions, to ensure everything operates correctly and efficiently.
Unlike black-box testing, the tester in a white-box scenario has complete knowledge of the system, making it a more time-consuming but comprehensive process. This method ensures the entire attack surface is thoroughly validated, providing a higher level of assurance that the system is secure and functioning as expected.
Room Answers | TryHackMe Pentesting Fundamentals
Room answers can be found here.
Watch Also