A penetration test, colloquially known as a pen test or ethical hacking, is an authorised simulated cyberattack on a computer system performed to evaluate the security of the system. This is not to be confused with a vulnerability assessment. The test is performed to identify weaknesses (also referred to as vulnerabilities), including the potential for unauthorised parties to gain access to the system's features and data, as well as strengths, enabling a full risk assessment to be completed.
Pen testing can involve the attempted breaching of any number of application systems (e.g., application protocol interfaces (APIs), frontend/backend servers) to uncover vulnerabilities, such as unsanitised inputs that are susceptible to code injection attacks.
Insights provided by the penetration test can be used to fine-tune the WAF security policies and patch detected vulnerabilities.
How often should penetration testing be performed?
Pen testing should be done ideally once a year to ensure more consistent network security and IT management. In addition to conducting regulatory-mandated analysis and assessments, pen tests may also be run whenever an organisation:
Adds new network infrastructure or applications,
Makes significant upgrades or modifications to its applications or infrastructure,
Establishes offices in new locations,
Applies security patches,
Modifies end-user policies
Pen testing depends on several other factors, including:
The size of the company. Companies with a larger presence online have more attack vectors and, therefore, are more-attractive targets for hackers.
Pen tests can be costly, so a company with a smaller budget might not be able to conduct them annually. An organisation with a smaller budget might only be able to conduct a penetration test once every two years, while a company with a larger budget can do pen testing once a year.
Regulations and compliance. Organisations in certain industries are required by law to perform certain security tasks, including pen testing.
A company whose infrastructure is in the cloud might not be allowed to test the cloud provider's infrastructure. However, the provider may be conducting pen tests itself.
Penetration testing efforts should be tailored to the individual organisation as well as the industry it operates in and should include follow-up and evaluation tasks so that the vulnerabilities found in the latest pen test are not reported in the following tests.
Some of the best pen-testing tools include:
PowerShell-Suite is a collection of PowerShell scripts that extract information about the handles, processes, DLLs, and many other aspects of Windows machines. By scripting together specific tasks, you can quickly navigate and check which systems on a network are vulnerable to exploitation.
Best for: Easily automated tasks to discover weak exploitable assets on a network.
Supported Platforms: Windows
Zmap is a lightweight network scanner that is capable of scanning everything from a home network to the entire Internet. This free network scanner is best used to gather baseline details about a network. If you only have an IP range to go off of, use it to get a lay of the land quickly.
Best for Information gathering and initial triage of the attack landscape.
Supported Platforms: Zmap is supported on various Linux platforms and macOS
Xray is an excellent network mapping tool that uses the OSINT framework to help guide its tactics. Xray uses wordlists, DNS requests, and any API keys to help identify open ports on a network from the outside looking in.
Best for Pen testers tasked with gaining access to a network with no help
Supported Platforms: Linux and Windows
SimplyEmail is an email recon tool used to help gather associated information found on the Internet based on someone's email address. SimplyEmail is based on the harvester solution and works to search the Internet for any data that can help provide intelligence around any given email address. Best for Pen testers looking to create account lists for enterprise testing engagements.
Supported Platforms: Docker, Kali, Debian, Ubuntu, macOS
Wireshark is likely the most widely used network protocol analyser in the world. Network traffic captured via Wireshark can show what protocols and systems are live and what accounts are most active and allow attackers to intercept sensitive data.
Best for Deep level network visibility into communications.
Supported Platforms: Windows, Linux, macOS, Solaris
Hashcat is one of the fastest password recovery tools to date. By downloading the Suite version, you have access to the password recovery tool, a word generator, and a password-cracking element. Dictionary, combination, brute-force, rule-based, toggle-case, and Hybrid password attacks are all fully supported. Best of all, hashcat has a great online community to help support the tool with patching, a WiKi page, and walkthroughs.
Best for pen testers or system recovery specialists looking for the best password recovery tool to stake a claim in their business.
Supported Platforms: Linux, Windows, and macOS
John the Ripper is the original password-cracking tool. Its sole purpose is to find weak passwords on a given system and expose them. John the Ripper is a pen-testing tool that can be used from both a security and compliance perspective. John is famous for its ability to expose weak passwords within a short timeframe quickly.
Best Used For: Password cracking for novices
Supported Platforms: Windows, Unix, macOS, Windows
Hydra is another password-cracking tool but with a twist. Hydra is the only password pen testing tool that supports multiple protocols and parallel connections at once. This feature allows a penetration tester to attempt to crack numerous passwords on different systems at the same time without losing connection if unbeaten.
Best for: Password cracking for professionals
Supported Platforms: Linux, Windows, Solaris, macOS
The five stages of PT include Planning and reconnaissance, Scanning, Gaining Access, Maintaining Access, and Analysis.
Planning and reconnaissance include defining the scope and goals of a test, including the systems to be addressed and the utilised test methods. It also includes gathering intelligence (e.g., network and domain names, mail server) to better understand how a target works and its potential vulnerabilities.
Scanning The next step after planning is to understand how the target application will respond to various intrusion attempts. This is typically done using.
Static analysis Inspecting an application's code to estimate the way it behaves while running. These tools can scan the entirety of the code in a single pass. Dynamic analysis Inspecting an application's code in a running state. This is a more practical way of scanning, as it provides a real-time view of an application's performance.
Gaining access This stage uses web application attacks, such as cross-site scripting, SQL injection and backdoors, to uncover a target's vulnerabilities. Testers then try and exploit these vulnerabilities, typically by escalating privileges, stealing data, intercepting traffic, etc., to understand the damage they can cause.
Maintaining access The goal of this stage is to see if the vulnerability can be used to achieve a persistent presence in the exploited system long enough for a bad actor to gain in-depth access. The idea is to imitate advanced persistent threats, which often remain in a system for months in order to steal an organisation's most sensitive data.
Analysis, The results of the pen test are then compiled into a report detailing the following:
Specific vulnerabilities that were exploited
Sensitive data that was accessed
The amount of time the pen tester was able to remain in the system undetected
This information is analysed by security personnel to help configure an enterprise's WAF settings and other application security solutions to patch vulnerabilities and protect against future attacks.
Penetration testing methods include
External testing External penetration tests target the assets of a company that are visible on the Internet, e.g., the web application itself, the company website, and email and domain name servers (DNS). The goal is to gain access to and extract valuable data.
Internal testing In an internal test, a tester with access to an application behind its firewall simulates an attack by a malicious insider. This isn't necessarily simulating a rogue employee. A common starting scenario can be an employee whose credentials were stolen due to a phishing attack.
Blind testing In a blind test, a tester is only given the name of the enterprise that's being targeted. This gives security personnel a real-time look into how an actual application assault would take place.
Double-blind testing In a double-blind test, security personnel have no prior knowledge of the simulated attack. As in the real world, they won't have any time to shore up their defences before an attempted breach.
Targeted testing In this scenario, both the tester and security personnel work together and keep each other appraised of their movements. This is a valuable training exercise that provides a security team with real-time feedback from a hacker's point of view.
Penetration testing and web application firewall Penetration testing and WAFs are exclusive yet mutually beneficial security measures.
For many kinds of pen testing (with the exception of blind and double-blind tests), the tester is likely to use WAF data, such as logs, to locate and exploit an application's weak spots. In turn, WAF administrators can benefit from pen-testing data. After a test is completed, WAF configurations can be updated to secure against the weak spots discovered in the test.
Finally, pen testing satisfies some of the compliance requirements for security auditing procedures, including PCI DSS and SOC 2. Certain standards, such as PCI-DSS 6.6, can be satisfied only through the use of a certified WAF. Doing so, however, doesn't make pen testing any less useful due to its aforementioned benefits and ability to improve on WAF configurations.
Thank you so much for putting in the time to come visit the all-things-testing blog.
Best regards
all-things-testing
PS: Please write back to me if you need assistance with PT. I will do my best to help you with clarifications or end-to-end understanding of PT.
Opmerkingen