Master of Computer Applications (Integrated)
Semester- VIII
Ethical Hacking
(050120803)
OWASP
[Link]
vulnerabilities
OWASP Top Ten 2017 vs. 2021
Cyber vulnerabilities continuously change, and OWASP Top 10 list adapts to reflect that. Since
the last list was released in 2017, quite a lot has been modified.
Three new categories were added:
● Insecure Design
● Software and Data Integrity Failures
● Server-Side Request Forgery (SSRF)
Some of the vulnerabilities published on OWASP Top 10 2017 have also changed name or scope
to adapt to market changes:
Insufficient Logging and Monitoring is now called Security Logging and Monitoring Failures.
Some vulnerabilities have remained unaltered, but they have moved spots:
Broken Access Control is now considered the most common vulnerability, taking the number
one spot.
Below we will look at the latest OWASP Top Ten list and each vulnerability in detail.
1. Broken Access Control
In a nutshell, broken access control means that an attacker can access resources or data they
should not have access to. This can be done in many ways, but typically by exploiting flaws in
how the system controls access to those resources. 61% of all breaches involve broken access
control.
There are many ways to exploit broken access control, but the result is always the same: the
attacker gains access to data or resources they should not have access to.
Preventing Broken Access Control
Access control is a security measure that protects resources from unauthorized access. There are
many different ways to achieve this, but one common method is to use a whitelist.
A whitelist is a list of authorized users that are allowed to access a particular resource.
2. Cryptographic Failures
Insecure communications constitute a significant problem on the internet today.
Unencrypted or weakly encrypted communications can be intercepted and read by anyone with
the right tools. This can lead to the disclosure of sensitive information, like passwords, financial
data, and personal information.
In 2023 alone, there were well over 8 billion records breached, and the average cost of a data
breach sits at around $4.54 million.
Preventing Cryptographic Failures
When data is sent over the internet using HTTPS, it is encrypted using a cryptographic algorithm,
which makes it difficult for attackers to read or tamper with the data.
To implement HTTPS in Nginx, you will need to purchase and install an SSL certificate. Once
you have your certificate, you will need to edit your Nginx configuration file to enable SSL.
The specific directives you need to edit will depend on your configuration, but they will typically
be something like:
ssl_certificate /path/to/your/[Link];
ssl_certificate_key /path/to/your/[Link];
After you have edited your configuration file, you will need to restart Nginx for the changes to
take effect.
Metasploit Framework
The Metasploit Framework is an open-source penetration testing tool that provides security
professionals and ethical hackers with a suite of tools to identify, exploit, and validate security
vulnerabilities. Developed by Rapid7, Metasploit is one of the most widely used tools for
offensive security and red teaming.
1. Exploit
● Definition: An exploit is a piece of code that takes advantage of a vulnerability in a
system, software, or service.
● Purpose: To gain unauthorized access or execute code on the target.
● Example: Exploiting a vulnerable SMB(Server Message Block (SMB- tcp139,445 port))
service on Windows (like the famous EternalBlue exploit used in WannaCry
ransomware).
2. Payload
● Definition: A payload is the code that runs after a successful exploit. It defines what
you want to do on the target machine.
● Types of Payloads:
○ Reverse Shell: The victim connects back to the attacker (more common).
○ Bind Shell: The attacker connects to the victim’s system.
○ Meterpreter: A powerful, stealthy payload for advanced control.
3. Encoder
● Definition: Encoders are used to obfuscate (hide) the payload to bypass antivirus or
intrusion detection systems.
● Use Case: If your payload keeps getting caught by AV software, use an encoder.
4. NOPS (No Operation Instructions)
● Definition: NOPs are used to pad the buffer so that the payload executes reliably in
memory.
● Use Case: Helps in buffer overflow attacks where precise memory alignment is needed.
5. Auxiliary Modules
● Definition: These are non-exploit modules used for scanning, sniffing, fuzzing, etc.
● Use Case: When you want to gather information or perform other actions without
exploiting.
6. Meterpreter
● Definition: A special payload that provides an interactive shell with powerful features.
● Features:
○ Upload/Download files
○ Webcam snapshot
○ Keylogging
○ Process migration (move to another process)
7. Post Modules
● Definition: Used after exploitation to gather info or move deeper into the network.
● Use Case: Privilege escalation, dumping passwords, gathering tokens, etc.
8. Listeners/Handlers
● Definition: Listeners wait for incoming connections from reverse shells or sessions.
● Use Case: Required for reverse payloads where the target connects back.
Metasploit Core Libraries (Made Easy)
These libraries are the building blocks of the Metasploit Framework. They handle everything
from basic functionality to running exploits.
1. Rex Library
● Name Meaning: "Rex" = Reusable EXploitation library
● What it does: Think of it as the toolbox behind Metasploit. It provides all the low-level
functions needed to build exploits and payloads.
✅ Key Features:
● Socket handling (TCP/UDP)
● Protocol support (HTTP, FTP, SMB, etc.)
● Shell interaction
● Packet crafting
Example:
● When Metasploit opens a connection to a target system, Rex handles that connection.
● If you're scanning ports or crafting packets, Rex is behind the scenes doing it.
2. MSF Core
● What it does: This is the heart of the framework. It connects everything together —
modules, payloads, and the engine.
● It defines how modules are run, how options are handled, and how everything
communicates.
✅ Key Features:
● Module loading and execution
● Session management
● Logging and output
● Configuration handling
Example:
● When you type exploit, MSF Core runs the exploit module, sets options, and handles
responses.
3. MSF Base
● What it does: It’s like a helper layer built on top of MSF Core.
● Provides additional support like formatting output, simplifying commands, and making
module development easier.
✅ Key Features:
● User interface helpers
● Module class structure
● Utility functions for developers
Example:
● If MSF Core is the engine, MSF Base is the dashboard that helps you drive it.
● Rex = Low-level tools (networking, sockets, protocols)
● MSF Core = Manages how modules run and interact
● MSF Base = Provides support to developers and improves usability
Key Features of Metasploit Framework
1. Exploit Development & Execution
○ Contains a large database of pre-built exploits for various platforms.
○ Allows security testers to write custom exploits.
2. Payloads & Post-Exploitation
○ Supports Meterpreter, a powerful post-exploitation payload for maintaining
access.
○ Provides tools for privilege escalation, keylogging, screen capturing, etc.
3. Auxiliary Modules
○ Includes scanners, fuzzers, and brute-force tools to identify vulnerabilities.
○ Can be used for port scanning, service enumeration, and more.
4. Encoders & Obfuscation
○ Helps evade antivirus and intrusion detection systems (IDS).
○ Provides encoding techniques to bypass signature-based defenses.
5. Social Engineering Toolkit (SET) Integration
○ Enables phishing and human-based attacks.
○ Can create fake websites, credential harvesters, etc.
6. Exploitation Automation
○ Allows scripting & automation of attacks.
○ Uses MSFConsole, MSFVenom, and Meterpreter for streamlined testing.
7. Integration with Third-Party Tools
○ Works alongside Nmap, Wireshark, Burp Suite, and more.
Metasploit Components
1. MSFconsole – The main command-line interface for running Metasploit.
2. MSFvenom – A tool for creating custom payloads.
3. Meterpreter – A post-exploitation framework with powerful capabilities.
4. Exploits & Modules – A vast collection of scripts to compromise vulnerable systems.
Common Use Cases
Penetration Testing
Exploit Development
Vulnerability Assessment
Social Engineering
Red Teaming
Metasploit is a powerful and versatile tool, but it should only be used for legal and ethical
hacking purposes.
Auxiliary Modules in Metasploit (Basic Explanation)
Auxiliary modules in Metasploit are non-exploit modules used for various security tasks, such
as scanning, fuzzing, sniffing, and brute-forcing. Unlike exploits, auxiliary modules do not
attempt to gain control over a system but rather gather information, test vulnerabilities, or
perform network-based attacks.
Why Use Auxiliary Modules?
Faster and safer than exploits.
Used for scanning, gathering information, and testing vulnerabilities.
Useful for ethical hacking & penetration testing.
Metasploit Architecture
This diagram illustrates the architecture of the Metasploit Framework, showing its key
components and how they interact.
1. Libraries
The core of Metasploit is built using libraries, which provide the foundational code and
functionality for the framework. These libraries manage various tasks, such as handling exploits,
payloads, and network interactions.
● Rex Library
○ The Rex library is a foundational component responsible for handling network
communication, sockets, protocols, and tasks like HTTP requests, DNS resolution,
and more.
○ It supports exploits, payloads, and auxiliary functionalities.
● MSF Core
○ The MSF Core layer provides core functionalities of the framework, such as
managing modules, exploits, payloads, and post-exploitation tools.
○ It acts as the main control point connecting all libraries and modules.
● MSF Base
○ The MSF Base is the top layer of the libraries that handles user interaction, task
execution, and overall management.
○ It provides higher-level abstractions and interfaces with the tools, plugins, and
modules.
2. Interfaces
Metasploit provides multiple interfaces that allow users to interact with the framework. These
interfaces are designed for different use cases and preferences:
● Console
○ The most popular and powerful interface, MSFConsole, is a command-line tool
for accessing and using all Metasploit features.
● CLI
○ The Command-Line Interface (CLI) is used for scripting and automation,
providing a lightweight and direct way to execute Metasploit commands.
● Web
○ A web interface allows users to interact with Metasploit through a browser,
enabling remote access and simplified workflows.
● GUI
○ The Graphical User Interface (GUI) provides a user-friendly experience for
those less familiar with the command line.
3. Tools
Metasploit includes a variety of tools that leverage its libraries for tasks such as vulnerability
exploitation, payload generation, and post-exploitation.
4. Plugins
● Plugins extend the functionality of the framework by adding custom tools, integrations,
or enhancements.
● For example, plugins can integrate Metasploit with third-party tools like databases or
external scanners.
5. Modules
Modules are the core building blocks of Metasploit. They are categorized into several types, each
serving a specific purpose in the exploitation process:
● Payloads
○ Malicious code delivered to a target system after exploiting a vulnerability (e.g.,
reverse_shell or Meterpreter).
● Exploits
○ Scripts that take advantage of vulnerabilities to gain unauthorized access to
systems (e.g., ms17_010 exploit for EternalBlue).
● Encoders
○ Tools used to obfuscate payloads, helping them evade antivirus or IDS detection.
● Nops
○ No Operation (NOP) generators that maintain payload stability and size.
● Auxiliary Modules
○ Non-exploit modules for tasks like scanning, sniffing, brute-forcing, and more.
Summary of Workflow in the Diagram:
1. Libraries like Rex, MSF Core, and MSF Base provide the backbone of the framework.
2. Users interact with Metasploit through interfaces (Console, CLI, Web, or GUI).
3. Tools and plugins use the libraries to carry out tasks.
4. Modules (payloads, exploits, encoders, NOPs, auxiliary) are loaded and executed as
needed.
Obfuscation hides the original intent or meaning of code by converting it into a more complex
or encoded format.
It is widely used in both cybersecurity attacks (e.g., hiding payloads) and defensive practices
(e.g., protecting code).
1. Exploit Modules
● Purpose: Exploit modules are scripts or code that target known vulnerabilities in
software, hardware, or networks to gain unauthorized access or execute arbitrary code.
● Role in Penetration Testing: They are used to breach a system's security defenses by
exploiting its weaknesses.
Usage:
● Exploit modules are combined with payloads to execute malicious actions after the
vulnerability is successfully exploited.
2. Payload Modules
● Purpose: Payloads are the actual malicious code executed on the target system after a
successful exploit. They allow testers to control the compromised system or extract
sensitive information.
Types of Payloads:
1. Singles: Perform a single action and then terminate. (e.g., adding a user, dumping
passwords)
2. Stagers: Establish a connection to the attacker, allowing further communication.
3. Stages: Executed after a stager to carry out complex tasks (e.g., deploying Meterpreter).
3. Auxiliary Modules
● Purpose: These are non-exploit modules used for tasks like information gathering,
scanning, fuzzing, or brute-forcing. They do not exploit vulnerabilities but aid in
reconnaissance and testing.
● Usage: Auxiliary modules are used in the pre-exploitation phase to gather information
about the target system.
4. Encoder Modules
● Purpose: Encoders are used to obfuscate payloads to bypass antivirus (AV) and
intrusion detection systems (IDS).
● Role in Penetration Testing: By encoding a payload, attackers can avoid detection while
delivering malicious code.
● Usage: Encoders are applied to payloads before they are delivered to the target.
5. NOP (No Operation) Modules
● Purpose: NOP generators create sequences of "no-operation" instructions to pad the
payload. This ensures compatibility with the exploit and prevents instability.
● Role in Exploits: NOPs help maintain the correct payload size and alignment, ensuring
reliable execution.
● Usage: Typically used in buffer overflow exploits to maintain payload stability.
6. Post-Exploitation Modules
● Purpose: Post-exploitation modules are used after a successful compromise to gather
data, escalate privileges, or maintain access.
● Usage: These modules enhance the penetration testing process by performing tasks like
data extraction or system manipulation.
Workflow of Modules in Action
1. Use auxiliary modules to scan and gather information about the target.
2. Load an exploit module that matches the vulnerability.
3. Set a payload module to gain access or execute commands.
4. Use an encoder module to obfuscate the payload if needed.
5. Execute post-exploitation modules for further tasks like privilege escalation or data
extraction.