From reconnaissance to exploitation and reporting, a practical introduction to ethical hacking using one of the most popular penetration testing platforms.
There is something rather satisfying about finding a security vulnerability before someone with less honourable intentions discovers it.
That, in essence, is what penetration testing is about.
We spend considerable amounts of time, money and effort protecting our systems. We deploy firewalls, endpoint protection, intrusion detection systems, multifactor authentication and numerous other security controls. Yet, despite all these measures, vulnerabilities continue to be discovered and exploited.
Why? Because security is not simply about installing products or applying patches. It is about understanding how systems can be attacked, identifying weaknesses and determining whether our security controls actually work.
One of the best ways to achieve this is to think like an attacker.
This is where Kali Linux comes into play.
In this article, we will explore how to conduct a penetration test using Kali Linux, from preparing your environment and discovering potential vulnerabilities to safely validating findings and producing a meaningful report.
You do not need to be an experienced ethical hacker to follow along. However, a basic understanding of Linux, networking and operating systems will certainly help.
And one important point before we start: only perform penetration testing against systems you own or have explicit authorisation to test. For our examples, we will use an isolated laboratory environment.
1. What exactly is penetration testing?
Penetration testing, commonly referred to as pentesting, is the process of evaluating the security of a computer system, network or application by simulating techniques that a real attacker might use.
Unlike a vulnerability scan, which primarily identifies potential weaknesses, a penetration test attempts to establish whether those weaknesses can actually be exploited and what the consequences might be.
For example, a vulnerability scanner might report that a web server is running outdated software. A penetration tester would investigate whether that particular version is vulnerable, whether the vulnerability is reachable and whether exploiting it would expose sensitive information or compromise the system.
The distinction is important.
Finding a vulnerability is one thing. Understanding its actual security impact is another.
A typical penetration test follows several stages:
1. Planning and authorisation – Define the scope, rules and objectives
2. Reconnaissance – Discover hosts, services and technologies
3. Vulnerability analysis – Identify and investigate potential weaknesses
4. Controlled exploitation – Validate impact without unnecessary damage
5. Reporting and remediation – Document evidence, fix weaknesses and retest
The objective is not to break into as many systems as possible. It is to provide meaningful evidence that helps an organisation improve its security.
2. Preparing your Kali Linux environment
Kali Linux is a Debian-based distribution developed and maintained by Offensive Security. It includes a comprehensive collection of tools designed for penetration testing, security auditing, digital forensics and reverse engineering.
As of November 2026, Kali Linux 2026.3 is the latest quarterly release, published on 26 October 2026. Kali follows a rolling-release model, so individual tools and packages may receive updates between major releases. Kali Linux+1
You can download Kali Linux from its official download page.
For our exercise, I recommend installing Kali Linux in a virtual machine using VirtualBox or VMware rather than replacing your existing operating system.
A virtual machine offers several advantages. You can isolate your testing environment, take snapshots, restore the system if something goes wrong and run multiple operating systems simultaneously.
For a small laboratory, the following configuration is a reasonable starting point:
| Component | Recommended |
|---|---|
| CPU | 2–4 virtual cores |
| Memory | 4–8 GB RAM |
| Storage | 40–60 GB |
| Network | Host-only or isolated internal network |
| Virtualisation | VirtualBox or VMware |
These are practical recommendations, not mandatory Kali minimum requirements. Resource-intensive tools may require considerably more memory.
Updating Kali Linux
Before starting, open a terminal and execute:
sudo apt update
sudo apt full-upgrade
The first command refreshes the package information. The second upgrades the installed packages, including changes to dependencies when necessary.
Kali’s official update documentation recommends preparing and validating your tools before an engagement rather than upgrading them halfway through a test. Kali Linux Documentation+1
Check whether the tools we will use are available:
which nmap
which nikto
which msfconsole
which wireshark
If necessary, install them:
sudo apt install nmap nikto metasploit-framework wireshark
You do not need every tool Kali offers. In fact, understanding a small number of tools properly is far more valuable than having hundreds installed without knowing what they do.
3. Building a safe penetration testing laboratory
Before attacking anything, we need something to test.
For this exercise, we will use two virtual machines.
The first machine runs Kali Linux. The second is our target.
For the target, we can use a deliberately vulnerable system such as Metasploitable 3 or a vulnerable web application such as OWASP Juice Shop.
Both are designed to help security professionals practise identifying and exploiting vulnerabilities in a controlled environment.
For this walkthrough, assume our target has the following IP address:
192.168.56.20
The Kali machine uses:
192.168.56.10
Configure both machines on the same host-only virtual network, with no unintended route to your production network. If your hypervisor provides DHCP, either reserve these addresses or verify the addresses actually assigned. Disable the target’s Internet access unless a particular lab setup requires it.
Take a snapshot of both machines before proceeding.
We now have a safe environment in which to learn without putting anyone else’s infrastructure at risk.
4. Reconnaissance: Understanding the target
Reconnaissance is the process of collecting information about the system we intend to test.
This is one of the most important stages of a penetration test, and it is often underestimated.
Before trying to exploit a vulnerability, we need to understand what is running, which services are exposed and how the system communicates.
Discovering the target with Nmap
Nmap is one of the most widely used tools for network discovery and security auditing.
Start by confirming that your Kali machine can communicate with the target:
ping -c 4 192.168.56.20
If the target responds, we know that ICMP echo requests are reaching it and replies are returning. However, a lack of response does not necessarily mean the machine is offline. Firewalls frequently block ICMP traffic.
Next, perform a basic TCP port scan:
nmap -sT 192.168.56.20
The -sT option performs a TCP connect scan against Nmap’s default selection of common TCP ports.
We can then identify the services and their likely versions:
nmap -sT -sV -p 21,22,80,443 \
192.168.56.20
Here, -sV enables service and version detection, while -p specifies the ports we want to examine.
According to the official Nmap documentation, version detection uses probes and service fingerprints to identify software running behind open ports. These identifications are useful but should not automatically be treated as definitive. Nmap Network Scanning
Imagine the following illustrative result:
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd
22/tcp open ssh OpenSSH
80/tcp open http Apache httpd
443/tcp closed https
What does this tell us?
We have discovered three accessible services: FTP, SSH and HTTP.
That is already useful information. Each service introduces a potential attack surface that deserves further investigation.
For example, we might want to determine whether FTP permits anonymous access, whether SSH uses appropriate authentication controls, and whether the web server exposes unnecessary information.
But remember: an open port is not a vulnerability. It simply means that a service is accessible.
5. Vulnerability analysis: Looking for weaknesses
Now that we understand which services are running, we can begin investigating possible vulnerabilities.
Kali includes several tools that can help.
For web servers, one option is Nikto, an open-source web server scanner that checks for potentially dangerous files, outdated components and configuration issues.
Assuming our laboratory target has a web service running on port 80:
nikto -h http://192.168.56.20
Nikto may identify missing security headers, potentially sensitive paths, server information disclosures or known configuration weaknesses.
However, the results require interpretation.
A missing HTTP security header might represent a legitimate security concern, but it does not necessarily mean that an attacker can compromise the server.
Likewise, an outdated software version may be vulnerable, but the vulnerability might already have been addressed through backported security patches.
This is where professional judgement becomes important.
A scanner is an assistant, not a substitute for understanding the underlying technology.
Investigating a possible vulnerability
Suppose a scanner identifies an outdated web server version.
The next step should be to verify the software version and configuration, then investigate whether there are known vulnerabilities associated with that specific release.
Two useful sources are the NIST National Vulnerability Database and the CVE Programme.
When researching a potential vulnerability, consider whether the affected version matches your target, whether the vulnerable functionality is enabled, whether authentication is required and whether there are mitigating controls.
A CVE match is not, by itself, proof of exploitability.
For modern environments, also consider cloud permissions, exposed APIs, identity configurations, container images and software dependencies. Traditional network scanning alone will not identify every weakness in these technologies.
6. Web application testing: Where things become interesting
Many modern security incidents involve applications rather than operating systems.
A web server might be fully patched while the application it hosts contains serious security weaknesses.
This is why web application penetration testing deserves particular attention.
For this stage, I recommend using Burp Suite Community Edition or OWASP ZAP.
Both allow you to examine HTTP requests and responses, understand how an application processes input and investigate potential security weaknesses.
The OWASP Web Security Testing Guide provides a recognised methodology for evaluating web application security. It covers authentication, authorisation, session management, input validation, cryptography and other important areas. OWASP Foundation+1
A practical example: Testing access controls
Imagine that our laboratory application allows users to view their account details using a URL such as:
http://192.168.56.20/account/1001
We log in with a test account and capture the request using Burp Suite.
Next, we change the account identifier:
http://192.168.56.20/account/1002
If the application returns another test user’s private account information without checking whether the authenticated user is authorised to access it, we may have discovered a broken access control vulnerability.
This is commonly referred to as an Insecure Direct Object Reference, or IDOR.
To validate it properly, use two test accounts you control. Compare their permissions and responses, verify that the information is genuinely restricted, and stop once the security impact has been established.
Do not retrieve unnecessary records or access real users’ information.
The important lesson is that the vulnerability exists in the application’s authorisation logic, not necessarily in the operating system or web server.
This type of issue cannot reliably be discovered simply by scanning network ports.
Other application vulnerabilities worth investigating
A comprehensive web application test should also consider SQL injection, cross-site scripting, insecure session handling, server-side request forgery, file upload vulnerabilities and authentication weaknesses.
You can practise these techniques using the free PortSwigger Web Security Academy, which provides interactive laboratories covering many of these vulnerability classes. Web Security Academy
7. Controlled exploitation: Proving the vulnerability
Finding a possible vulnerability is not the end of the investigation.
Where authorised and appropriate, the next stage is to determine whether it can be exploited.
One of Kali’s best-known tools for this purpose is the Metasploit Framework.
Metasploit provides modules for vulnerability validation, exploitation and other security testing activities.
Start the console:
msfconsole
You can search for modules associated with a particular technology:
search type:exploit apache
Or inspect a selected module:
info <module_name>
The info command provides details about the module, including its purpose, references and supported targets.
Some modules support a check command that attempts to determine whether a target is vulnerable without performing the full exploitation process. However, not every module supports this functionality, and even a supported check may generate traffic or have side effects.
For our laboratory, select a module appropriate to a deliberately vulnerable target and review its documentation before configuring it.
A successful validation might demonstrate that an unauthorised user can access restricted functionality or that an application exposes information it should protect.
The goal is to establish the impact with the minimum necessary interaction.
There is rarely a legitimate reason to continue accessing sensitive information once sufficient evidence has been collected.
A successful penetration test is not measured by how much damage you can cause. It is measured by how clearly you can demonstrate the risk without causing unnecessary damage.
8. What happens after exploitation?
In a real penetration test, discovering an exploitable vulnerability is often only part of the investigation.
The next question is what an attacker could potentially achieve after gaining access.
Could the compromised account access sensitive data? Could the attacker move between systems? Could the vulnerability provide elevated privileges? Would monitoring and security controls detect the activity?
These are important questions, particularly in complex enterprise environments.
However, post-exploitation activities can introduce substantial operational risks.
For example, privilege escalation attempts may destabilise systems, while lateral movement tests can affect other infrastructure. Even seemingly harmless activities can trigger security controls or interrupt business operations.
For this reason, these tests should only be conducted when explicitly included in the agreed scope.
In our laboratory, we can safely examine the permissions associated with a deliberately compromised test account, identify which resources it can access and determine whether the permissions exceed what the account legitimately requires.
In production, the extent of such testing must be carefully controlled.
9. Capturing network traffic with Wireshark
Another valuable tool included with Kali Linux is Wireshark.
Wireshark allows us to capture and analyse network traffic, making it useful for understanding how applications communicate and identifying potential security problems.
Launch it using:
wireshark
Select the network interface connected to your laboratory network and begin capturing traffic.
For example, you can apply the following display filter:
ip.addr == 192.168.56.20
This displays captured packets where the source or destination IP address matches our target.
You can also examine HTTP traffic:
http
In an intentionally insecure laboratory application using unencrypted HTTP, you may observe sensitive information being transmitted without transport encryption.
That would be an important finding.
However, modern applications typically use HTTPS, and Wireshark cannot simply reveal the contents of properly encrypted TLS sessions without access to appropriate session secrets or other authorised decryption mechanisms.
Wireshark is particularly useful for validating network behaviour and supporting findings with packet-level evidence.
It can also help explain how an attack works rather than simply showing that a tool reported success.
10. Reporting: The most important part of the exercise
You have discovered services, investigated vulnerabilities and demonstrated their potential impact.
Now what?
This is where many inexperienced penetration testers make a mistake. They focus on the technical excitement of finding vulnerabilities but underestimate the importance of documenting their findings.
A penetration test that produces no actionable recommendations has limited value.
A good report should explain what was tested, what was discovered, how the findings were validated, what the business impact could be and how the weaknesses should be addressed.
For each confirmed vulnerability, I recommend documenting the following:
| Field | What to include |
|---|---|
| Finding | Clear description of the vulnerability |
| Affected asset | Hostname, IP address, application or component |
| Severity | Critical, High, Medium or Low, with justification |
| Evidence | Relevant requests, responses, screenshots or logs |
| Impact | What an attacker could realistically achieve |
| Reproduction | Controlled steps to verify the issue |
| Remediation | Specific actions required to address it |
| References | CVE, CWE, vendor advisory or OWASP guidance |
Example finding: Broken access control
Finding: An authenticated user can access another user’s account information by modifying the account identifier in an HTTP request.
Severity: High, assuming the exposed information is sensitive and the issue affects multiple users.
Impact: Unauthorised disclosure of personal or confidential account information.
Evidence: HTTP requests and responses demonstrating access between two controlled laboratory accounts.
Remediation: Implement server-side object-level authorisation checks for every request. Ensure that users can access only the resources explicitly permitted by their assigned roles and permissions.
Validation: Repeat the original test after remediation and confirm that unauthorised access is denied.
The severity should reflect the actual impact and likelihood of exploitation, rather than simply accepting a scanner’s rating.
For consistent vulnerability scoring, refer to the FIRST Common Vulnerability Scoring System (CVSS). CVSS provides a technical severity framework, but business context remains important when prioritising remediation.
11. What about modern environments?
Penetration testing has evolved considerably.
A decade ago, a typical assessment might have focused primarily on servers, operating systems, network services and traditional web applications.
Those areas remain important, but today’s environments are considerably more complex.
Cloud infrastructure, Kubernetes, containers, APIs, identity providers and AI-enabled applications introduce additional attack surfaces.
For example, a cloud-hosted application might have no obvious operating system vulnerabilities but could still expose sensitive information through incorrectly configured storage permissions.
Similarly, a modern API might use strong encryption and authentication while failing to enforce object-level authorisation.
AI applications introduce additional considerations, including prompt injection, excessive permissions, insecure tool integrations and unintended information disclosure.
The OWASP guidance on LLM application security is a useful starting point for understanding these emerging risks.
Kali Linux remains relevant to these environments, but the tools and methodologies must match the technologies being tested.
There is no single scanner that can comprehensively assess every aspect of a modern enterprise.
And increasingly, effective penetration testing requires understanding not only technical vulnerabilities but also the relationships between identities, applications, infrastructure and data.
12. Where to practise and improve your skills
The best way to learn penetration testing is through practical experience.
Fortunately, there are excellent resources available, including several that are free.
| PortSwigger Web Security Academy | Free interactive laboratories covering SQL injection, access control, authentication, API security and many other topics. |
| OWASP Juice Shop | A deliberately vulnerable modern web application that allows you to practise identifying real-world application security weaknesses. |
| TryHackMe | Guided, hands-on exercises covering Linux, networking, security fundamentals and offensive security techniques. Free and paid content is available. |
| Hack The Box | Practical cybersecurity laboratories and structured training, ranging from introductory exercises to advanced penetration testing challenges. Free and paid options are available. |
For those who want a more formal methodology, I also recommend the Penetration Testing Execution Standard (PTES) and the NIST SP 800-115 Technical Guide to Information Security Testing and Assessment.
Although NIST SP 800-115 is an older publication, its principles for planning, conducting and documenting security assessments remain useful. It should be complemented with current technology-specific guidance.
13. Common mistakes worth avoiding
Before concluding, there are a few mistakes that deserve particular attention.
- Running tools without understanding them. Automated scanning can generate considerable traffic and, depending on the test, potentially disrupt services.
- Assuming every scanner finding is a vulnerability. False positives exist, and every significant finding should be investigated.
- Confusing a software version with proof of exploitability. Version banners can be misleading, and vendors sometimes backport security fixes.
- Ignoring the agreed scope. Authorisation to test one system does not automatically extend to other systems connected to it.
- Failing to preserve evidence. Without reliable evidence, findings become difficult to reproduce and validate.
- Neglecting remediation and retesting. Identifying a vulnerability is useful, but confirming that it has been addressed is equally important.
There is also a tendency to measure a penetration tester’s ability by the number of tools they know or the number of systems they have compromised.
I would argue that this is the wrong measure.
A good penetration tester understands the technology, asks the right questions, interprets the evidence and can explain the consequences in a way that both technical teams and business leaders understand.
Final thoughts
Kali Linux is an excellent platform for penetration testing, but it is important to remember that it is only a collection of tools.
Installing Kali does not make someone a penetration tester any more than installing a compiler makes someone a software engineer.
The real skill lies in understanding how systems work, recognising where security controls might fail and applying a structured methodology to investigate those weaknesses.
In this article, we have covered the basic process, from building a laboratory and discovering services to investigating vulnerabilities, validating their impact and documenting the results.
Of course, we have only scratched the surface.
There are many other areas worth exploring, including Active Directory security, wireless networks, cloud infrastructure, container security, privilege escalation, API testing and increasingly, the security of AI-enabled applications.
Each deserves its own detailed discussion.
For anyone interested in developing their cybersecurity skills, my recommendation is simple: build a laboratory, understand the technologies you are testing, practise regularly and never stop questioning your assumptions.
And remember, the objective of penetration testing is not to demonstrate how clever an attacker can be.
It is to make sure that when a real attacker comes along, there is considerably less for them to exploit.

Be the first to comment