CST804 Ethical Hacking and Penetration Testing
CST804 Ethical Hacking and Penetration Testing
Introduction
CST804 – Ethical Hacking and Penetration Testing is a 3-credit unit. The
course is a core course in second semester. It will take you 15 weeks to
complete the course. You are to spend 91 hours of study for a period of
13 weeks while the first week is for orientation and the last week is for
end of semester examination. The credit earned in this course is part of
the requirement for graduation.
You will receive the course material which you can read online or
download and read off-line. The online course material is integrated in the
Learning Management System (LMS). All activities in this course will be
held in the LMS. All you need to know in this course is presented in the
following sub-headings.
Course Competencies
By the end of this course, you will gain competency in:
Course Objectives
The course objectives are to:
i
outcome(s) is the central point which help to measure your achievement
or success in the course. Therefore, study the intended learning
outcome(s) before going to the main content and at the end of the unit,
revisit the intended learning outcome(s) to check if you have achieved the
learning outcomes. Work through the unit again if you have not attained
the stated learning outcomes.
There are thirteen units in this course. Each unit represent a week of
study.
Presentation Schedule
The weekly activities are presented in Table 1 while the required hours of
study and the activities are presented in Table 2. This will guide your
study time. You may spend more time in completing each module or unit.
ii
Table I: Weekly Activities
Week Activity
1 Orientation and course guide
2 Module 1 Unit 1
3 Module 1 Unit 2
4 Module 1 Unit 3
5 Module 2 Unit 1
6 Module 2 Unit 2
7 Module 2 Unit 2
8 Module 3 Unit 1
9 Module 3 Unit 2
10 Module 3 Unit 3
11 Module 4 Unit 1
12 Module 4 Unit 2
13 Module 4 Units 3 and 4
14 Revision and response to questionnaire
15 Examination
Assessment
Table 3 presents the mode you will be assessed.
Table 3: Assessment
S/N Method of Assessment Score (%)
1 Portfolios 10
2 Mini Projects with presentation 20
3 Laboratory Practical 20
4 Assignments 10
5 Final Examination 40
Total 100
iii
Portfolio
A portfolio has been created for you tagged “My Portfolio”. With the use
of Microsoft Word, state the knowledge you gained in every Module and in
not more than three sentences explain how you were able to apply the
knowledge to solve problems or challenges in your context or how you
intend to apply the knowledge. Use this Table format:
Laboratory Practical
The laboratory practical may be virtual or face-to-face or both depending
on the nature of the activity. You will receive further guidance from your
facilitator.
Assignments
Take the assignment and click on the submission button to submit. The
assignment will be scored, and you will receive a feedback.
Examination
Finally, the examination will help to test the cognitive domain. The test
items will be mostly application, and evaluation test items that will lead to
creation of new knowledge/idea.
iv
How to get the Most from the Course
To get the most in this course, you:
Need a personal laptop. The use of mobile phone only may not give
you the desirable environment to work.
Need regular and stable internet.
Need to install the recommended software.
Must work through the course step by step starting with the
programme orientation.
Must not plagiarise or impersonate. These are serious offences that
could terminate your studentship. Plagiarism check will be used to
run all your submissions.
Must do all the assessments following given instructions.
Must create time daily to attend to your study.
Facilitation
There will be two forms of facilitation – synchronous and asynchronous.
The synchronous will be held through video conferencing according to
weekly schedule. During the synchronous facilitation:
There will be two hours of online real time contact per week making
a total of 26 hours for thirteen weeks of study time.
At the end of each video conferencing, the video will be uploaded
for view at your pace.
You are to read the course material and do other assignments as
may be given before video conferencing time.
The facilitator will concentrate on main themes.
The facilitator will take you through the course guide in the first
lecture at the start date of facilitation
Read all the comments and notes of your facilitator especially on your
assignments, participate in forum discussions. This will give you
opportunity to socialise with others in the course and build your skill for
teamwork. You can raise any challenge encountered during your study. To
gain the maximum benefit from course facilitation, prepare a list of
v
questions before the synchronous session. You will learn a lot from
participating actively in the discussions.
Finally, respond to the questionnaire. This will help ACETEL to know your
areas of challenges and how to improve on them for the review of the
course materials and lectures.
Learner Support
You will receive the following support:
vi
Course Information
Course Team
Course Developer: ACETEL
Course Writers: Dr Abayomu Joshua Jegede and Dr Muhammed
Aminu Ahmed
Content Editor: Dr Ismaila Idris
Instructional Designers:Inegbedion, Juliet O. (PhD) and Dr Lukuman Bello
Learning Technologists: Dr Adewale Adesina and Mr Miracle David
Graphic Artist: Mr Henry Udeh
Proofreader: Mr Awe Olaniyan Joseph
1
Module 1: Overview of Hacking
Module Introduction
This module presents an overview of hacking and the techniques used by
hackers. The module discusses how hacking activities such as
footprinting, target scanning and covering of track on systems and
networks. Also discussed are the techniques tools used to carry out these
activities and ways by which you can protect your network against
intrusions. The module consists of the following units.
Unit 1: Footprinting
Unit 2: Target Scanning
Unit 3: Covering of Tracks
Unit 1: Footprinting
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Introduction to Hacking
3.1.1 Types of Hackers
3.1.2 Phases in Hacking
3.2 Foot printing
3.2.1 Sources of Information
3.2.2 Advantages of Foot printing
3.2.3 Countermeasures against Foot Printing
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, you will acquire skills for gathering useful information about a
target to be hacked. To achieve this, you will learn about the techniques
and tools used to obtain information that will simplify the task of breaking
into a target system or network.
2
2.0 Intended Learning Outcomes (ILOs)
By the end of this unit, you will be able to:
You have heard about hacking since the beginning of this module. From
what you have learnt about hacking, is it legal or illegal?
3
3.1.1 Types of Hackers
Hackers are classified in terms of the actors and their motivation. There
are seven main types of hackers as illustrated by By McAfee on Mar 16,
2011. Click on this link or here to read it.
White Hat Hackers: These are the computer security experts who
use penetration testing techniques to verify the security of an
organisations systems and network. They use a wide array of tools,
techniques and methodologies to combat the activities of malicious
hackers.
Black Hat Hackers: These are malicious hackers who attempt to
secure unauthorised access to networks or computers or create
computer viruses, worms or any other malicious codes. Black hat
hackers leverage technologies and human to find the path of least
resistance in a system or network. Black hat hackers are often
referred to as “crackers”, and their motivation is to achieve financial
gain.
Script Kiddies: These are black hat hackers who use downloaded
programs known as scripts to attack networks. They usually engage
in website defacement, and their motivation is to have fun.
Hacktivists: This category of hackers are motivated by politics,
religion, human right or the desire for revenge.
State-Sponsored Hackers: Governments of different nations
attempt to control cyberspace to achieve specific military and
defence objectives. Governments fund state-sponsored hackers,
and they have immense time, skills and resources to attack civilian,
corporate, and governments systems.
Spy Hackers: They are hired by corporations to infiltrate the
networks of competitors and steal valuable information such as
customer data, product design, and steal trade secrets. Spy hacking
may occur in the form of internal or external attack.
Cyber Terrorists: These groups are usually motivated by religious
or political beliefs. They attack critical infrastructures such as
nuclear system, transportation network and electricity distribution
systems. They are the most dangerous, and their ultimate goal is to
fear, chaos and commit murder.
4
Phase 1: Reconnaissance
Reconnaissance or footprinting involves gathering preliminary data or
intelligence on the target organization to enable a hacker plan for the
attack.
Phase 2: Scanning
The phase uses technical tools to gather more detailed intelligence on the
systems and applications on the target organisation’s network. An
example is the use of a vulnerability scanner to collect information on the
weaknesses inherent in the target network.
Figure 1 illustrates the phases of hacking (Canavan, 2001). The only thing
omitted in the diagram is covering of tracks. It was assumed that it forms
part of the access maintenance phase because a hacker must continue to
remain unnoticed to maintain continuous access to the network.
5
You will observe that the upper part of the inverted triangle is wider than
the lower part. This shows that the phases proceed from the general to
the specific. The earlier phases involve carrying out a wide array of
activities on many targets and produces a large amount of information.
The lower phases are more specific and focus on a few targets.
3.2 Footprinting
This is the process used to gather information about the target network in
order to find the weaknesses that may be used to exploit the system
(Engebretson, 2013). Footprinting involves profiling an organisation to
collect information about the systems, network and people associated
with to the organisation. An ethical hacker spends a lot of time gathering
information about the target organisation’s computer systems and uses
this information to penetrate the network. Footprinting enables an ethical
hacker to know as much as possible about a system, its ports and
services, security capabilities and whether it supports remote access.
Businesses carry out footprinting to identify vulnerabilities so they can
address them and make changes to the business policy.
6
Projects involving other companies.
Legal documents of the company.
News relating company website.
Patents and Trademarks.
Important dates about new projects
7
contain information about the operating systems, network devices and
hardware the organisation uses. It may also give a hacker an idea of the
systems and network configuration of the organisation. Hackers can use
this information to determine the vulnerabilities in the hardware and
software which the organisation uses. They can also create a list of
possible attacks that may be used to take advantage of the
vulnerabilities.
Search Engines: Hackers use search engines such as Google to carry out
detailed searches on an individual or devices. An attacker can use the
right keywords on Google search to find relevant personal information
such as an address, phone number, net worth, etc. about a target. A
hacker can also use an approach known as Google hacking to combine
basic search techniques with advanced operators such as
“inurl:”,”allinurl:”,”filetype:”, etc. to carry out devastating attacks. This
method can be used to find internet enabled devices By typing a search
string such as inurl:”ViewerFrame?Mode=” will help an attacker find
public web cameras. “The “link:” search operator in Google can be used to
obtain results only from specified sites. Google’s advanced search
features enable a hacker to find websites that are affiliated to the target.
Affiliate websites belong to vendors, suppliers and clients and contain
back-links to the victim’s website.
It is possible to use switches to carry out a more in-depth search and gain
access to files belonging to an organisation. To discover a specific file or
word on the website of company XYZ, type the following line into Google
Google Groups
Google Groups contain a wide array of publicly available personal
information, such as domain names, IP addresses and usernames.
Members share a lot of information on Google Groups, and some of this
information may relate to a system and network security.
8
Eavesdropping: An attacker uses this to record a personal
conversation between the target victim and other people, usually
over communication mediums like telephone.
Shoulder Surfing: In this case, an attacker looks over the victim’s
shoulder while he (the victim) is typing sensitive personal
information such as Email address, password, ATM PIN, etc.
Phishing: Attackers create fake websites or webpages similar to
genuine ones. They use this method to obtain personal information
by tricking unsuspecting victims to create accounts and log onto
malicious sites. This method is used to obtain personal data such
as email-id and passwords of social media accounts.
Older versions of websites are available in an archival form and are stored
in a website known as archive.org. The archived versions are snapshots of
all websites that are collected at regular intervals. Archived.com provides
hackers with access to website information and features that might have
changed over time.
Web Crawling
Web crawling involves mirroring a website and downloading all the
publicly accessible files from the website. This allows a hacker to scan the
target website offline. An attacker can use the saved website to uncover
information about the configuration and layout of the website, files and
directories, the source code for the web pages, names and addresses of
IT employees and comments about the workings of code.
Who is: Hackers use the Whois website to obtain information about the
domain name, email-id and domain owner. It is a tool for Website
Footprinting; that is, it enables a hacker to trace a website.
Does footprinting have any benefit? If so, what are the benefits?
9
3.2.2 Advantages of Footprinting
Hackers use footprinting to know the basic security configurations of
a target machine or network. It also provides information about
network route and data flow.
It simplifies the hacking process. A hacker who finds vulnerabilities
can focus on specific attacks that can be launched against the target
machine.
It reduces the attacks surface. It allows the hacker to identify which
machines are most vulnerable and can be attacked easily.
Discussion
Social media sites like Facebook, Twitter, Instagram and LinkedIn contain
photographs, names, sex, dates of birth and phone numbers and other
personal details of people. Click on the profiles of your friends and other
people. Which personal information can you find about them? In which
ways do you think hackers can use this information to attack social media
users?
Case Studies
Real-life Scenario
Stuxnet was believed to have gained access to the Natanz nuclear plant
via an infected memory device (USB stick). It was highly probable that
an individual would have inserted the USB into one of the computers on
10
the nuclear plant’s network. The worm then became automatically
installed on infected computer system.
Stuxnet spread through the plant’s network quickly, looking for computers
that control centrifuges. Once it infected the computer system, it
searched for software that controlled the centrifuges. Centrifuges are
machines which separates nuclear materials into different components by
spinning them at high speeds. The operators in Natanz plant used the
centrifuges to separate different types of uranium and isolate the
component (called ‘enriched uranium’) that is used as the raw material for
both nuclear power and nuclear weapons.
The severity of the attack created the need for the replacement of about
1,000 fuel enrichment centrifuges. The extremely high speeds of
operation led to the disintegration of the infected machines. Overall,
about 20 per cent of the centrifuges was decommissioned as a result of
this exploit.
Mini project
A hacker can do people search on websites containing information about
organisations and their employees. Search the following websites and
discuss your findings.
12
1. yahoo finance (click here to access the website)
2. Nigeria securities and exchange commission (click here to access
the website)
3. The United States patent and trademark office (click here to access
the website)
4. LexisNexis Risk Solutions (click here to access the website)
Enter the names and addresses of some people and organisations you
know. Record as many as possible personal and corporate information
you can gather on the people and organisations. You can screenshot your
findings then submit to your tutor.
5.0 Conclusion
A hacker needs to obtain relevant information about a target organisation
in order to penetrate the system. The information is used to determine
the range of systems in the organisation’s network, the security
infrastructures, architecture and configuration of the organisation, and the
vulnerabilities inherent in the devices and application on the network.
6.0 Summary
In this unit, you have learnt about footprinting, the purpose of
footprinting, sources of information, and types of information gathering
techniques. You have also learned the advantages of footprinting and
ways to prevent footprinting.
14
Unit 2: Target Scanning
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Scanning: Definition and Purpose
3.1.1 Phases in Scanning
3.1.2 TCP Handshake
3.2 Port Scanning
3.2.1 Types of Port Scan
3.2.2 Tools for Port Scanning
3.2.3 Banner Grabbing
3.3 Network Scanning
3.3.1 Nmap for Network Scanning
3.3.2 Nikto for Network Scanning
3.3.3 Nessus for Network Scanning
3.4 Vulnerability Scanning
3.4.1 Tools and Steps Used for Vulnerability Scanning
3.4.2 Countermeasures Against Vulnerability Scanning
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, you will acquire the skills for identifying vulnerabilities and
threats in the target network. To achieve this, you will learn about the
tools and techniques for discovering active hosts, ports, and services, as
well as operating system and architecture of the target environment.
define scanning
perform various types of scanning
identify and use the scanning tools
discuss the phases of scanning.
15
3.0 Main Content
3.1 Scanning: Definition and Purpose
Scanning refers to the use of complex and aggressive reconnaissance
techniques to identify live hosts, ports, and services, as well as operating
system and architecture of a target system (Helba, 2010). This enables
the hacker to know the vulnerabilities and threats inherent in the
network.
o Check for Open Ports: This helps the hacker to discover open
ports, services running on them, their versions etc. NetScan Tools
Pro and Nmap are powerful tools used mainly for this purpose. An
ethical hacker uses a network analyzer, such as Wireshark to
monitor network traffic on open ports.
There are three major types of scanning used in ethical hacking (Hall and
Watson, 2016):
Port scanning
Network scanning
Vulnerability scanning
Detect Live Systems -> Look for Open Ports -> Find out the running
services -> Identify the Operating System (OS Footprinting) -> Scan
Vulnerabilities -> Document details and draw Network diagram -
> Prepare Proxies to avoid being caught -> Proceed with Exploitation.
16
2007). A client and a server use Transmission Control Protocol (TCP) and
Internet Protocol (IP) for handshaking. The client sends an SYN
(synchronisation) packet to indicate that it wishes to establish a
connection. If the server is available, it responds with an SYN/ACK packet
to the client. The client sends an ACK packet to the server to indicate the
receipt of the message from the server. An SYN (denotes synchronise) is
used to initialise connections between the client and the
server. ACK (denotes acknowledgement) is used to establish a connection
between two hosts.
17
1. Well known Ports: assigned numbers ranging from 0 to 1023
2. Registered ports: assigned numbers ranging from 1024 to 49151
3. Dynamic Ports: assigned numbers ranging from 49152 to 65535
18
Fig. 4: Half-Open Scan
FIN scan: Works by setting the FIN flag in the TCP packets sent to
the target. The FIN flag indicates an end to data communication and
terminates a TCP/IP connection. Open ports on a target who
receives a FIN scan on do not send a response, while closed ports
responds with a reset. Figure 6 illustrates the fin scan.
ACK scan: Here, the attacker first sets the ACK flag in the TCP header
and then uses window size and TTL value of RESET packets to obtain the
status of the ports on the target machine. Ack scan mode of operation is
presented in Figure 7 below
19
Fig. 7: ACK Scan
Null Scan: Here, an attacker sends TCP packets with no flags set to the
target. No response is received from open ports, while closed ports
respond with a RESET packet.
Idle Scan: Attacker uses this technique to mask his identity on an idle
machine to probe the status details of target ports.
20
3.2.2 Tools for Scanning
A set of tools are used to carry out port scanning. One of such is NMAP.
NMAP is a very popular tool used for port scanning. It is available for
Windows command-line interface (CLI) as Nmap, and for the graphical
user interface as (GUI) as Zenmap.
Click this link for a video on practical demonstration of scan types and
options using Nmap.
After download, you can easily install Nmap. This screen will appear once
the installation is complete. You need to specify the target IP address or a
range of IP addresses, and the type of scan you want to perform under
“Profile”.
Zenmap provides you with a GUI where you can enter details such as the
target IP address or a range of IP addresses, and the type of scan you
want to perform. It also provides command-line equivalent as you can
directly copy the syntax or command from the GUI and run it on CLI.
21
nmap -p 1-65535 -T4 -A -v 192.168.12.131
To find the operating system of a host, use the ‘O’ switch, as shown in the
following command.
nmap -O 192.168.12.131
nmap 192.168.1.1/24
nmap 192.168.1.1-20
It is also possible for nmap to read IP addresses from a file. The -iL option
is used to achieve this. This is illustrated using the following example:
You may exclude some hosts from a scan if you do not want to access the
full network. Use the following syntax:
22
nmap -PN server1.domain1.com
nmap -6 server1.domain1.com
nmap -6 2302:f0e0:1001:41::3
Use the following syntax if you want to access only open ports
The MAC addresses and interface routes are hidden for security purposes,
but you can see all the details if you perform the scan in a secure
environment such as a lab.
Ports 80, 21, and 25 are examples of service ports used for banner
grabbing. Services running on ports 80, 21, and 25 are those used by
HTTP (HyperText Transfer Protocol), FTP (File Transfer Protocol), and
SMTP (Simple Mail Transfer Protocol) respectively. Netcat is the most
commonly used tool for banner grabbing. Other suitable tools for banner
grabbing are Telnet, Nmap and ZMap. Netcat uses TCP or UDP protocol to
23
read and write data to and from various sources and destinations on the
network. Netcat can also be used for creating a backdoor, chat, and port
scanning. Netcat is available for Windows and Linux operating systems.
[root@prober]# nc www.victimhost.com 80
HEAD / HTTP/1.1
HTTP/1.1 200 OK
Date: Mon, 10 Aug 2019 22:10:40 EST
Server: Apache/2.0.46 (Unix) (Red Hat/Linux)
Last-Modified: Thu, 16 Jul 2019 11:20:14 PST
ETag: “1986-69b-123a4bc6”
Accept-Ranges: bytes
Content-Length: 1110
Connection: close
Content-Type: text/html
An attacker can also use this information to get a narrow view of possible
exploits he can launch against the target. It is also possible to use Netcat
for banner grabbing attacks against web servers by connecting to port 80
and then sending a HEAD / HTTP/1.0 or HEAD / HTTP/1.1 request
depending on the protocol which runs on the servers.
When you come across the word “network scanning”, what comes to your
mind?
24
the vulnerabilities in the system before a malicious hacker can use the
same weaknesses to exploit the network. This can be done using tools or
scripts to probe all IP addresses on the network and obtain a list of the
active nodes and their IP addresses.
$ nmap 172.16.254.1
$ nmap www.example.com
You can use Nmap to display open ports on the network. The option ‘v‘ is
used to obtain a verbose (detailed) output and option ‘A‘ is to identify the
operating system. You can use many options to make Nmap tool produce
different kinds of results. The Nmap tutorial provides further information
on the usage and options of Nmap. See the video of network scanning
using Nmap. It shows the procedures and commands for carrying out
network scanning using Nmap.
25
The result of the scan reveals the vulnerabilities in the network or
application being scanned. You can choose relevant exploits once you
know the weaknesses of the network.
Enter your first name, last name, and email address. You will receive a
link via your address. A click on the link will redirect you to the download
page. You can download a suitable file, such as .deb file for AMD64,
which is compatible with the Kali Linux operating system. At the end of
the download, install Nesses using the following command:
$ cd Downloads
$ dpkg -I Nessus-8.3.0-ubuntu910_amd64.deb
Nessus will be installed, and now you will have to start the Nessus service
to use it. Use the following command to start the Nessus application:
$ /etc.init.d/nessusd start
Enter a username and a password. Enter the activation code (that was
sent to your Email Id) in the next page. Nessus will download the
necessary plugins after successful activation.
To scan a network, click on “New Scan” on the top right corner. This will
show you different types of scans that Nessus provides. Enter the name
for your scan, description, folder, and the target and click on “Save“. At
the end of the scan, you can view the vulnerability report under the
“Vulnerabilities” tab.
Click on this link for a video of a simulation of scanning using nessus. The
video provides a practical demonstration of the use of Nessus to detect
open ports on the network.
26
detect the likelihood of network security attacks. Vulnerability scanning
identifies weaknesses due to application programming errors or network
misconfiguration. The can technique to detect weaknesses such as
unnecessary services, missing updates, weak authentication or weak
encryption algorithm. You should compile a list of vulnerabilities found
during scanning. Note that vulnerability scanning requires an internet
connection and the use of automated tools.
Open Windows OS
Press Win+R (Run) buttons in combination
In the Run, type- cmd
Type the command: ping IP Address or type: ping DomainName
Ping
Ping works by sending an ICMP echo request to the target’s domain name
or IP address. The target will respond with an ICMP Reply if it is active.
This will also help a hacker to know if ICMP request can bypass a firewall.
Most organisations block ICMP requests to prevent attacks. See Figure 9
for an illustration of the ICMP probe.
There is a popular tool used to perform ping scanning, can you identify
this tool?
Nessus is a popular tool for ping scanning. It is also a powerful tool which
can identify many gives vulnerabilities on the target. The tool helps in
data collection, identification of live hosts, port scanning and preparation
of vulnerability of report.
27
severity of the vulnerabilities. Click on this link for a video of a simulation
of vulnerability scanning using Nessus. The video provides a practical
demonstration of the use of Nessus to detect weaknesses that a hacker
can use to exploit a network.
Another important tool for vulnerability scanning is GFI LAN guard. The
tool is used for network inventory and vulnerabilities on the nodes or
servers.
Discussion
Many authors have claimed that TCP/IP handshaking is crucial to target
scanning. Do you agree with this?
Kali Linux virtual machine provides the environment and resources for
practising target scanning. Nmap is one of the major tools used for port
scanning.
28
Run the various Nmap commands on the Nmap website. What are your
findings?
Case Studies
"It is very easy to use, thus allowed everyone in our team to cooperate.
Of course, the ability to customise, scan, and automate the tasks was a
big plus. Netsparker helped us identify the areas to remediate before we
migrated new code into the production environment."
29
Why is it necessary for security professionals to perform regular
vulnerability assessment on their systems and networks?
30
7. Which of the following tools is suitable for both network scanning
and vulnerability scanning? Choose all that apply
A. Nessus
B. Nikkito
C. Nmap
D. Ping
Correct Answer: A,B,D
Portfolio
Kali Linux virtual machine provides the environment and resources for
practising target scanning. Nmap is one of the major tools used for port
scanning. Perform the following tasks to demonstrate the Nmap scan:
1. Download and install Kali Linux OS virtual machine on your
computer.
2. Download and install Nmap (though Nmap is pre-installed on Linux
OS).
3. Run the various Nmap commands on the Nmap website.
4. Document your findings and submit it to your tutor.
5.0 Conclusion
Hackers and security professionals use target scanning to access the
security of systems, networks and application. They use complex and
powerful tools and techniques to discover active hosts, ports, and
services, as well as operating system and architecture of the target
environment. This enables them to identify the vulnerabilities, threats as
well as a variety of attacks that can be used to exploit devices in the
target environment.
6.0 Summary
In this unit, you have learned the procedures, tools and techniques for
discovering active hosts, ports, and services, as well as operating system
and architecture of a target environment. This knowledge will enable you
to identify vulnerabilities and threats in a target network. You will also be
able to determine the range of attacks you can launch against the
systems and applications in the target environment.
31
7.0 References/Further Reading
Allen, L., Heriyanto, T. & Ali, S. (2014). Kali Linux – Assuring Security by
Penetration Testing. UK: Packt Publishing Ltd.
32
Unit 3: Covering of Tracks
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Disable Auditing
3.2 Clearing Logs
3.2.1 Tools for Clearing Logs
3.3 Modifying Logs and Registry Files
3.4 Removing Folders and Files Created
3.5 Covering Track on Network
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, you will acquire the skills required to avoid detection after
carrying out penetration testing activities. To achieve this, you will learn
the methods, tools and techniques hackers and penetration testers use to
eliminate traces of their activities on systems, networks and applications.
Covering tracks is the final stage of a hacking process. Its goal is to erase
electronic traces of the activities of the hacker on the targeted computer
system or network. The process consists of a set of anti-incident response
measures (that is, activities for the prevention of real-time detection) and
33
anti-forensics measures (for the prevention of digital evidence collection)
during a post-incident investigation. At the end of the hacking process,
the attacker will want to erase digital footprints that may be used to trace
his activities on the network. A hacker carries out the following activities
to prevent investigators from tracing him:
Disable auditing.
Clearing logs.
Modify logs and registry files.
Remove all files and folders created.
34
Incident response activities are more urgent and more time-constrained
than those by investigators.
First, run Metasploit on the system and launch the meterpreter command
prompt. The type:
35
the security, application, or security logs. For example, to clear the
security logs, type:
clearlogs.exe -sec
You can confirm whether all security events have been cleared by clicking
on the Event Viewer and then clicking on Security events.
Ensure that you remove clearlogs.exe after pen testing as its mere
presence of the clearlogs file can indicate that an intruder has
compromised the system.
kwrite /var/log/messages
An attacker may open this file in a text editor and simply delete all the
entries before leaving the compromised system. Alternatively, He may
carefully go through and delete any entries related specifically to his
activities if he has the luxury of time.
echo $HISTSIZE
export HISTSIZE=0
to set it to zero.
36
This will delete the entire information in the Linux shell. A hacker can set
export HISTSIZE to zero before beginning the hack to prevent the system
from storing any of his commands. Alternatively, erase command history
by logging out and logging back in to after setting the HISTSIZE to zero in
case he has already written some commands
The shred command with the -zu switch overwrites the history with zeros
and deletes the file.
more /root/.bashhistory
Click this link for a video on how to clear tracks logs on Linux. The video
provides a detailed understanding of the procedures and commands that
a hacker can use to clear his tracks after compromising a Linux system or
network.
Windows-based computer systems stores all log files in the event viewer.
You can find the events via the “Search” bar. Linux and UNIX operating
systems store log files in the /var/log directory. Administrators examine
the log files to check for malicious activities in the system they monitor.
Log files may be system generated or application generated. An attacker
can manipulate log files either by deleting an entire log or altering its
content. Any of these options prevents an administrator from detecting
evidence of the attack.
37
two options: prevent the transfer of logs to the dedicated server or
attempt to compromise the log server
38
Fig. 11: Reverse HTTP
39
The proxy server, in turn, de-encapsulates the ICMP packet,
extracts the TCP payload and sends it to the attacker. This looks
like normal traffic to network security devices.
Examples of tools for tunnelling include:
Loki
PingChat
Ptunnel
ICMPShell
ICMPCmd
40
Receiving server receives this information and retrieves
the character from sequence number field.
TCP initial sequence number: This method does not
even require an established connection as is required in
the IP identification method. An SYN packet is sent with
an ISNa (initial sequence number) containing the
payload (bit). Even though if it gets a RESET in reply,
the content is already extracted by the other side.
Discussion
Hackers and pen testers usually attempt to cover their tracks after
hacking activities. Why do you think this is necessary?
Case Studies
Examples of log attacks:
41
4.0 Self-Assessment Exercise(s)
1. Which of these steps do hackers take to prevent the auditing team
from tracing their activities?
a) Disable firewall
b) Disconnect network access
c) Modifying logs and registry files
d) Removing all application software
Answer: C
Answer: B
5.0 Conclusion
Hackers and pen testers must avoid detection as much as possible.
Hence, they must disable auditing, clearing logs, modifying logs and
registry files and remove all files and folders created. These tasks require
knowledge of procedures, tools and techniques for covering tracks and
erase evidence of their activities on the systems and applications in the
target environment.
6.0 Summary
In this unit, you have learned the skills required to avoid detection after
carrying out penetration testing activities. You have also learned the
methods, tools and techniques hackers and penetration testers use to
eliminate traces of their activities on systems, networks and applications.
Bosworth, S., Kabay, M.E. & Whyne, E. (Eds.).( 2014). Computer Security
Handbook. (6th ed.). Vol. 1, Wiley & Sons, Inc.
44
Module 2: Targetted Attacks
Module Introduction
Operating systems and application vulnerabilities provide gateways for
attackers to compromise the security of systems and networks. This
module focuses on the methodologies, tools and techniques for evaluating
the security of two popular operating systems (Windows and Linux) as
well as web applications. These approaches enable hackers and pen
testers to identify vulnerabilities which may be used to exploit the system.
Ethical hackers use these methods to detect holes in their systems and
applications, and quickly fix known weaknesses or vulnerabilities that may
be used to compromise their systems.
1.0 Introduction
In this unit, you will acquire the skills for evaluating the security of the
Windows operating system. To achieve this, you will learn the
vulnerabilities inherent in Windows OS and the attacks that can be used
to exploit these vulnerabilities. You will also learn the methods, tools and
techniques hackers and penetration testers use to exploit systems and
networks that run on Windows.
46
makes a program to (1) exhibit improper behaviour (under normal or
extreme conditions) and (2) allow hackers to take advantage of
weaknesses (or improper operation) to crash or gain unauthorized access
or control of a system (Anonymous, 2001). A primary flaw is a weakness
in the security structure of the operating system, which allows a hacker to
gain one-step, unauthorised access to the system or datase. A secondary
flaw is any weaknesses in a program that may not be related to security,
but causes a security issue in other parts of the system. An example of a
secondary security flaw is the requirement of root or superuser privileges
to complete a task in a program.
What happens if the reply does not come from Computer B, but from
another device controlled by an attacker? This is what leads to ARP
spoofing.
47
the link for a video on ARP poisoning. This makes any traffic meant for
the legitimate host to be redirected to the attacker. Attackers use ARP
spoofing to capture data frames, modify traffic, or interrupt all network
traffic. It may also be a precursor to other attacks, such as a denial of
service, man in the middle (See the video on simulation man in the
middle attack using ARP spoofing), and session hijacking. The attack can
only be launched against networks running the ARP and requires a hacker
to have direct access to the target network segment. Click this link for a
simulation of ARP spoofing.
Attackers use physical (such as an infected USB drive) and virtual means
(via the internet) to infect devices and networks with malware. The drive-
by-download attack automatically downloads malware to systems without
the user's permission or knowledge. Hackers also spread malware through
phishing attacks, where emails containing malicious links or attachments
are sent to unsuspecting users. In sophisticated malware attacks, a
hacker sets up a command-and-control server which enables him to
48
connect to infected systems. This allows the attacker to steal sensitive
data and even control the compromised system or server from a remote
location. Emerging strains of malware use evasion and obfuscation
techniques to prevent security administrators and anti-malware products
from detecting them.
3.2.1 Virus
A computer virus is a malicious program that replicates by attaching itself
to another program. A virus usually spreads when an unsuspecting user
runs an infected program or downloads an infected file, usually in the
form of an email attachment. Computer viruses perform two main
functions, namely propagation and destruction (Stewart, 2015). Hackers
infect vulnerable systems with viruses to gain administrative control and
steal sensitive data.
Virus scanning programs identify the “signature’ of known viruses and use
it to build a database of known signatures. The database is compared to
scanning results, and a match indicates the presence of a virus. The
database requires regular updates to ensure that the virus scanner does
not become outdated quickly. Windows OS is vulnerable to virus codes
such as Melissa, Sasser, Zeus, Conficker, Stuxnet and Mydoom (Hall and
Watson, 2016). Common antivirus software for Windows systems include
Windows Defender, Norton, Kaspersky, Panda, Bit defender, and Trend
micro
3.2.2 Worm
A worm is a self-contained (or independent program) that is usually
designed to propagate without human intervention (Stewart, 2015). A
worm replicates itself on infected systems and uses available network
connections to infect other systems. The main difference between a worm
and a virus is the mode of propagation. A worm propagates without
attaching itself to an executable file, but a virus requires an attachment to
an executable file to propagate itself.
49
backdoor, which allows an attacker to control the infected computer
remotely. A worm attack may also involve networks of computers (often
referred to as botnets) which are commonly used for malicious purposes,
such as spam and DoS attacks. Common defences against worms involve
the use of antivirus and anti-spyware software. These must be updated
regularly to ensure detection of new strains of worms which surface
almost every day. A firewall also offers protection against worm attack.
This video shows the differences between Viruses, Worms and Trojans.
3.2.4 Ransomware
Hackers use ransomware attack to hold a computer or its resources
hostage until the legitimate owner pays a ransom (money), usually in
bitcoin. The malicious code identifies the drives on an infected system or
network, encrypts the files in each drive and prevents legitimate users
from gaining access to the files. One of the indicators of a ransomware
attack is the addition of an extension to the encrypted file. Popular
extensions use by ransomware include .aaa,
.micro, .encrypted, .ttt, .xyz, .zzz,
.locky, .crypt, .cryptolocker, .vault, or .petya. Each extension is used to
identify the type of ransomware that has attacked the file. The attacker
also creates and displays a file (or files) containing instructions on how to
pay the ransom. The attacker provides a cryptographic key to unlock the
files once the victim pays the ransom.
50
applications against ransomware attacks, you can use Comodo Advanced
Endpoint Protection.
51
Adware monitors browser history and downloads, to predict the products
or services which the user is interested in. Adware is used for marketing
purposes and can reduce the performance of the computer. Protection
against spyware and adware infection includes the use of secure
passwords and regular update of applications on computers.
Dictionary attacks assume that most passwords are formed using words,
dates, or numbers that are found in a dictionary. Tools used for this
attack require a dictionary input list consisting of words and vocabularies.
Databases used as input list for dictionary attack can be downloaded from
the internet. Sometimes, attackers prefer to reset passwords, rather than
guessing them. This prevents a legitimate user from using his password
to access the infected system or application. Popular tools for password
reset attack include Petter Nordahl-Hagen program and Winternals ERD
Commander 2005. Password cracking is the recovery of a plaintext
password from a compromised password hash (or some other scrambled
or protected form of the plaintext password or challenge-response
packets). Hackers crack passwords by using tools such as extractors for
hash guessing; rainbow tables for looking up plaintext passwords; and
password sniffers to capture authentication data. Pwdump suite is a
popular Windows password hash extractor that can retrieve plaintext
52
passwords from LM (LAN Manager) password hash. Other password
crackers for Windows OS are John the Ripper and Cain & Abel.
A brute force (or exhaustive search) attack uses all possible combinations
of input to guess the correct password. The longer or complex the
password, the more combinations that will need to be tested, and the
more time consuming will be the attack. This means cracking a weak
password could merely take a few seconds and minimal effort. Strong
passwords created using sophisticated methods such as data obfuscation
are very difficult and sometimes almost impossible to crack. Hence,
organiSations should enforce a strong password policy across all systems
and networks. Password cracking may also involve sniffing authentication
traffic between a client and a server and extracting password hashes or
any other authentication information to crack the password. Examples of
sniffing password crackers are Cain & Abel, ScoopLM and KerbCrack. A
similar attack known as password capturing occurs when a hacker installs
a keyboard-sniffing Trojan horse or any other physical keyboard-logging
on the target system. Physical keyboard logging devices are small in size
(not up to an inch long) and can easily be installed (by inserting it
between the keyboard cable and the computer's keyboard port) on the
victim’s computer. It is also easy to sniff passwords from wireless
keyboards by installing wireless sniffers a few metres away from the
target. See video for simulation of brute force password cracking using
Medusa password cracking tool here.
53
Supported platforms: Windows, Linux, DOS, and OS X. You can use
this link to download John the Ripper.
Supported platforms: Windows and Linux. See the download link for
RainbowCrack here.
Cain and Abel has two components: a frontend and a backend. Cain is the
frontend application used to recover passwords and perform sniffing,
while Abel is the backend Windows NT service that performs traffic
scrambling.
Supported Platforms: Windows
54
OphCrack is a free tool which uses rainbow tables to crack password
hashes of Windows log-in passwords. OphCrack can retrieve the
passwords of a Windows computer within a short period of time
because it imports and uses multiple format hashes from different
sources.
55
3.4.2 Power Analysis Attack
A power analysis attack is based on an observation of the power rates of
a hardware device such as a CPU or cryptographic circuit. It consists of
two main types, namely simple power analysis (SPA) and differential
power analysis (DPA). A power analysis attack also occurs when
fluctuations in current generate radio waves. Attackers can extract
valuable information by using statistical techniques to analyze the
measurements of such electromagnetic emissions.
56
resources (memory, transmission channel) on the targeted server and
prevent it from responding to legitimate client requests.
SYN cookies: The server derives a sequence number from the client
IP address, port number, and other unique information and uses
cryptographic hashing to send its SYN-ACK response. The hash is
included in the ACK packet from the client. The server only allocates
memory for the connection after verifying the ACK.
57
RST cookies: Here, the server intentionally sends an invalid SYN-
ACK reply to the first connection request from a client. Normally,
the client generates an RST packet in response to the invalid SYN-
ACK received from the server. Once the server receives the RST
packet, it confirms the legitimacy of the request, logs the client, and
accepts subsequent incoming connections from it.
What does war dialling entails and how sophisticated can this attack be?
Which methods, tools and techniques would you use to evaluate the
security of your Windows platform?
Can you identify practical cases of attacks against Windows OS?
Discussion
Passwords are not stored in the server in plaintext format. They are
usually protected by encrypting them using appropriate cryptographic
algorithms. However, hackers use password crackers to reveal encrypted
(protected) passwords.
Why do you think it is necessary to protect passwords?
In which ways can hackers take advantage of compromised passwords?
59
4. Which of the following is not a characteristic of Trojan horse?
A. Trojan horse is a malicious program
B. Trojan horse program is usually hidden within another
program,
C. It can modify an existing program or replace an existing
program with a new one.
D. It can propagate without human intervention.
Answer: D
Assignment
Identify various kinds of password cracking tools.
Use one of the tools to crack passwords.
Post your findings, including screenshots to your course tutor.
5.0 Conclusion
Windows OS is the most commonly used operating system for
workstations and servers. This makes it a great target for many attackers.
Numerous exploits have been developed to compromise the security of
Windows OS and to gain unauthorized access to stored information.
Ethical hackers should have a mastery of the common vulnerabilities and
exploits used to attack Windows OS. Security professionals must have
60
expertise in methodologies, tools and techniques for cracking Windows
OS. This will enable them (system administrators) detect loopholes in
their systems before attackers can use such weakness to compromise the
security of their systems.
6.0 Summary
In this unit, you have acquired the skills for evaluating the security of
Windows-based systems and networks. The chapter introduced you the
vulnerabilities in Windows OS and the attacks that can be used to exploit
these vulnerabilities. You have also learned the methodologies, tools and
techniques used by hackers and pen testers to compromise the security of
Linux OS. In the next unit, you will learn about the vulnerabilities and
exploits that target Linux systems and networks.
Bosworth, S., Kabay, M.E. & Whyne, E. (Eds.).( 2014). Computer Security
Handbook. (6th ed.). Vol. 1, Wiley & Sons, Inc.
Brumley, B.B. & Tuveri, N. (2011). “Remote Timing Attacks are Still Practical.”
Proceedings of the 16th European conference on Research in computer
security, Pp. 355-371, Leuven, Belgium, Sept. 12-14, 2011. Springer-Verlag
Berlin, Heidelberg.
Engebretson, P. (2013). The Basics of Hacking and Penetration Testing. (2nd ed.).
Elsevier.
Ferrigno, J. & Hlaváč, M. (2008). When AES Blinks: Introducing Optical Side
Channel, IET Information Security, 2 (3): 94–98, doi:10.1049/iet-ifs:20080038
Stewart, J.M., Chapple, M. & Gibson, D. (2015) CISSP Certified Information Systems
Security Professional Study Guide. (7th ed.). John Wiley & Sons, Inc
61
Unit 2: Linux System
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Spoofing Attacks
3.2 Scanning
3.3 Denial of Service Attacks
3.4 Malware Attacks
3.5 Buffer Overflow
3.6 Wiretapping
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, you will acquire the skills for evaluating the security of the
Linux operating system. To achieve this, you will learn the vulnerabilities
inherent in Linux OS and the attacks that can be used to exploit these
vulnerabilities. You will also learn the methods, tools and techniques
hackers and penetration testers use to exploit systems and networks that
run on Linux.
Have you heard Linux users brag about the security of their systems?
62
Do you agree that Linux OS is very secure or even foolproof?
Which methods can hackers use to compromise Linux systems?
This video (here) describes the simulation of ARP spoofing. In Kali Linux
2016, ARP poisoning or spoofing requires the following steps:
1. Identify the IP address of the target host.
#ifconfig
2. Then look for the router’s mac address in the arp table.
#arp
3. Ping the target host and confirm if its mac address in now in the arp
table.
#ping Victim-IP
#arp
4. Set up IP forwarding using the following command.
#echo 1 > /proc/sys/net/ipv4/ip_forward
5. Check your default gateway.
#ip route
6. Identify the network interface.
#ifconfig
7. You can now begin the arp poisoning/spoofing using the following
commands.
#arpspoof -i eth0 -t victimIP -r DefaultGateway
-i is for the interface.
63
-t is for the target.
-r is for the default gateway.
Click this link for a video on simulation of a DNS spoofing attack. A tool
known as dnsspoof (a member of the Dsniff suite) is used to forge DNS
response for a DNS server on the local network. The dnsspoof tool forges
a response and diverts the request to the attacker’s system before the
legitimate DNS server responds. For example, consider 192.168.1.5 as
the DNS server and 192.168.1.245 as the victim. Assume we run the
following commands,
The attacker uses the first three commands to fool a victim (whose IP
address is 192.168.1.245) to believe that the attacker’s system is the
gateway (router). The final command listens for DNS traffic involving
192.168.1.245, and any queries for hosts beginning with www or mail will
be answered with an IP address of 192.168.1.100. If 192.168.1.245
attempts to open his web browser to yahoo website, the connection will
be diverted to the webserver running on 192.168.1.100, which is the
attacker’s machine.
64
D. configure a MAC address without modifying the manufacturer and
then activate the new MAC address automatically.
You can prevent MAC spoofing using both protection and active
detection (network monitoring and analysis). These include:
Enforce strict access controls to prevent unauthorized access to the
company’s network. This includes restricted access to the network
connection by visitors.
Ensure you do not allow unauthorized persons in the company’s
premises and that visitors are well monitored. This will prevent
unauthorized connection or manipulation of the internal network via
direct connection to the ethernet using a cable, thus bypassing the
Wi-Fi protection.
prevent eavesdropping of existing MAC addresses by implementing
IPsec technologies and encryption of trasmissions.
3.2 Scanning
65
sudo apt-get
update
sudo apt-get
upgrade -y
sudo apt-get install nmap -y
To use Nmap to identify open ports and running services on a server such
as the hackme server, simply type nmap and the server address. That is
nmap hackme.org
To scan UDP ports, include -sU option sudo command because the scan
requires root privileges.
To scan a server, enter its address and select any of available scan
options.
Netcat: Netcat is a raw TCP (and UDP) port writer and port
scanner. It is not as fast as Network Mapper because it uses
connect scan. To install it, type
ubuntu@ubuntu:~$ nc -z -v hackme.org 80
An output such as
66
Indicates that port 80 on the hackme server is open. An open port
means the server can communicate with other devices via the port.
shows that port 80 on hackme server uses the http (hypertext transfer
protocol), while port 22 runs on ssh (secure shell protocol). Both ports are
also open.
67
There are two main categories of Dos attacks, namely;
DoS: a single host performs this.
Distributed DoS: a type of DoS attack performed by a group of
compromised hosts that attack the same target.
3.3.2 Smurf
This involves sending a large number of Internet Control Message Protocol
(ICMP) packet to an Internet Broadcast Address. The attacker replaces
the reply IP address with that of the intended victim. Hosts on the
Internet broadcast Address send all their replies to the victim instead of
the IP used for the pings. A smurf attack rebroadcasts a single ping 255
times because a single Internet Broadcast Address can support a
maximum of 255 hosts. This loads the network with overwhelming traffic
and slows down its performance. In the worst-case scenario, it renders
the network unusable by legitimate users.
68
3.3.3 Buffer Overflow
Computer’s RAM uses a temporary storage known as a buffer to store
data. This is to enable the CPU process the data before writing the result
to the disk. Buffer overflow (or buffer overrun) attack loads the fixed-
sized buffer with more data than it can hold. This leads to an overflow of
buffer and corruption of stored data. For example, buffer overflow occurs
when you send emails containing 256 character file names.
3.3.4 Teardrop
This type of attack sends large data packets, which are broken down by
TCP/IP into small fragments before they are transmitted to the
destination. The fragmented packets are reassembled on the receiving
host. The packets are sett in such a way that they overlap each other.
This causes the victim host to crash while re-assembling the packets.
69
3.4 Malware Attacks
Malware is a “code used to perform malicious actions” (SANS Technology
Institute, 2015). Malware infects a target by exploiting vulnerabilities in
host machines. This may involve tricking the victim into executing a file
which results in the automated exploitations of specific Linux OS
vulnerabilities. Malware consists of many parts such as exploit code,
payload, propagation mechanism and command and control functions
(Amine, Mohamed,&Benatallah,2014)
Linux, like any OS, has design flaws and security vulnerabilities, which
makes it possible for hackers to craft exploits that attack the Linux
platform.
Three factors, however, make the Linux platform less susceptible to virus
attacks than Windows or Mac operating system.
1. Faults get fixed quickly due to the large community and Linux's
open-source nature. Anyone with the time and knowledge can sit
and fix an error.
2. It is not targeted by virus developers as much as other platforms
3. It has a more secure design than Windows, making the
development and spread of viruses more difficult
70
3.4.3 Cross-Platform Viruses
Cross-platform viruses leverage on the widespread use of cross-platform
applications. These viruses became popular after the discovery of a type
of an OpenOffice.org virus called Badbunny. It is important to consider
cross-platform viruses because malware that can survive on different
platforms and application environments are pushed out regularly via Web
sites. Attackers can attack a web server with a JavaScript infector
regardless of platform.
Rootkit Hunter (RKH): Is a free, efficient and easy to use tool for
scanning backdoors, rootkits and local exploits on POSIX compliant
systems such as Linux. It monitors, analyzes and inspects a system
to detect unknown vulnerabilities.
3.5 Wiretapping
Wiretapping is used to listen to traffic on the network. The attack uses
tools such as tcpdump or Wireshark to place the network interfaces into a
promiscuous mode. For example, you can use wireshark packet sniffer to
obtain usernames, passwords, and web pages. This redirects all packets
from the switch to the tcpdump application, instead of the port.
71
Normally, network interfaces drop packets sent to them by network
devices when the destination IP addresses are not configured on the host.
Communication protocols and mechanisms such as ethernet, wifi, USB
and cellular networks are susceptible to wiretapping.
Discussion
Form a study group comprising of Windows users, Linux users and those
who currently use both operating systems simultaneously. Share your
experience with these operating systems, particularly in the area of
security. Discuss issues like susceptibility to and robustness against
various security attacks.
Case Studies
72
Identify ways by which hackers use ransomware to exploit users? How do
victims of ransomware exploits pay ransom to attackers?
What are the implications of a successful buffer overflow attack against
Linus operating system?
73
5. Which of the following does not protect against denial of
service attacks?
A. Install security patches to minimize SYN flooding, which
exploits bugs in the operating system.
B. Use intrusion detection systems to identify and prevent
illegitimate activities.
C. Use firewalls to prevent identify a malicious IP and block all
traffic originating from it.
D. Install the latest antivirus
Answer: D
5.0 Conclusion
Linux is an open-source platform which enables a large community of
developers to identify and fix vulnerabilities as quickly as possible. This
makes it more secure and stable than proprietary operating systems such
as Windows and Mac. However, hackers are usually one step ahead of
security professionals and still find some vulnerabilities which they use to
exploit Linux systems. Knowledge of common vulnerabilities and exploits
will help Linux administrators evaluate the security of their systems and
networks. A mastery of the tools and techniques for cracking Linux OS will
enable system administrators to detect loopholes in their systems before
attackers can use the same loophole to compromise security.
74
6.0 Summary
In this unit, you have acquired the skills for evaluating the security of
Linux-based systems and networks. The chapter introduced you the
vulnerabilities in Linux operating systems and the attacks that can be
used to exploit these vulnerabilities. You have also learned the
methodologies, tools and techniques used by hackers and pen testers to
compromise the security of Linux OS. In the next chapter, you will learn
about the vulnerabilities and exploits that target web servers and web
applications
75
Unit 3: Web Servers and Web Applications
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Web Server Attacks
3.1.1 Denial of Service Attack
3.1.2 URL Interpretation Attack
3.1.3 Impersonation Attack
3.1.4 Directory Traversal
3.1.5 Misconfiguration Attack
3.2 Attacks Against Web Applications
3.2.1 Cross-Site Scripting
3.2.2 Website Defacement
3.2.3 SQL Injection
3.2.4 Buffer Overflow
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, you will acquire the skills for evaluating the security of web
server and web applications. To achieve this, you will learn the
vulnerabilities inherent in web servers and web applications and the
attacks that can be used to exploit these vulnerabilities.
76
3.0 Main Content
77
Fig. 17: Web-based DoS Attack
Security administrators use network flow analyser to detect web-based
DoS attacks.
Assume you enter the following text in the Name field, in the Name field,
Mike<SCRIPT>alert('hello')</SCRIPT>
instead of entering Mike
The browser displays execute the script and displays the text whenever
the web application “reflects” input on a web page. This makes the script
to opens a pop-up window containing “hello”.
79
hacker may also fill the backend database with malicious/unrelated data.
The website becomes defaced and displays irrelevant data when it is
launched.
80
Discussion
Several web server and web application attacks have been discussed in
this unit. Some practical demos and simulations of such attacks were also
presented. Which of them:
Are easier or difficult to perform?
Have the most and least devastating effects?
Can be fixed more easily than the others?
What would you recommend as solutions to these attacks?
Case Studies
Theft of more than one billion passwords via SQL injection attack
In August 2014, Hold Security (an IT Security company) revealed that a
Russian hacking syndicate known as "CyberVor", stole 1.2 billion logins
and passwords on 420,000 websites worldwide. The report also
mentioned that the attack might have compromised about 500 million
email accounts. The hackers used botnets perform to carry out SQL
injection attacks and gain access to databases. It was a large scale attack
without any major consequence. Investigations by the FBI revealed that
the information obtained by the attackers were only used to launch
massive spamming attacks against social networks. The FBI was unable
to uncover the real intention of the hackers.
81
4.0 Self-Assessment Exercise(s)
1. A web server is vulnerable to which of the following DoS attacks?
A. buffer overflow
B. ping of death
C. HTTP gets Request Flooding
D. All of the above
Answer: D
Answer: B
Answer: D
5.0 Conclusion
Web servers and web applications provide how users access resources
held in computer systems and networks. Unauthorised access, disclosure,
modification or deletion of these resources can cause catastrophic
damages to individuals and organisations. Hence the need to protect the
servers and applications. A mastery of the methodologies, tools and
techniques used by hackers to compromise the security of web servers
and applications will provide penetration testers will the requisite skills
and competencies to verify the security of their web platforms. Such
regular assessments will also enable them to fix security holes that may
exist in servers and applications before attackers can use the same
vulnerabilities to exploit their systems
6.0 Summary
In this unit, you have acquired the skills for evaluating the security of web
servers and web applications. The unit introduced you to the
vulnerabilities inherent in web servers and web applications, as well as
the attacks that can be used to exploit these vulnerabilities. You have also
learned the methodologies, tools and techniques used by hackers and pen
testers to compromise the security of web servers and web applications.
In the next module, you will learn about the vulnerabilities and exploits
that target web servers and web applications
83
7.0 References/Further Reading
Bosworth, S., Kabay, M.E. & Whyne, E. (Eds.).( 2014). Computer Security
Handbook. (6th ed.). Vol. 1, Wiley & Sons, Inc,.
Brumley, B.B. & Tuveri, N. (2011). “Remote Timing Attacks are Still
Practical.” Proceedings of the 16th European conference on
Research in computer security, Pp. 355-371, Leuven, Belgium,
Sept. 12-14, 2011. Springer-Verlag Berlin, Heidelberg.
84
Module 3: Types of Attacks
Module Introduction
There is a substantial increase in the number of cyber-attacks coordinated
using malware. These attacks undoubtedly target government, military,
public and private sectors to extract valuable information and achieve
other goals. Therefore, you need the knowledge, skills, and tools required
to understand malware. This is to enable you to detect, investigate and
defend against malware attacks. In module 2, you learned how hackers
use vulnerabilities to carry out targeted attacks on Microsoft Windows
systems, Linux systems, Web Servers and Web applications. In this
module, I will take you through the use of malware such as viruses,
worms, Trojans and spyware to launch malicious activities on victims. I
will also take you through the techniques used by hackers to entice users
into revealing sensitive information or installing malicious software on
victims’ computer systems. Moreover, I will explain how massive
coordinated attacks are conducted using denial of service attack. Finally, I
will take you through how spyware is used to steal information and
monitor user activity.
In each unit, I will explore a particular topic in detail and highlight self-
assessment exercises at the end of the unit. Finally, I highlight resources
for further reading at the end of each unit.
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Malicious Software
3.1 Viruses
3.1.1 Types of Viruses
3.1.2 How Viruses Infect Systems
3.1.3 Virus Defensive Techniques
3.2 Worms
3.2.1 How Worms Infect Systems
85
3.2.2 Worm Defensive Techniques
3.3 Trojan Horses
3.3.1 Types of Trojans
3.3.2 How Trojans Infect Systems
3.3.3 Targets of Trojans
3.3.4 Symptoms of Trojans Infections
3.3.5 Trojans Defensive Techniques
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
Malicious software (malware) such as viruses, worms and Trojans are
used by hackers to launch attacks on computer systems. Each type of
malware uses a unique approach of attacking a computer system. In this
unit, I will take you through how viruses, worms and Trojan horses work.
Therefore, you will understand the infection behaviour of each malware to
defend a computer system. In the self-assessment exercise at the end of
the unit, you will have the opportunity to check or gauge your
understanding of viruses, worms and Trojan horses and provide
preventive methods against the different categories of malware.
describe viruses, worms and Trojans, and how they can be used to
infect systems
highlight the tools and techniques use in developing viruses, worms
and Trojans
discuss how to defend against viruses, worms and Trojan horses.
86
of a virus are corrupting or destroying data and disrupting computer
operations.
87
3.1.2 How Viruses Infect Systems
A virus spreads initially by sending a copy of itself to email addresses. The
delivery of the virus to an email address is achieved using the email
addresses found in the email address book of a victim’s computer, such
as Microsoft Outlook. In this case, the virus searches the address book
and email itself to the email addresses found as an attachment or a link.
Another method of initial infection is to design an internal email engine for
the virus and a number of the target email address, to begin with. In this
case, the virus uses its independent email engine to send a copy of itself
to several targets.
Several techniques and tools can be used to deal with the threat of
viruses.
1. Email Attachment: This is the most common way for a virus to
spread. Here are some rules that reduce the odds of virus infection.
a. Use scanners to verify an attachment.
b. Do not open suspicious attachment.
c. Use a code word to share attachment.
88
d. Do not use “security alerts” that are delivered through email
attachments.
2. Education: This is to inform users on how to safeguard the spread
of the virus to their computer systems. These include:
a. Do not allow employees to bring media from home.
b. Instruct users not to download files except known and trusted
sources.
c. Do not allow workers to install software without permission
from the IT department of the company.
d. Inform IT or security of strange system behaviours or virus
notifications.
e. Ban flash drives and portable hard drives.
f. Limit the use of administrative accounts.
3. Antivirus: Antiviruses are software designed to run in the
background on a system, staying vigilant for the activity that
suggests viruses and stopping or shutting it down. Antiviruses are
effective tools, but they can be so only if they are kept up-to-date.
4. Applying Updates: The are patches released by vendors of
operating systems and other application software to close holes and
address vulnerabilities on systems that viruses could exploit.
Missing a patch or update can make a computer system open to
virus attack.
3.2 Worms
A worm is a self-propagating virus that uses network awareness to
spread. Worms require no action from a user to execute or move from
one computer system to another.
89
vulnerable computers. If the worm successfully hits a vulnerable
computer, it then transfers over a copy of itself to the new computer,
which begins executing the worm code.
A worm spreads a copy of itself after discovering a vulnerable host. The
distribution of the worm is classified as
1. Self-carried propagation: The worm is carried along during target
discovery; in other words, the worm propagates by attaching a copy
of itself in the payload of the initial packet sent for discovering a
vulnerable host.
2. Second-channel propagation: The worm uses a secondary
contact to transmit the worm after successfully contacting a
vulnerable host.
3. Embedded propagation: The worm is distributed in a normal
communication channel.
90
A successfully planted Trojan on a system usually opens what is known as
a backdoor. These openings enable an attacker to bypass normal
security measures on a system and gain acces to the system remotely
without detectection. Therefore, the attacker can steal information, or use
the system launch an attack.
91
3.3.1 Types of Trojans
92
2. Instant Messaging (IM): Delivering malicious software via IM has
been very common as it is easy.
3. Internet Relay Chat (IRC): IRC is a mechanism commonly used
to deliver messages and software due to its widespread use and its
ability to entice new users to download software.
4. E-mail Attachments: With the rise of e-mail as a communication
medium, the practice of using it to distribute Trojans also rose.
Trojans have been distributed in this medium as attachments and
as clickable links.
5. Physical Access: Once an attacker gains physical access, it
becomes relatively easy to install the Trojan and compromise the
system.
6. Browser Defects: With many users forgetting to or choosing not
to update their browsers as soon as updates are released, the
distribution of Trojans becomes easier. Since Web browsers are
designed by their very nature to treat content that they are sent as
trusted, this allows malicious programs to run unabated.
7. Freeware: Downloading free software from unknown or untrusted
sources can mean downloading a malicious software such as a
Trojan.
Trojans require instructions from the hacker to fully realize their purpose
after distribution. Once attackers release their code into the world, they
switch their involvement from the distribution to the listening phase,
where Trojans will call home, indicating they have infected a system and
may be awaiting instructions.
93
4. Data Storage: Hackers use data storage to host illegal music or
movies and pirated software.
5. Random Acts of Mischief: In some cases, the hacker intends to
irritate or annoy the system owner.
94
3. Netstat: Netstat displays active TCP connections, ports on which
the computer is listening, Ethernet statistics, the lP routing table,
IPv4 statistics and more.
4. Tlist: A Windows-based tool used to list currently running processes
on local or remote machines.
5. TCPView: A GUI tool by Winternals used to display running
processes
6. Process viewer: A Windows Graphical User Interface (GUI) utility
that displays data about running processes
7. lnzider: Lists processes on a Windows system and the ports each
one is listening on. lnzider is useful in locating Trojans that have
injected themselves into other processes.
Scenario
Mr Stark downloaded an unsigned free software online, immediately after
installation, his computer hanged and he has to reboot. After the reboot,
he couldn’t find some of his files. He informed cybersecurity analyst about
this, and after a thorough investigation, he was told that this event was
triggered by malware embedded in the software he installed. What type of
malware possess these characteristics that attack Mr Stark?
5.0 Conclusion
In this unit, you have learned how viruses, worms and Trojan horses
work. Each malware has a unique pattern of infection. Viruses are mainly
used to corrupt or destroy programs and files on a victim’s computer
95
because they are attached to a program or file in the system. However,
for a more virulent attack and coverage, worms are more effective than
viruses. This is due to their capability to search for vulnerable computer
systems across networks and self-propagate their infections. This makes
a worm a more suitable option for a massive attack on computer systems
across networks hosts compared to viruses. Trojans are mainly used for
espionage and stealthy malicious activities. Trojans are particularly more
dangerous than viruses because tools are available for novice
programmers and software developers to easily create and transmit
Trojans. Generally, the three types of malware can be detected and
prevented using good antivirus software, anti-spyware, firewall, intrusion
detection/prevention systems and other monitoring tools, applying
updates and user awareness.
6.0 Summary
In this unit, I discussed how computer systems and networks are
attacked using viruses, worms and Trojan horses. Each type of attack
comes in many distinct variations. It is obvious to you now that securing
systems and networks from malware is critical. However, malware attacks
are preventable. In most cases, prompt and regular patching of the
system, use of antivirus tools, and blocking unneeded ports through
firewall would prevent malware attack.
96
Unit 2: Social Engineering and Distributed
Denial of Service
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Social Engineering
3.1 Performing Social Engineering Hacks
3.1.1 Building Trust through Words and Actions
3.1.2 Phishing for Information
3.2 Social Engineering Defensive Techniques
3.2.1 Stringent Organisational Policies
3.2.2 User Awareness and Training
3.2.3 Individual Countermeasure
3.3 Denial of Service (DoS)
3.3.1 Categories of DoS Attacks
3.4 Distributed Denial of Service
3.4.1 Characteristics of DDoS
3.4.2 Tools for DDoS
3.5 Botnet
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, I will take you through the social engineering techniques used
by hackers to make users fall into their trap of malicious activity. Having
understood how malware such as virus, worm and Trojans work from Unit
1, this unit explores how hackers use social engineering to entice victims
to reveal personal or organisational sensitive information or get the victim
to have malware delivered and installed onto a computer system. I will
also take you through a particular type of attack that is prevalent and
dangerous – it is known as denial-of-service (DoS) attacks. I will finally
take you through how a particular type of malware, known as a botnet, is
used in denial of service attacks.
97
2.0 Intended Learning Outcomes (ILOs)
By the end of this unit, you will be able to:
98
form of a Trojan via email, claiming to be from a verified software
manufacturer. Once installed, the hacker will have unrestricted access
into a computer or network.
These are all signs that a person has malicious intentions. However, a
good hacker will be very skilled at hiding these signs. Another strategy
that hackers use is to find a way of assisting a victim and then asking for
a favour. This is one of the most common and effective tricks in the social
engineering attack. Conversely, hackers also use reverse social
engineering technique. In this case, a hacker causes a specific problem to
occur, and when the intended victim needs help, the hacker swoops in
and solve the problem. Afterwards, the hacker will request for a favour.
A hacker may also falsify a work badge and get a fake uniform of an
organisation just to blend in with the real employees. The employees in
the organisation will assume that since the hacker dresses like them, he is
an employee that can be trusted with information.
99
encouraging the victim to update their user IDs, social security number,
and passwords.
Another form of DoS attack is to send packets that are confusing to the
target system. Once the computer or network device tries to process the
packets, it will crash. To summarize, a DoS attack denies the use of a
system or service through the systematic overloading of its resources. A
hacker wants the system to become unstable, substantially slower or
overwhelmed to the point it cannot process any more requests.
Consumption of Bandwidth
This type of DoS attack is when the network bandwidth flowing to and
from a computer system or network is consumed to the point of
exhaustion. A hacker must not completely exhaust the bandwidth to and
from a system to achieve a DoS attack. Rather, using up so much of the
bandwidth to the point that performance becomes unacceptable to users
suffices. So the attacker's goal is to consume enough bandwidth to make
the service unusable. Some well-known forms of attacks that consume
bandwidth include:
1. Smurf: Smurf attack exploit the Internet Control Message Protocol
(ICMP). This involves sending ICMP packets to the broadcast of a
network by spoofing the IP address of the victim. The large number
101
of reply packets generated will consume the bandwidth of the
victim.
2. Fraggle: This type of attack is similar to the smurf attack, but
instead of using ICMP, the hacker uses User Datagram Protocol
(UDP) packets. This occurs by sending UDP traffic the broadcast
address of the network.
Consumption of Resources
This type of DoS attack is when the resources of the target system are
exhausted. When an attack of this nature is carried out, a service or an
entire system may become overloaded to the point where it slows, locks
or crashes. The common form of this type of DoS attack includes:
1. SYN Flood: This type of DoS attack involves sending forged
Transmission Control Protocol (TCP) packets with the SYN flag set to
the target. When the victim receives multiple but forged TCP SYN
packets, the connection resources will be consumed to the point
where no resources are available for legitimate connections.
2. ICMP Flood: This type of DoS attack comes in two variants: smurf
attack and ping flood.
a. Smurf attack: This is carried out when a large amount of
traffic is directed to the broadcast address of a network
instead of a specific system.
b. Ping flood: This is carried out by sending a large number of
ping packets to the victim with the intent of overwhelming the
victim. The command to pull off such an attack, depending on
whether it is a Windows or Linux operating system, would be:
ping -t/-I <victim I P address>
3. Teardrop Attack: In this type of DoS attack, the hacker
manipulates IP packet fragments in such a way that when
reassembled by the victim, a crash occurs. This process involves
having fragments reassembled in illegal ways or having fragments
reassembled into larger packets than the victim can process.
4. Reflected Attack: This type of DoS attack is carried out by
spoofing or forging the source address of packets or requests and
sending them to numerous systems, which in turn respond to the
request. This type of attack is a scaled-up version of what happens
in the ping flood attack.
102
bytes allowed by the IP protocol is reached or exceeded. This will
cause the system to crash.
2. Teardrop: This type of DoS attack exploits a weakness in the way
packets are processed by a system. In this type of attack, the
packets are sent in a malformed state, that is, their offset values
will be adjusted to overlap, which is illegal. When a system that
does not know how to deal with this issue receives the packet, it
crashes or locks.
3. Land: This involves sending a packet to a victim system with the
same source and destination IP addresses and ports. The result of
this action is system crash or lockup because the system does not
know how to process the packet.
103
4. The defence is extremely difficult due to the number of attackers.
Configuring a router or firewall to block a small number of single IP
addresses is easy. Larger numbers of attackers are nearly
impossible to block.
5. The impact of this attack is increased over standard DoS. This is
because many hosts are involved in the attack, multiplying the
strength and power of the attack.
3.6 Botnets
A botnet is a network of computers that are controlled by a single
machine called a botmaster (hacker). This makes botnets an extremely
effective tool for performing attacks such as distributed-denial-of-service
(DDoS) attacks. A typical bot can be created and preserved in four phases
as shown in Figure 18.
104
Exploitation
Rallying
Attack Execution
Exploitation Phase
This is the first step of a botnet. The hacker makes a remote infection by
exploiting a vulnerability on the target systems. The hacker uses social
engineering techniques to get the victim to execute the malware on the
system, such as opening an e-mail attachment. Once installed, the bots
will connect to a remote server controlled by the hacker to download the
bot.
Rallying Phase
In this phase, the bots connect back to the hacker through a Command
and Control (C&C) server. At this stage, the hacker ensures that the
activities of the bots are stealthy. This is achieved by equipping the bots
with a DNS lookup functionality in order to locate the command and
control (C&C) server. Therefore, they will rally to connect back to the C&C
server.
105
4.0 Self-Assessment Exercise(s)
1. What is the most effective way of conducting a denial of service
attack on a target across the internet using hundreds of online
computer systems?
Answer
The most effective way of conducting a DDoS attack on a large number of
computers is to use a botnet. Botnet enables a hacker to compromised
other computers and uses then to launch a DDoS attack.
Answer: D
5.0 Conclusion
Social Engineering is the process of using social skills to convince people
to reveal access credentials or other valuable information to the hacker.
Social engineering also involves getting a user to download a malicious
email attachment or click a link that leads to the victim to install malware
or reveal sensitive information to the hacker. Hackers used denial-of-
service (DoS) attack to sends a large number of connection or information
requests to a target. These will crash the target system or simply become
unable to perform ordinary functions. A distributed denial of service
(DDoS) is an attack in which a coordinated stream of requests is launched
against a target from many locations at the same time. Most DDoS
attacks are preceded by a preparation phase in which thousands of
systems are compromised. The compromised machines are turned into
zombies, machines that are controlled remotely by the hacker to
participate in the attack. Botnets are one of the most effective techniques
that hackers used to control zombies and launch DDoS attacks.
6.0 Summary
In this you, I discussed how hackers use social engineering attack to
compromise systems and user accounts by enticing victims to reveal
106
sensitive information or install malware. Social engineering attack can be
conducted physically or via communication (web, email or phone). It is
apparently important for users to be aware of the social engineering tricks
and techniques used by hackers in order to thwart their malicious
activities. Furthermore, I explored DDoS attacks in this unit and how
hackers use malware and other denial-of-service attacks tools to launch
malicious activities. There exist different ways for a hacker to launch a
DDoS attack on a target, e.g. the use of a botnet. Botnets enable hackers
to launch coordinates and controlled DDoS attack on a target using
multiple hosts across the internet.
107
Unit 3: Spyware
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Methods of Delivery and Infection
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, I will take you through how spyware works and the
techniques used by hackers to deliver spyware to a target system.
Hackers used spyware to collect information without the consent of the
user from a computer system or user accounts.
108
designed to capture usernames and passwords and every document you
type. This data can be stored in a small file hidden on the target system.
The information can later be extracted or sent out to the hacker. The
spyware can be set to wait until after hours before uploading the data to
some server or use your email software to send the data to an
anonymous email address. Regardless of the specific mode of operation,
spyware is a software that literally spies on user activities on a particular
computer.
Hackers use backdoors and key loggers to steal information from a target
system. Many hackers use backdoors to steal information from a target
system. The owner of a compromised system will not know that someone
else is even using the system. Typically, a backdoor, when implemented,
will achieve one or more of three key goals:
1. Provide the ability to access a system regardless of security
measures that an administrator may take to prevent such access
2. Provide the ability to gain access to a system while keeping a low
profile. This would allow an attacker to access a system and
circumvent logging and other detective methods.
3. Provide the ability to access a system with minimal effort in the
minimum amount of time. Under the right conditions, a backdoor
will allow the attacker to gain unrestricted access to a system.
109
Similarly, information can be extracted from a comprominsed using a
keylogger. This malware is designed to capture and report activity,
particularly keyboard usage on a target system. Key loggers enable
hackers to monitor all activity on a system and have it reported back to
the hacker. Key logger can be used to capture passwords, confidential
information and sensitive data.
110
2. Methods through which Spyware can be placed on a system include
a. Instant messaging
b. Internet Relay Chat
c. Media Access Control
d. Rootkits
Answer: A and B
5.0 Conclusion
Spyware programs can track all activities on a computer, and retrieve
information via several different methods. The most common method is a
Trojan horse. It is also possible that when a user visits certain websites,
spyware may download in the background while the user is simply
perusing the website.
6.0 Summary
In this unit, you have learned what spyware is and how the software can
be delivered to a target system. Spyware is used by hackers to gather or
steal sensitive information from a target remotely. Thus, this class of
malware is suitable for espionage and stealthy malicious activities.
111
Module 4: Penetration Testing
Module Introduction
Penetration testing is used by organisations to evaluate the security level
of computer and network systems to identify a weakness that can be
exploited by hackers. This is to determine effective security measures
needs to be placed to protect computers and network infrastructure from
attack.
In module 2, you learnt how hackers use the vulnerability to carry out
targeted attacks on Microsoft Windows systems, Linux systems, Web
servers and Web applications. Also, you learned how hackers use malware
to launch secret and destructive attacks in module 3. In this module, I will
take you through how to conduct a security audit of an organisation to
determine compliance with security policies, procedures and standard and
ascertain protection. You will also learn how to assess vulnerabilities in
systems, services, applications and infrastructure that enable hackers to
launch targeted and malware attacks and identify ways to mitigate the
risk of attacks. Finally, I will take you through penetration testing
roadmap and plans in order to identify vulnerabilities.
This module is classified into the following four units:
In each unit, I will explore a particular topic in detail and highlight self-
assessment exercises at the end of the unit. Finally, I will highlight
resources for further reading at the end of each unit.
112
1.0 Introduction
In this unit, you will learn how to measure the compliance of user and
computer systems implementation with standard security policies and
procedures of an organisation. This is to identify and analyse security
risks in terms of human behaviour and systems set up that enables
activities such as targeted attacks, social engineering attacks, malware
attacks and other unauthorised activities in an organisation. You will also
learn the tools used to audit the security of an organisation.
To perform a security audit, you need security policy and standards, audit
checklists and an inventory list, which may cover different areas such as
web application, network architecture and wireless communication. The
auditing process also involves the use of different auditing tools and
different review techniques to reveal the security non-compliance and
loopholes. After the audit process, an audit report is prepared to highlight
the compliance and gaps that existed between the current protection and
the requirements specified in the security policies and standards. This
determines the strength and potential weaknesses of the security of an
organisation.
113
The major objectives of a security audit are to:
1. Ensure compliance with and effectiveness of the security policy,
standards, guidelines and procedures.
2. Identify and review vulnerabilities, regulatory and contractual
requirements.
3. Review existing security controls on operational, administrative and
managerial issues, ensure effective implementation of security
measures and compliance to minimum security standards.
4. Recommend actions for improvements.
114
3.3 Security Audit Tools
Several security audit tools are available to aid security auditors to find
vulnerabilities in systems and services. These tools run on Windows and
Unix-based operating systems. The choice of security audit tools depends
on the security assessment needed, that is, whether the vulnerability
check is on a network or specific hosts. Table 1 shows some security audit
tools.
115
3.4 Security Audit Stages
A security audit comprises several stages, as shown in Figure 19.
Planning
Planning
This is the process of selecting the effective and efficient methods of
performing security audit and obtaining all necessary information. The
required time for planning depends on the nature, extent and complexity
of the audit. In this stage, the security audit scopes are clearly defined
and established. Examples of security audit scopes include:
1. General security of an internal network and hosts
2. Security of the Internet and network servers
3. Security of mission-critical systems and other services
4. Security of network components and devices such as firewalls,
routers, directory services and mailing services
5. Security of a computer room
116
2. Change control and administration events such as configuration
changes, installation of new software, data conversion or patches
updating.
3. Physical site visit by external parties such as security auditors or
guests.
4. Procedure and policy changes.
5. Operation logs.
6. Security incident records.
117
4.0 Self-Assessment Exercise(s)
1. One of the following is not included in the activities you need to
perform in conducting a security audit for an organisation?
A. Performing Audit Tests
B. Modifying Audit Results
C. Protecting Audit Data and Tools
D. Planning
Answer: B
Answer: C
5.0 Conclusion
In this unit, you have learned the stage and processes of measuring the
compliance of organisation security with standard security policies and
procedures. Several security audit tools are available. However, the use of
an audit tool depends on the type of security audit you will conduct and
the platform used by the organisation.
6.0 Summary
In this unit, I discussed the security audit and the activities performed at
each stage of the audit process. A security audit is conducted to identify
the strength and weakness of an organisation regarding compliance with
security policies. I also highlight some security audit tools used to
facilitate conducting a security audit for an organisation.
118
7.0 References/Further Reading
Engebretson, P. (2011). The Basics of Hacking and Penetration Testing:
Ethical Hacking and Penetration Testing Made Easy. Elsevier Inc.
SPG-SM01 (2017). Practice Guide for Security Risk Assessment and Audit
119
Unit 2: Vulnerability Assessment
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Vulnerability Assessment
3.1 Types of Vulnerability Assessment
3.1.1 Host Vulnerability Assessments
3.1.2 Network Vulnerability Assessments
3.2 Network Vulnerability Assessment Process
3.3 Vulnerability Assessment Approaches
3.3.1 Administrative Approach
3.3.2 Outsider Approach
3.3.3 Hybrid Approach
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, I will explain how the assessment vulnerabilities in
applications, systems, services and network infrastructure. In Unit 1, you
learned how to perform a security audit to determine compliance with
security policy. In this unit, I will take you through how to find a
weakness, not in compliance with security policy as in security audit, but
in the design of systems and network infrastructure. I will also take you
through the activities performed at the stages of vulnerability assessment
and approached used in assessing vulnerabilities.
120
3.0 Main Content
3.1 Vulnerability Assessment
Vulnerability is a weakness in software design, network services,
operations, control and procedure that could be exploited to gain
unauthorised access or compromise a system. This includes anything from
a weak password on a router to an unpatched programming flaw in an
exposed network service. Vulnerability assessments are the process of
locating and reporting vulnerabilities. The assessment is used to detect
and resolve security problems before being exploited by a hacker. Once
vulnerabilities are identified, the affected systems and services can be
fixed by patching the vulnerabilities. Then, the assessment can be
repeated to verify the effectiveness of the fixes. This is the standard
method for many organisations to manage their security issues.
121
Network vulnerability assessment differs from host vulnerability
assessment because it does not require any configuration changes on the
systems being assessed. Network vulnerability assessments provide the
feasible of testing the security of large, complex networks of
heterogeneous systems. The strength of network vulnerability assessment
is its effectiveness in identifying vulnerabilities in a large number of
systems at a time. However, network vulnerability assessment has
limitations that include:
Inability to detect certain types of backdoors
Complications with the firewall.
Disruption of normal operations
Interference with many devices such as printers
Network bandwidth consumption.
Enumerating Services
Identifying Services
Identifying Applications
Identifying Vulnerabilities
Reporting Vulnerabilities
Fig. 20: Vulnerability Assessment Process
122
used from Simple Network Management Protocol (SNMP) queries to
complex TCP/IP stack-based operating system identification.
Enumerating services
Once a system is detected and identified, the activity that follows is an
enumeration, that is, port scan. A port scan is a process of determining
what TCP and UDP services are open on the system being assessed. Do
you remember port scanning in Unit 2 of Module 1? TCP and UDP port
scanning are used to send connection requests to the systems. There are
65,536 available TCP ports; however, limiting the scan to a subset of the
available ports reduces the amount of time it takes to perform the
assessment and substantially decreases the bandwidth required.
Identifying services
After enumerating services on network systems, the next activity is to
identify the services that are in use on each open port. This process starts
with sending some common application requests, such as HyperText
Transfer Protocol (HTTP) on port 80, and analysing the responses against
a set of signatures. When a signature matches a known application, this
information is stored for the later use and the next service is tested.
Identifying applications
The next step after service detection is to determine the application used
for each detected service. This is to identify the vendor, type, and version
of every service detected in the previous stage.
Identifying vulnerabilities
After identifying systems and applications, the systems are now ready to
begin testing for vulnerabilities. This process begins with information
gathering techniques, then active configuration probes, and finally attacks
that can identify the existence of vulnerabilities on the tested system.
Reporting vulnerabilities
After the analysis is finished, the final stage of the assessment process is
reporting. The assessment report lists the systems discovered during the
assessment and any vulnerabilities that were identified on them.
123
3.4.1 Administrative Approach
The administrative approach uses a normal, authenticated system
administrator or user to perform the assessment. The credential provided
can be used to detect missing patches, insecure configuration settings,
and potentially vulnerable client-side software. This is useful when trying
to detect and resolve client-side vulnerabilities on a network of computer
systems.
5.0 Conclusion
In this unit, you have learnt how to assess vulnerabilities in applications,
systems, services and network infrastructure. To assess vulnerabilities,
you need to determine the systems to be assessed in order to apply the
relevant type and approach of vulnerability assessment.
124
6.0 Summary
In this unit, I have discussed vulnerability assessment and the activities
performed at each stage of the assessment process. I also explored the
types and approaches used by security administrators to assess
vulnerabilities in systems, applications, services, and network
infrastructure.
125
Unit 3: Penetration Testing Roadmap
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Penetration Testing Roadmap
3.1 Penetration Testing Rules
3.2 Penetration Testing Plan
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In Unit 2, you learned vulnerability assessment. Unlike vulnerability
assessment that focuses on identifying vulnerabilities on a network, a
penetration test focuses on gaining unauthorised access to the tested
systems by exploiting the vulnerabilities identified during assessment. In
this unit, I will discuss the roadmap for conducting a penetration test.
126
A vulnerability assessment reviews services and systems for potential
security issues, whereas a penetration test performs exploitation and
proof of concept attacks to prove that a security issue exists. Penetration
tests go a step beyond vulnerability assessments by simulating the hacker
activity and delivering live payloads.
127
6. Protect confidential information: You are likely to come across a
lot of personal and private information during your penetration
testing. You must respect people's privacy and treat every piece of
information with confidentiality. Passwords, encryption keys, and
other sensitive information must not be abused. Always treat other
people’s personal or confidential information with the same respect
you would want others to treat your own.
7. Do not cause harm: There are times when you may get excited
about the job and the positive test results you are receiving, so you
keep plugging away. However, you may accidentally cause some
kind of outage or even interfere with another's rights. This is why
you should always have a plan and then commit to sticking to it. Be
knowledgeable about the tools you are using, especially their
implications. Choose your tools wisely and always read the
documentation.
8. Always be empirical: If you want your test results to be accepted,
you need to use a scientific process that is characterised by these
features:
a. Quantifiable goals: Set a goal that you will be able to
quantify. You can set task goals or time-related goals.
b. Consistency and repeatability: Every test that you perform
must produce the same results. If they do not, then your
results are inconsistent and probably invalid. If you repeat a
test over and over, you should get the same results every
time. Consistency and repeatability of tests are critical
features of an empirical process.
c. The permanence of results: The client that you work for will
look forward to your test results if you focus on fixing
persistent problems for good, instead of solving temporary
ones that may recur later on.
9. Do not use any random tool: There are a lot of hacking tools in
the market today. It is easy to be tempted to try them all out,
probably since most of them are free. However, it is advisable to
just focus on a few tools that you know are effective, and you are
familiar with.
10. Report all your findings: If you are hired for penetration systems,
and the process takes longer than a week, you need to give your
clients weekly status updates. If you discover any high-risk
weaknesses and vulnerabilities in the system during your tests, you
need to report them to those concerned. The reports that you
issued is what the client will use to determine how thorough and
sincere you are in your work. A report will also help during the
analysis and critique of your results.
128
3.3 Penetration Testing Plan
Having learned the rules for conducting a penetration test, it is important
to take you through the steps that guide you through planning the
penetration testing process. The penetration testing plan steps include:
i. Determine the most critical and vulnerable systems to be tested
first. These can include server passwords or email phishing. Once
the core areas have been tested, you can then cascade down to all
the other systems.
ii. Assess the risks involved. It is important to always have a
contingency plan in case the penetration testing process goes
wrong. Determine how people and systems will be affected
beforehand.
iii. Determine testing schedule. It could be during regular business
hours, early mornings, or maybe late at night. The best way to test
the system would be to launch any type of test at any time of day.
The only exceptions would typically be full DoS attacks, physical
security and social engineering tests.
iv. Have a basic understanding of the system being tested. You may
need to get more details of the systems to be tested.
v. Define the actions to be taken in case major vulnerabilities are
found. If you discover a couple of security weaknesses, let the key
players know about it immediately. Keep testing the system until
you find it impenetrable.
vi. Determine the deliverables. These include detailed scanning reports
containing information about vulnerabilities and recommendations
on how to fix them.
vii. Determine the specific set of tools that you will need for your task.
Always ensure that you are using the appropriate tool for the right
task.
Answer:
the major difference between internal and external penetration testing is
that with internal penetration testing, it is assumed the attacker already
has access. In contrast, external penetration testing is the ability of a
remote attacker to get to the internal network.
129
5.0 Conclusion
In this unit, I explored the concept of a penetration test, rules and steps
that you need to follow to achieve a successful penetration test. A
penetration test is a great way to determine how well the security
measures of an organisation respond to a real-life attack.
6.0 Summary
In this unit, you learnt the concept of exploiting the weaknesses identified
during vulnerability assessment to gain unauthorised access to systems.
It is important to note that you need to properly plan and follow the rules
of a penetration test to achieve successful results.
130
Unit 4: Penetration Test Plan
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Penetration Testing Plan
3.1 Reconnaissance
3.2 Evaluating System Vulnerability
3.3 Penetration Testing
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
7.0 Summary
7.0 References/Further Reading
1.0 Introduction
In Unit 2, you learnt the roadmap to carry out a penetration test. In this
unit, I will take you through the main steps of the penetration test plan
from information gathering to the actual test.
perform reconnaissance
conduct penetration testing
evaluate system vulnerabilities.
131
There are two ways to test a system; a covert test and an over test. The
overt test is where you have some inside knowledge of the system you
intend to test. In the covert test, you do not know much information apart
from the name of the organisation. In the covert test, you have to search
for information on your own, the same way a hacker will do. This enables
you to see what a hacker would see when they try to gain access.
However, a covert test takes more time, and there is a higher chance of
overlooking certain vulnerabilities.
There are three main steps for conducting a penetration test. These are
reconnaissance/information gathering, evaluating system vulnerability
and penetration test.
Web Searches
These involve using the target's website and browse around as you try to
collect as much useful information as possible. If you are using Google,
you can use keywords to get the most relevant information.
Web Crawling
A Web crawler sometimes called a spider or spiderbot and often
shortened to crawler, is an Internet bot that systematically browses
the World Wide Web, typically for Web indexing (web spidering).
Web search engines and some other sites use Web crawling or spidering
software to update their web content or indices of other sites' web
content. Web crawlers copy pages for processing by a search engine
which indexes the downloaded pages so users can search more efficiently.
Certain web crawling tools can mirror a website and download all the
publicly accessible files from the target website. This then allows you to
scan the copy offline.
Websites
There are certain websites that contain information about different
organisations and their employees. You can even do a people search if
you just know which websites to use.
Network mapping
This is the process of searching public databases to discover the
information available about a particular network such as Whois. Whois
132
enables you to obtain information that will help you scan a network or
prepare a social engineering attack. You will be able to get the names,
phone numbers, and addresses linked to a specific Internet domain
registration.
System scanning
The information gathered from external sources can provide you with a
map of the entire network, revealing how the systems are interconnected.
You should be able to see the hostnames, IP addresses, open ports,
running protocols and applications.
Hosts
Scan and record those hosts that can be accessed externally via the
Internet and internally by an insider. Begin by pinging the IP addresses or
the hostnames. You can use either the standard ping tool that comes with
operating systems or a 3rd party tool such as SuperScan or fping.
Open ports
Several networking tools can be used to scan for open ports. These
include OmniPeek, Wireshark, SuperScan, among others. It is easier to
perform a scan internally than externally. To scan internally, connect your
computer to the local network and run the software. To scan externally,
just assign the computer you are using a public IP address and connect it
to a hub that is not within the firewall.
The next step is to start testing right away. You can either perform a
manual evaluation or an automated evaluation. In manual evaluation, the
potential vulnerabilities are assessed by linking to the ports that can be
exploited by hackers. Automated evaluations involve the use of tools that
test for weaknesses on a platform or network. Though these tools make
work easier and much faster, most of them only can test for specific and
individual system vulnerabilities.
133
you develop for a penetration test. After penetrating the system, you
should carry out the following:
1. Gather more information from the host system
2. Access other interconnected systems in the network
3. Start and stop specific services
4. Get a remote command prompt
5. Launch a denial of service attack
6. Gain access to confidential files
7. Disable inbuilt logging security checks
8. Perform SQL injection attacks
9. Take screenshots
10. Send emails to people as the administrator
11. Upload a file.
A. Zombie
B. Botnet
C. Spider
D. Hosting
Answer: B
3. There are four main steps for conducting a penetration test, true or
false?
Answer: True
134
Mini-project
A Nigerian bank has been using online banking for ten years now. They
have their web servers at the head office in Abuja. The bank wishes to
understand their current level of risk. They contact you with an offer to
carry out a penetration test. They provide you with the IP address of their
web servers. Develop a penetration testing plan to assess the security
risk of their web servers.
5.0 Conclusion
In this unit, you learnt how to develop a penetration test plan to assess
the security risk of an organisation.
6.0 Summary
In this unit, I explored the necessary step needed by a security expert to
develop a plan for a penetration test.
135
Unit 3: Spyware
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Methods of Delivery and Infection
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, I will take you through how spyware works and the
techniques used by hackers to deliver spyware to a target system.
Hackers used spyware to collect information without the consent of the
user from a computer system or user accounts.
136
designed to capture usernames and passwords and every document you
type. This data can be stored in a small file hidden on the target system.
The information can later be extracted or sent out to the hacker. The
spyware can be set to wait until after hours before uploading the data to
some server or use your email software to send the data to an
anonymous email address. Regardless of the specific mode of operation,
spyware is a software that literally spies on user activities on a particular
computer.
Hackers use backdoors and key loggers to steal information from a target
system. Many hackers use backdoors to steal information from a target
system. The owner of a compromised system will not know that someone
else is even using the system. Typically, a backdoor, when implemented,
will achieve one or more of three key goals:
1. Provide the ability to access a system regardless of security
measures that an administrator may take to prevent such access
2. Provide the ability to gain access to a system while keeping a low
profile. This would allow an attacker to access a system and
circumvent logging and other detective methods.
3. Provide the ability to access a system with minimal effort in the
minimum amount of time. Under the right conditions, a backdoor
will allow the attacker to gain unrestricted access to a system.
Some common backdoors that are placed on a system are of the following
types and purposes:
1. Password-cracking backdoor: This backdoor is used by hackers
to uncover and exploit weak passwords that have been configured
by the system owner. System owners who fail to follow accepted
guidelines for strong passwords become vulnerable to attacks of
this type.
2. Rootkits: This is a backdoor used by hackers to replace existing
files on a target system with their versions. This technique enables
a hacker to replace key system files on a computer and therefore
alter the behaviour of a system at a fundamental level.
3. Services Backdoor: Network services are another target for attack
and modification with a backdoor. When a network service runs, a
port such as 80 or 666 is used for communication. Therefore, if a
network service is answering on a port, a hacker can use the port to
issue commands to the service to compromise the target system.
4. Process hiding backdoors: This is a backdoor used by hackers to
stay undetected for as long as possible by hiding the software in the
target system. This is achieved by renaming a malicious program to
the name of a legitimate program or altering other files on a system
to prevent them from being detected and running.
137
Another powerful way of extracting information from a victim's system is
to use a piece of technology known as a keylogger. This malware is
designed to capture and report activity, particularly keyboard usage on a
target system. Key loggers enable hackers to monitor all activity on a
system and have it reported back to the hacker. Key logger can be used
to capture passwords, confidential information and sensitive data.
Typically, key loggers are implemented as a small piece of code that
resides in the interface between the operating system and keyboard. The
software is installed the same way any other Trojan would be bundled
with a legitimate application. Once a key logger is installed on a target
system, the malware can send all the needed information to a hacker.
138
2. Methods through which Spyware can be placed on a system include
e. Instant messaging
f. Internet Relay Chat
g. Media Access Control
h. Rootkits
Answer: A and B
5.0 Conclusion
Spyware programs can track all activities on a computer, and another
party can retrieve information via several different methods. The most
common method is a Trojan horse. It is also possible that when a user
visits certain websites, spyware may download in the background while
the user is simply perusing the website.
6.0 Summary
In this unit, you have learned what spyware is and how the software can
be delivered to a target system. Spyware is used by hackers to gather or
steal sensitive information from a target remotely. Thus, this class of
malware is suitable for espionage and stealthy malicious activities.
139
Module 4: Penetration Testing
Module Introduction
Penetration testing is used by organisations to evaluate the security level
of computer and network systems to identify a weakness that can be
exploited by hackers. This is to determine effective security measures
needs to be placed to protect computers and network infrastructure from
attack.
In module 2, you learnt how hackers use the vulnerability to carry out
targeted attacks on Microsoft Windows systems, Linux systems, Web
servers and Web applications. Also, you learned how hackers use malware
to launch secret and destructive attacks in module 3. In this module, I will
take you through how to conduct a security audit of an organisation to
determine compliance with security policies, procedures and standard and
ascertain protection. You will also learn how to assess vulnerabilities in
systems, services, applications and infrastructure that enable hackers to
launch targeted and malware attacks and identify ways to mitigate the
risk of attacks. Finally, I will take you through penetration testing
roadmap and plans in order to identify vulnerabilities.
In each unit, I will explore a particular topic in detail and highlight self-
assessment exercises at the end of the unit. Finally, I will highlight
resources for further reading at the end of each unit.
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Security Audit
3.1 Risk Analysis
3.2 Security Audit Tools
3.3 Security Audit Stages
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
140
1.0 Introduction
In this unit, you will learn how to measure the compliance of user and
computer systems implementation with standard security policies and
procedures of an organisation. This is to identify and analyse security
risks in terms of human behaviour and systems set up that enables
activities such as targeted attacks, social engineering attacks, malware
attacks and other unauthorised activities in an organisation. You will also
learn the tools used to audit the security of an organisation.
To perform a security audit, you need security policy and standards, audit
checklists and an inventory list, which may cover different areas such as
web application, network architecture and wireless communication. The
auditing process also involves the use of different auditing tools and
different review techniques to reveal the security non-compliance and
loopholes. After the audit process, an audit report is prepared to highlight
the compliance and gaps that existed between the current protection and
the requirements specified in the security policies and standards. This
determines the strength and potential weaknesses of the security of an
organisation.
141
The major objectives of a security audit are to:
1. Check for compliance with existing security policy, standards,
guidelines and procedures.
2. Identify the inadequacies and examine the effectiveness of the
existing policy, standards, guidelines and procedures.
3. Identify and review relevant statutory, regulatory and contractual
requirements.
4. Identify and understand the existing vulnerabilities.
5. Review existing security controls on operational, administrative and
managerial issues, ensure effective implementation of security
measures and compliance to minimum security standards.
6. Provide recommendations and corrective actions for improvements.
142
It is recommended that those who will be carrying out the security audit
familiarise themselves further with risk management and analysis theory
before commencing.
143
3.4 Security Audit Stages
A security audit comprises several stages, as shown in Figure 19.
Planning
144
1. Computer equipment repair and maintenance activities such as
date, time, supporting vendor information and the activity's
description.
2. Change control and administration events such as configuration
changes, installation of new software, data conversion or patches
updating.
3. Physical site visit by external parties such as security auditors or
guests.
4. Procedure and policy changes.
5. Operation logs.
6. Security incident records.
145
4.0 Self-Assessment Exercise(s)
3. One of the following is not included in the activities you need to
perform in conducting a security audit for an organisation?
A. Performing Audit Tests
B. Modifying Audit Results
C. Protecting Audit Data and Tools
D. Planning
Answer: B
Answer: C
5.0 Conclusion
In this unit, you have learned the stage and processes of measuring the
compliance of organisation security with standard security policies and
procedures. Several security audit tools are available. However, the use of
an audit tool depends on the type of security audit you will conduct and
the platform used by the organisation.
6.0 Summary
In this unit, I discussed the security audit and the activities performed at
each stage of the audit process. A security audit is conducted to identify
the strength and weakness of an organisation regarding compliance with
security policies. I also highlight some security audit tools used to
facilitate conducting a security audit for an organisation.
146
7.0 References/Further Reading
Engebretson, P. (2011). The Basics of Hacking and Penetration Testing:
Ethical Hacking and Penetration Testing Made Easy. Elsevier Inc.
SPG-SM01 (2017). Practice Guide for Security Risk Assessment and Audit
147
Unit 2: Vulnerability Assessment
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Vulnerability Assessment
3.1 Types of Vulnerability Assessment
3.1.1 Host Vulnerability Assessments
3.1.2 Network Vulnerability Assessments
3.2 Network Vulnerability Assessment Process
3.3 Vulnerability Assessment Approaches
3.3.1 Administrative Approach
3.3.2 Outsider Approach
3.3.3 Hybrid Approach
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In this unit, I will explain how the assessment vulnerabilities in
applications, systems, services and network infrastructure. In Unit 1, you
learned how to perform a security audit to determine compliance with
security policy. In this unit, I will take you through how to find a
weakness, not in compliance with security policy as in security audit, but
in the design of systems and network infrastructure. I will also take you
through the activities performed at the stages of vulnerability assessment
and approached used in assessing vulnerabilities.
148
3.0 Main Content
3.1 Vulnerability Assessment
Vulnerability is a weakness in software design, network services,
operations, control and procedure that could be exploited to gain
unauthorised access or compromise a system. This includes anything from
a weak password on a router to an unpatched programming flaw in an
exposed network service. Vulnerability assessments are the process of
locating and reporting vulnerabilities. The assessment is used to detect
and resolve security problems before being exploited by a hacker. Once
vulnerabilities are identified, the affected systems and services can be
fixed by patching the vulnerabilities. Then, the assessment can be
repeated to verify the effectiveness of the fixes. This is the standard
method for many organisations to manage their security issues.
149
Network vulnerability assessment differs from host vulnerability
assessment because it does not require any configuration changes on the
systems being assessed. Network vulnerability assessments provide the
feasible of testing the security of large, complex networks of
heterogeneous systems. The strength of network vulnerability assessment
is its effectiveness in identifying vulnerabilities in a large number of
systems at a time. However, network vulnerability assessment has
limitations that include:
Inability to detect certain types of backdoors
Complications with the firewall.
Disruption of normal operations
Interference with many devices such as printers
Network bandwidth consumption.
Enumerating Services
Identifying Services
Identifying Applications
Identifying Vulnerabilities
Reporting Vulnerabilities
Fig. 20: Vulnerability Assessment Process
150
here to detect system type and platform. The fingerprinting techniques
used from Simple Network Management Protocol (SNMP) queries to
complex TCP/IP stack-based operating system identification.
Enumerating services
Once a system is detected and identified, the activity that follows is an
enumeration, that is, port scan. A port scan is a process of determining
what TCP and UDP services are open on the system being assessed. Do
you remember port scanning in Unit 2 of Module 1? TCP and UDP port
scanning are used to send connection requests to the systems. There are
65,536 available TCP ports; however, limiting the scan to a subset of the
available ports reduces the amount of time it takes to perform the
assessment and substantially decreases the bandwidth required.
Identifying services
After enumerating services on network systems, the next activity is to
identify the services that are in use on each open port. This process starts
with sending some common application requests, such as HyperText
Transfer Protocol (HTTP) on port 80, and analysing the responses against
a set of signatures. When a signature matches a known application, this
information is stored for the later use and the next service is tested.
Identifying applications
Once the service detection phase is complete, the next step is to
determine the actual application in use for each detected service. The
goal of this stage is to identify the vendor, type, and version of every
service detected in the previous stage.
Identifying vulnerabilities
After identifying systems and applications, the systems are now ready to
begin testing for vulnerabilities. This process often starts with basic
information-gathering techniques, followed by active configuration probes,
and finally a set of custom attacks that can identify whether a particular
vulnerability exists on the tested system.
Reporting vulnerabilities
After the analysis is finished, the final stage of the assessment process is
reporting. The assessment report lists the systems discovered during the
assessment and any vulnerabilities that were identified on them.
151
3.4.1 Administrative Approach
The administrative approach performs the assessment from the
perspective of a normal, authenticated system administrator. The
assessment tool might require that it be launched by an authenticated
administrative user or provided with a user account and password. These
credentials can be used to detect missing patches, insecure configuration
settings, and potentially vulnerable client-side software. This is useful
when trying to detect and resolve client-side vulnerabilities on a network
of computer systems.
5.0 Conclusion
In this unit, you have learnt how to assess vulnerabilities in applications,
systems, services and network infrastructure. To assess vulnerabilities,
you need to determine the systems to be assessed in order to apply the
relevant type and approach of vulnerability assessment.
152
6.0 Summary
In this unit, I have discussed vulnerability assessment and the activities
performed at each stage of the assessment process. I also explored the
types and approaches used by security administrators to assess
vulnerabilities in systems, applications, services, and network
infrastructure.
153
Unit 3: Penetration Testing Roadmap
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Penetration Testing Roadmap
3.1 Penetration Testing Rules
3.2 Penetration Testing Plan
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 References/Further Reading
1.0 Introduction
In Unit 2, you learned vulnerability assessment. Unlike vulnerability
assessment that focuses on identifying vulnerabilities on a network, a
penetration test focuses on gaining unauthorised access to the tested
systems by exploiting the vulnerabilities identified during assessment. In
this unit, I will discuss the roadmap for conducting a penetration test.
154
A vulnerability assessment reviews services and systems for potential
security issues, whereas a penetration test performs exploitation and
proof of concept attacks to prove that a security issue exists. Penetration
tests go a step beyond vulnerability assessments by simulating the hacker
activity and delivering live payloads.
Before conducting a penetration test, there are certain rules you need to
know. These are:
1. Set a goal: If you have planned to evaluate the security of an
online system or network, you must first try to answer three
questions:
a. What information does a hacker see when they look at the
target network?
b. Can the hacker misuse that information?
c. Is the target aware of any attempts to penetrate their
system?
2. Plan ahead: A penetration testing plan must be defined. The plan
should include:
Identifying the networks to be tested
Determining the intervals of the tests
Clearly defining the testing procedure
Creating a plan that you can share with stakeholders
Getting the plan approved.
3. Get authorisation: Before conducting a penetration test, you must
obtain the necessary authorisation from the organisation. An
authorisation document must be issued by the organisation showing
that you have the approval to test the system according to an
approved plan and that the organisation will support you in case of
any legal charges.
4. Be ethical: Before conducting a penetration test, you must bound
by the code of professionalism, confidentiality and conscience. Make
sure that you always stick to the plan that was previously approved
and avoid adding any new details to it down the road. You are not
to release or share the results of your security test with
unauthorised persons both within and outside the organisation. Any
information you discover should be treated as sensitive. It is also
important to be aware of any local laws or governance regulations
within the organisation that relate to hacking.
5. Maintain good records: Some basic rules should be followed
when it comes to record-keeping:
Note down every task performed.
Log every piece of information directly.
Always have a backup copy of the log.
Note down every test performed, including the dates.
155
6. Protect confidential information: You are likely to come across a
lot of personal and private information during your penetration
testing. You must respect people's privacy and treat every piece of
information with confidentiality. Passwords, encryption keys, and
other sensitive information must not be abused. Always treat other
people’s personal or confidential information with the same respect
you would want others to treat your own.
7. Do not cause harm: There are times when you may get excited
about the job and the positive test results you are receiving, so you
keep plugging away. However, you may accidentally cause some
kind of outage or even interfere with another's rights. This is why
you should always have a plan and then commit to sticking to it. Be
knowledgeable about the tools you are using, especially their
implications. Choose your tools wisely and always read the
documentation.
8. Always be empirical: If you want your test results to be accepted,
you need to use a scientific process that is characterised by these
features:
a. Quantifiable goals: Set a goal that you will be able to
quantify. You can set task goals or time-related goals.
b. Consistency and repeatability: Every test that you perform
must produce the same results. If they do not, then your
results are inconsistent and probably invalid. If you repeat a
test over and over, you should get the same results every
time. Consistency and repeatability of tests are critical
features of an empirical process.
c. The permanence of results: The client that you work for will
look forward to your test results if you focus on fixing
persistent problems for good, instead of solving temporary
ones that may recur later on.
9. Do not use any random tool: There are a lot of hacking tools in
the market today. It is easy to be tempted to try them all out,
probably since most of them are free. However, it is advisable to
just focus on a few tools that you know are effective, and you are
familiar with.
10. Report all your findings: If you are hired for penetration systems,
and the process takes longer than a week, you need to give your
clients weekly status updates. If you discover any high-risk
weaknesses and vulnerabilities in the system during your tests, you
need to report them to those concerned. The reports that you
issued is what the client will use to determine how thorough and
sincere you are in your work. A report will also help during the
analysis and critique of your results.
156
3.3 Penetration Testing Plan
Having learned the rules for conducting a penetration test, it is important
to take you through the steps that guide you through planning the
penetration testing process. The penetration testing plan steps include:
i. Determine the most critical and vulnerable systems to be tested
first. These can include server passwords or email phishing. Once
the core areas have been tested, you can then cascade down to all
the other systems.
ii. Assess the risks involved. It is important to always have a
contingency plan in case the penetration testing process goes
wrong. Determine how people and systems will be affected
beforehand.
iii. Determine testing schedule. It could be during regular business
hours, early mornings, or maybe late at night. The best way to test
the system would be to launch any type of test at any time of day.
The only exceptions would typically be full DoS attacks, physical
security and social engineering tests.
iv. Have a basic understanding of the system being tested. You may
need to get more details of the systems to be tested.
v. Define the actions to be taken in case major vulnerabilities are
found. If you discover a couple of security weaknesses, let the key
players know about it immediately. Keep testing the system until
you find it impenetrable.
vi. Determine the deliverables. These include detailed scanning reports
containing information about vulnerabilities and recommendations
on how to fix them.
vii. Determine the specific set of tools that you will need for your task.
Always ensure that you are using the appropriate tool for the right
task.
Answer:
the major difference between internal and external penetration testing is
that with internal penetration testing, it is assumed the attacker already
has access. In contrast, external penetration testing is the ability of a
remote attacker to get to the internal network.
157
5.0 Conclusion
In this unit, I explored the concept of a penetration test, rules and steps
that you need to follow to achieve a successful penetration test. A
penetration test is a great way to determine how well the security
measures of an organisation respond to a real-life attack.
6.0 Summary
In this unit, you learnt the concept of exploiting the weaknesses identified
during vulnerability assessment to gain unauthorised access to systems.
It is important to note that you need to properly plan and follow the rules
of a penetration test to achieve successful results.
158
Unit 4: Penetration Test Plan
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Penetration Testing Plan
3.1 Reconnaissance
3.2 Evaluating System Vulnerability
3.3 Penetration Testing
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
8.0 Summary
7.0 References/Further Reading
1.0 Introduction
In Unit 2, you learnt the roadmap to carry out a penetration test. In this
unit, I will take you through the main steps of the penetration test plan
from information gathering to the actual test.
perform reconnaissance
conduct penetration testing
evaluate system vulnerabilities.
159
There are two ways to test a system; a covert test and an over test. The
overt test is where you have some inside knowledge of the system you
intend to test. In the covert test, you do not know much information apart
from the name of the organisation. In the covert test, you have to search
for information on your own, the same way a hacker will do. This enables
you to see what a hacker would see when they try to gain access.
However, a covert test takes more time, and there is a higher chance of
overlooking certain vulnerabilities.
There are three main steps for conducting a penetration test. These are
reconnaissance/information gathering, evaluating system vulnerability
and penetration test.
Web Searches
These involve using the target's website and browse around as you try to
collect as much useful information as possible. If you are using Google,
you can use keywords to get the most relevant information.
Web Crawling
A Web crawler sometimes called a spider or spiderbot and often
shortened to crawler, is an Internet bot that systematically browses
the World Wide Web, typically for Web indexing (web spidering).
Web search engines and some other sites use Web crawling or spidering
software to update their web content or indices of other sites' web
content. Web crawlers copy pages for processing by a search engine
which indexes the downloaded pages so users can search more efficiently.
Certain web crawling tools can mirror a website and download all the
publicly accessible files from the target website. This then allows you to
scan the copy offline.
Websites
There are certain websites that contain information about different
organisations and their employees. You can even do a people search if
you just know which websites to use.
Network mapping
This is the process of searching public databases to discover the
information available about a particular network such as Whois. Whois
160
enables you to obtain information that will help you scan a network or
prepare a social engineering attack. You will be able to get the names,
phone numbers, and addresses linked to a specific Internet domain
registration.
System scanning
The information gathered from external sources can provide you with a
map of the entire network, revealing how the systems are interconnected.
You should be able to see the hostnames, IP addresses, open ports,
running protocols and applications.
Hosts
Scan and record those hosts that can be accessed externally via the
Internet and internally by an insider. Begin by pinging the IP addresses or
the hostnames. You can use either the standard ping tool that comes with
operating systems or a 3rd party tool such as SuperScan or fping.
Open ports
Several networking tools can be used to scan for open ports. These
include OmniPeek, Wireshark, SuperScan, among others. It is easier to
perform a scan internally than externally. To scan internally, connect your
computer to the local network and run the software. To scan externally,
just assign the computer you are using a public IP address and connect it
to a hub that is not within the firewall.
The next step is to start testing right away. You can either perform a
manual evaluation or an automated evaluation. In manual evaluation, the
potential vulnerabilities are assessed by linking to the ports that can be
exploited by hackers. Automated evaluations involve the use of tools that
test for weaknesses on a platform or network. Though these tools make
work easier and much faster, most of them only can test for specific and
individual system vulnerabilities.
161
you develop for a penetration test. After penetrating the system, you
should carry out the following:
1. Gather more information from the host system
2. Access other interconnected systems in the network
3. Start and stop specific services
4. Get a remote command prompt
5. Launch a denial of service attack
6. Gain access to confidential files
7. Disable inbuilt logging security checks
8. Perform SQL injection attacks
9. Take screenshots
10. Send emails to people as the administrator
11. Upload a file.
Answer: B
3. There are four main steps for conducting a penetration test, true or
false?
Answer: True
162
Mini-project
A Nigerian bank has been using online banking for ten years now. They
have their web servers at the head office in Abuja. The bank wishes to
understand their current level of risk. They contact you with an offer to
carry out a penetration test. They provide you with the IP address of their
web servers. Develop a penetration testing plan to assess the security
risk of their web servers.
5.0 Conclusion
In this unit, you learnt how to develop a penetration test plan to assess
the security risk of an organisation.
6.0 Summary
In this unit, I explored the necessary step needed by a security expert to
develop a plan for a penetration test.
163