Cyber Security  ·  Level 5
Conduct Security Assessment And Testing
Chapter 4: Exploit Known Vulnerabilities
📚 4 Topics
⚑ What you will be able to do

By the end of this chapter, you will be able to:

  • Review and prioritize identified vulnerabilities based on how severe and exploitable they are, and understand their potential impact on the business.
  • Plan exploitation activities carefully, making sure to follow your organization's policies, rules of engagement, and legal requirements.
  • Use approved penetration testing tools and frameworks correctly and safely to test for vulnerabilities.

Mastering these skills helps you protect organizations by finding and addressing security weaknesses before attackers do.

Exploiting known vulnerabilities is a fundamental skill for cyber security professionals tasked with conducting security assessments and penetration testing. In Kenya, where organizations ranging from financial institutions to government agencies increasingly depend on digital infrastructure, identifying and exploiting vulnerabilities provides critical insight into system weaknesses before malicious actors do. This chapter focuses on practical methods using tools like the Metasploit Framework to exploit system vulnerabilities and techniques for escalating privileges on Windows and Linux systems, enabling security testers to simulate real-world attacks effectively.

4.1 Use Metasploit Framework to exploit system vulnerabilities

The Metasploit Framework is a widely adopted open-source platform that enables security professionals to identify, validate, and exploit vulnerabilities within computer systems. In Kenya’s cyber security landscape, where organizations such as banks and county government offices face increasing cyber threats, Metasploit serves as a vital tool for penetration testers to demonstrate the impact of vulnerabilities and recommend mitigations. Mastery of this framework allows professionals to simulate attacks in a controlled environment, ensuring that defenses are robust against exploitation attempts.

4.1.1 Overview of the Metasploit Framework

The Metasploit Framework is a modular platform designed to facilitate vulnerability exploitation, payload delivery, and post-exploitation activities. It integrates a vast library of exploits, payloads, and auxiliary modules, enabling testers to customize their attack approaches depending on target systems.

Key Characteristics of Metasploit Framework

  • Modular Architecture: The framework’s components such as exploits, payloads, and encoders can be combined flexibly to create tailored attack scenarios suited to specific vulnerabilities.
  • Extensive Exploit Database: Metasploit maintains a comprehensive and regularly updated repository of exploits, including those targeting widely used software in Kenyan organizations like Windows Server and Apache web servers.
  • Payload Variety: It supports multiple payload types, including reverse shells and meterpreter sessions, which provide different levels of control once exploitation is successful.
  • Automation Capability: Scripts and resource files can automate repetitive tasks, increasing efficiency during penetration tests.
  • Community and Commercial Support: While the open-source community continuously contributes to its development, commercial versions offer additional features and support for enterprise environments.

4.1.2 Setting up and Configuring Metasploit for Use

Proper setup and configuration of Metasploit are essential to ensure effective exploitation and accurate vulnerability assessment. Kenyan cyber security professionals often deploy Metasploit on Kali Linux or other penetration testing distributions.

Essential Setup Steps

  • Installation on Kali Linux: Metasploit is pre-installed on Kali Linux; however, updating the framework ensures the latest exploits and modules are available.
  • Database Configuration: Metasploit uses PostgreSQL to manage exploit modules and session data, requiring correct setup and connection to enable efficient operations.
  • Network Configuration: Setting appropriate network interfaces and IP addresses is crucial for communication between the attacker machine and the target system, especially when working within Kenya’s organizational networks.
  • Workspace Management: Creating and managing workspaces helps organize data from multiple penetration tests, useful when assessing various departments within a large enterprise such as a Nairobi-based university.
  • Credential Management: Importing or manually entering valid credentials can facilitate authenticated exploits, increasing the likelihood of successful penetration.

4.1.3 Exploiting Vulnerabilities Using Metasploit

Exploitation involves selecting an appropriate exploit module, configuring target parameters, and delivering a payload to gain control over the system. In Kenyan financial institutions, for example, this process helps reveal how attackers might breach core banking systems.

Steps to Exploit a Vulnerability

  1. Identify the Target and Gather Information: Use reconnaissance tools like Nmap to identify open ports, services, and versions running on the target, laying the groundwork for selecting the correct exploit.
  2. Select an Exploit Module: Choose an exploit from Metasploit’s database that matches the target’s vulnerable service or software version.
  3. Configure Exploit Options: Set required parameters such as the target IP address, port number, and payload type to tailor the attack.
  4. Set Payload: Select a payload that defines the action upon successful exploitation, such as opening a reverse shell back to the attacker.
  5. Execute the Exploit: Launch the exploit and monitor for successful session creation.
  6. Interact with the Session: Use the established shell or meterpreter session to perform further post-exploitation activities.

4.1.4 Post-Exploitation Activities Using Metasploit

Once access is gained, post-exploitation tasks assess the extent of control and potential damage an attacker could inflict. This phase is crucial for Kenyan organizations like county governments to understand the risks posed by compromised systems.

Common Post-Exploitation Techniques

  • Privilege Escalation: Attempt to gain higher-level access to perform sensitive operations.
  • Credential Harvesting: Extract stored passwords or tokens to access other systems.
  • Persistence Establishment: Create backdoors to maintain access even after system restarts.
  • Data Exfiltration: Simulate unauthorized data extraction to evaluate data loss risks.
  • Network Pivoting: Use the compromised host as a launchpad to attack other network assets.
The rest of this chapter
🔒

Create a free account to open more of this chapter.

Free: practical guides, quick cards, workplace scenarios and more.

Create a free account
🔒4.2 Demonstrate privilege escalation techniques on Windows and Linux based systems

Privilege escalation is a critical phase in penetration testing, enabling attackers to gain elevated access rights that permit full control over a compromised system. Cyber security professionals in Kenya must be proficient in identifying and exploiting privil…

🔒4.3 Perform Buffer Overflow Attacks and Analyse the Results

Buffer overflow attacks remain a critical technique in cyber security assessments, as they expose vulnerabilities in software that can be exploited to execute arbitrary code or crash systems. In Kenya, organizations such as county government offices and banks…

🔒4.4 Execute Web-Based Attacks

Web-based attacks target vulnerabilities in web applications and services, which are increasingly prevalent in Kenya’s digital infrastructure, including online banking portals, e-commerce platforms, and government service websites. Cyber security professionals…

Chapter Summary

This chapter focused on exploiting known vulnerabilities through practical techniques and tools. It began with an in-depth exploration of the Metasploit Framework, demonstrating how it can be used to identify and exploit system weaknesses effectively. The discussion then moved to privilege escalation methods on both Windows and Linux platforms, highlighting how attackers can gain higher access rights within a compromised system. The chapter also covered buffer overflow attacks, explaining the mechanics behind them and how to analyse their impact on system stability and security. Web-based attacks were examined in detail, starting with SQL injection techniques that manipulate database queries to extract or alter data. Cross-site scripting (XSS) attacks were then explored, showing how malicious scripts can be injected into web pages to compromise users. Finally, the chapter addressed cross-site request forgery (CSRF), describing how unauthorized commands can be transmitted from a user that the web application trusts. Together, these topics provide a comprehensive understanding of exploiting vulnerabilities in various environments and platforms.

Self-Assessment

🔒 PDFDownload this self-assessment, with answers

A. Written Assessment

  1. What is the primary purpose of the Metasploit Framework in cyber security testing? (2 marks)
  2. Identify two common privilege escalation techniques used on Windows systems. (3 marks)
🔒20 more in this section.

Chapter Examination Questions

🔒 PDFDownload these examination questions, with worked answers

SECTION A (40 Marks) - Answer ALL Questions

  1. In the context of a cyber security assessment at a Nairobi-based county government office, explain how the Metasploit Framework can be used to identify and exploit known system vulnerabilities. (4 marks)
  2. Describe two privilege escalation techniques commonly used on Windows systems and explain how they can impact system security in a Kenyan financial institution. (4 marks)
🔒18 more in this section.

Chapter Practical Activities

Practical 1: Exploit system vulnerabilities using Metasploit Framework

Cyber Security · Level 5
Conduct Security Assessment And Testing
PRACTICAL ASSESSMENT
TIME: 4 HOURS
⬇ PDFCandidate Instructions (Candidate Tool)

Type: Individual

INSTRUCTIONS TO CANDIDATE:
1.  You are required to perform the following task:
i.  Use Metasploit Framework to identify and exploit a known vulnerability on a Windows 10 target system and obtain a Meterpreter session.
2.  You have been provided with the following resources for the practical task:
Tools & EquipmentMaterials
Laptop with Kali Linux installed
Target Windows 10 virtual machine
Metasploit Framework
Network switch and cables
⬇ PDFResources Required (Cutting List)
S/NItemQuantity
1Laptop with Kali Linux installed1 Pc per Candidate
2Target Windows 10 virtual machine pre-configured with vulnerable services1 Pc per Candidate
3Metasploit Framework installed on Kali Linux1 Pc per Candidate
4Network switch and cables for connectivity1 set per 5 Candidates
⬇ PDFAssessor Guide
Items to be EvaluatedMarks AvailableMarks ObtainedComments
TASK 1: Setup and Reconnaissance
Powered on Kali Linux machine and target Windows 10 VM ensuring network connectivity
(Award 3 marks for successful setup and network connection)
3
Used Nmap to scan the target system to identify open ports and services
(Award 5 marks for correct use of Nmap and accurate port/service enumeration)
5
Analyzed scan results to identify potential vulnerabilities
(Award 4 marks for correct vulnerability identification based on scan)
4
Sub-Total12
TASK 2: Exploitation with Metasploit
Launched Metasploit Framework and searched for exploits matching identified vulnerabilities
(Award 4 marks for proper use of search commands)
4
Configured exploit parameters correctly including target IP, payload, and options
(Award 6 marks for accurate and complete exploit configuration)
6
Executed the exploit and successfully obtained a Meterpreter session
(Award 8 marks for successful exploitation and session opening)
8
Demonstrated basic post-exploitation commands (e.g., sysinfo, getuid)
(Award 5 marks for executing and interpreting post-exploitation commands)
5
Sub-Total23
PRODUCT CHECKLIST
Obtained Meterpreter session with evidence (e.g., screenshot or session details)
(Award 10 marks for documented proof of successful exploitation)
10
Correctly identified vulnerability and exploit used matching target system
(Award 5 marks for correct vulnerability-exploit correlation)
5
Sub-Total15
GRAND TOTAL50
ASSESSMENT OUTCOME:   ☐ Competent    ☐ Not Yet Competent (competent if at least 50%)

Practical 2: Privilege Escalation on Windows System using Known Vulnerabilities

Cyber Security · Level 5
Conduct Security Assessment And Testing
PRACTICAL ASSESSMENT
TIME: 4 HOURS
⬇ PDFCandidate Instructions (Candidate Tool)

Type: Individual

INSTRUCTIONS TO CANDIDATE:
1.  You are required to perform the following task:
i.  Perform privilege escalation on a Windows 10 Pro system using known vulnerabilities to obtain SYSTEM level access and document the steps with screenshots.
2.  You have been provided with the following resources for the practical task:
Tools & EquipmentMaterials
Windows 10 Pro virtual machineNetwork connection between Kali Linux and Windows VM
Kali Linux penetration testing virtual machine
Metasploit Framework
Windows Credential Editor (WCE)
Notepad++ or equivalent text editor
⬇ PDFResources Required (Cutting List)
S/NItemQuantity
1Windows 10 Pro virtual machine (1 Pc per Candidate)1 Pc per Candidate
2Kali Linux penetration testing virtual machine (1 Pc per Candidate)1 Pc per Candidate
3Metasploit Framework installed on Kali Linux VM1 Setup per Candidate
4Windows Credential Editor (WCE) tool1 Copy per Candidate
5Notepad++ or equivalent text editor1 Pc per Candidate
6Network connection between Kali Linux and Windows VM1 Network per Candidate
⬇ PDFAssessor Guide
Items to be EvaluatedMarks AvailableMarks ObtainedComments
TASK 1: Preparation and Initial Access
Candidate boots both Windows 10 and Kali Linux virtual machines and verifies network connectivity between them
(Award 3 marks for successful VM startup and network ping test)
3
Candidate performs basic reconnaissance on Windows system using Nmap or similar tools to identify open ports and services
(Award 4 marks for scanning and correctly identifying open services)
4
Candidate uses Metasploit Framework to exploit a known Windows vulnerability to gain initial user-level access
(Award 6 marks for selecting appropriate exploit and successful shell access)
6
Sub-Total13
TASK 2: Privilege Escalation Process
Candidate enumerates the Windows system for privilege escalation vectors using built-in commands (e.g., whoami, systeminfo, tasklist)
(Award 4 marks for thorough enumeration and correct command usage)
4
Candidate identifies and exploits a known local privilege escalation vulnerability (e.g., unquoted service path, weak permissions, or token impersonation) on Windows system
(Award 8 marks for correctly identifying and exploiting privilege escalation)
8
Candidate uses Windows Credential Editor (WCE) or equivalent tool to dump credentials or escalate privileges
(Award 5 marks for successful use of WCE or equivalent to elevate privileges)
5
Candidate documents each step with screenshots and saves them in a folder named 'CDACC' on the Windows desktop
(Award 4 marks for clear documentation and correct folder naming and location)
4
Sub-Total21
TASK 3: Post Escalation Verification and Reporting
Candidate verifies SYSTEM level access by running 'whoami /priv' or equivalent commands
(Award 3 marks for successful verification of SYSTEM privileges)
3
Candidate compiles a brief report summarizing the vulnerability exploited, tools used, and remediation recommendations
(Award 6 marks for clear and concise report with relevant technical details)
6
Sub-Total9
PRODUCT CHECKLIST
Privilege escalation achieved to SYSTEM level on Windows 10 Pro system as verified by command output and screenshots
(Award 10 marks for successful privilege escalation with supporting evidence)
10
Complete documentation folder 'CDACC' on Windows desktop containing step-by-step screenshots and narrative
(Award 7 marks for well-organized and complete documentation)
7
Final report includes vulnerability details, exploitation method, and mitigation recommendations
(Award 10 marks for comprehensive and professional report)
10
Sub-Total27
GRAND TOTAL70
ASSESSMENT OUTCOME:   ☐ Competent    ☐ Not Yet Competent (competent if at least 50%)
🔒

Free: practical guides, quick cards, workplace scenarios and more.

Create a free account
🔒Privilege Escalation on a Linux SystemPractical 3
🔒Buffer Overflow Attack Execution and AnalysisPractical 4
🔒Perform SQL Injection Attacks on a Web ApplicationPractical 5
🔒Conduct Cross-Site Scripting (XSS) Attacks on a Web ApplicationPractical 6
🔒Execute Cross-Site Request Forgery (CSRF) Attacks on a Web ApplicationPractical 7
🔒Perform Combined SQL Injection and Cross-Site Scripting Attacks on a Web ApplicationPractical 8
🔒Execute Combined Web-based Attacks Using CSRF and Other ExploitsPractical 9
🔒Comprehensive Exploitation using Metasploit Framework and Privilege Escalation on Windows and Linux SystemsPractical 10
Flashcards 19 cards Study deck ▾
Question
1

↻ Tap card to reveal answer
🔒

17 more in this section.

Create a free account
Test Yourself 15 questions Start quiz ▾
0%
0 / 2
🔒

13 more in this section.

Create a free account
Am I competent?

At the start of this chapter we promised you would be able to:

  • Review and prioritize identified vulnerabilities based on how severe and exploitable they are, and understand their potential impact on the business.
  • Plan exploitation activities carefully, making sure to follow your organization's policies, rules of engagement, and legal requirements.
  • Use approved penetration testing tools and frameworks correctly and safely to test for vulnerabilities.

Tick each one you can genuinely do.

So, are you there yet?

You're competent when you can confidently do 50% or more of what this chapter promised.

Sign in to record how you're doing.