Kali Linux - A Comprehensive Step by Step Beginner's Guide to Learn the Basics of Cybersecurity and Ethical Computer Hacking, Including Wireless Penetration Testing Tools to Secure Your Network by Jason Kno
Kali Linux - A Comprehensive Step by Step Beginner's Guide to Learn the Basics of Cybersecurity and Ethical Computer Hacking, Including Wireless Penetration Testing Tools to Secure Your Network by Jason Kno
A Comprehensive Step-by-Step
Beginner's Guide to Learn the Basics of
Cybersecurity and Ethical Computer
Hacking, Including Wireless Penetration
Testing Tools to Secure Your Network
Table of Contents
Introduction
You will get to know how hackers are able to gain access to your systems
and the methods they use to steal information. Furthermore, you will also
learn the countermeasures required to safeguard yourself against the
numerous hacking techniques. To this end, the books cover topics that
include: an Introduction to Kali Linux, The Basics of Kali Linux, The
Hacking Process, Wireless Network Hacking, Uses and Applications of
Kali Linux, Introduction to Cybersecurity
Network Scanning and Management and some basics on Web Security you
will need to know in your journey to be a professional hacker.
By the time you flip the last page of this book you will have mastered both
theoretical and practical concepts on the basic techniques that you require
to become a hacker. You will have the techniques needed for penetration of
computer networks, computer applications alongside computer systems.
Let me say that we have numerous books that cover this topic, but you
have decided to pick this one up. Many thanks for that. No efforts have
been spared in ensuring that the content in this book is relevant and
refreshing to you. Have fun reading!
Chapter 1: Introduction to Kali Linux
In this chapter you will be introduced to a diverse area of ethical
penetration testing. It is also referred to as ethical hacking and is defined
as a technical procedure and methodology which gives professional
hackers a platform to simulate the techniques and actions that real-life
hackers would use in the exploitation of an information system or a
computer network. We are going to learn the steps that are usually
followed by the penetration tester right from the understanding and
analysis of a select target to the actual break-in. The book also covers
topics dealing with the numerous tools that are used in the penetration
testing exercise. These are briefly introduced in this chapter but will be
covered in depth in chapter 4. The reader will get to understand the
practical applications of Kali Linux in the real world besides knowing how
to download and install this distribution of Linux. So, let us get into it
without further ado.
3) Web applications: Just like the name, tools in this category relate
to web applications. They include database exploitation, content
management system scanner, web vulnerability scanners, web
crawlers, and web application proxies.
4) Tools for password attacks: Tools that you can use to carry out
both online and offline password attacks are found under this
category.
5) Exploitation tools : You will find tools for the exploitation of the
vulnerabilities unearthed from a selected target environment. Here,
you will get exploitation tools you can use for databases, the Web,
and the network. Also, under this category, you will find tools for
carrying out social engineering attacks. The tools will give the user
information about the exploits carried out too.
6) Tools for sniffing and spoofing: The tools here are used for
sniffing web traffic and the network traffic. We also have network
spoofing tools, for example, Yersinia and Ettercap.
8) Tools for reporting: Tools that are used for documentation of the
penetration testing methodology and the obtained results and
recommendations are found in this category.
Hold onto this information for now as we will look at some of it in chapter
5.
This is usually the first step prior to beginning the technical assessment of
the security. It is essential that observations are carried out on the target
network environment so that the scope is well understood. It is also
possible to define the scope for a given set of entities or a single entity
that is given to the auditor. Examples of typical decisions normally made
in this step include;
2. Information gathering
After scoping has been done, the next phase is the reconnaissance phase.
Here, the penetration tester will make use of resources that are available
publicly to get a better understanding of their target. One can get valuable
information from sources on the Internet, which include:
Social networks
Articles
Forums
Blogs
Bulletin boards
Commercial or non-commercial websites
Newsgroups
Search engines, for example, MSN Bing, Google, among others.
Additionally, Kali Linux has several tools that you can use to get a target’s
network information. The tools use crucial data mining techniques for
gathering information from DNS servers, e-mail addresses, traceroutes,
phone numbers, Whois database, personal information, and user accounts.
Chances of having a successful penetration test increase with the amount
of information that is gathered.
3. Target discovery
Here, key activities are the identification of the network status of selected
targets, its OS and, if possible, the target’s network architecture. Such
information gives a penetration tester a comprehensive outlook of the
interconnected devices or current technologies in the network. That means
that they will be able to enumerate the numerous services running within
the network. It is possible to do all this (determination of hosts on the
network that are live, the running OS on the hosts and the characterization
of each of them based on their roles in the network system) using the Kali
Linux advanced network tools. The detection techniques employed by
these tools can either be active or passive. This is done on top of network
protocols and can be manipulated in a fashion that will yield useful
information. An example of this information is the OS fingerprinting.
4. Target Enumeration
This phase advances the previous efforts by finding open ports on the
systems being targeted. After the identification of open ports, enumeration
of the ports will be done for the running services. Employing port
scanning techniques like stealth, full-open, and half-open scan can assist a
hacker, or a penetration tester checks the visibility of ports. This is
possible for hosts that are behind an Intrusion Detection System or a
firewall. To help penetration testers or hackers discover existing
vulnerabilities in a target network's infrastructure, an investigation of the
services which are mapped to the open ports can be done. This means that
we can use target enumeration as a platform for unearthing vulnerabilities
present in the various devices on the network. Through the vulnerabilities,
one can penetrate the network. A security auditor can utilize Kali Linux’s
automated tools to do target enumeration.
5. Vulnerability mapping
7. Target exploitation
9. Maintaining access
10.
Reporting and Documentation
1. The test schedule should be chosen in a way that does not affect
or interrupt the normal operation of a business. It is prudent to
create a schedule that does not cover the typical working hours.
Terminologies
In this book, we are going to encounter commonly used terms in the field
of penetration testing. The terms are normally understood differently by
members, technicians and professionals in the same field, and that is the
reason we need a working definition to avoid any misunderstanding.
Below are the terms and associated definitions we shall be using.
Penetration Testing
We define it as the process, methodology and procedures that are used in
the attempt to bypass the safeguard mechanisms of the information
systems, including overcoming the integrated security set up of that
system. Normally, the entire process follows approved and specific
guidelines. Penetration Testing is concerned with examining the
administrative, technical, and operational controls and settings of a
system. The testing assesses the security of a particular information
system exactly as it is configured. The system administrators and staff of
the targeted network may or may not know that such an exercise is
happening.
Ethical Hacking
This is a professional penetration tester whose main job is to carry out an
attack on the computer or network systems for an organization or a
particular owner of the information system. In this book, you will note that
Ethical Hacking and Penetration Testing are used interchangeably.
White Hat
This terminology is synonymous with computer security professional or
an Ethical Hacker who is specialized in the security testing of information
systems so as to provide security where it is lacking or improve it where it
is possible.
Black Hat
This is a terminology used to describe a person who uses his IT skills for
bypassing the security of information systems without permission. The
intention of black hats is normally to commit computer crimes. Red Team
members, together with Penetration Testers, normally employ techniques
used by Black Hats in their work. This is to simulate the malicious fellows
in security testing while they are carrying out legitimate tests or exercises.
Grey Hat
In life, we have the good guys, the bad guys and those who lie in between.
In hacking, grey hats are those in the middle. Normally, they will try to
circumvent the security features of an information system in most cases
without prior permission. They do this normally to bring to light the
discovered weaknesses to the system administrators. In most cases, they
are not after profit. What makes them illegitimate is the fact that they do
not seek prior permission from the owners before carrying out their
activities.
Vulnerability Assessment/Analysis
This is an exercise done to evaluate the security configurations of a
system. The forms of the assessments that can be carried out comprise the
evaluation of security patches that have been applied to a system and those
that are missing. The team that carries out Vulnerability Assessment can
either be external or it can be part of an organization’s IT team.
Phishing
In this type of attack, attempts will be made to get the targeted entities to
reveal personal information such as passwords, account numbers, and user
names. Normally, this is done by the use of authentic-looking emails that
are fake. The emails can be from customer support staff, banks and
corporations. A different type of phishing attack is where users are
prodded to click on phony hyperlinks. This will make it possible for
malicious codes to be installed on the target system without the owner’s
knowledge. Once this has been done, the malware can be used to attack
other computers or for obtaining data stored on the computer. Phishing
attacks are by nature, not directed to a specific target. Targets can be all
the people in a mailing list or those whose email addresses have a specific
extension, such as those with a “@kali.com” extension.
Spear Phishing
This is a type of phishing attack whereby the targets are specific. For
instance,
An attacker can perform reconnaissance to discover email addresses of
top-level management of an organization. They can go ahead then to carry
out the phishing attack on only these individuals.
Dumpster Diving
In this technique, the penetration tester will make attempts to filter
through a systems’ discarded trash. This trash might be from any of the
users and the system administrators. Any information obtained here will
be of great help in understanding a particular target. A penetration tester
might recover information detailing network diagrams, system settings
and configurations, the hardware components and the software versions
that are being used. On a good day, one might even get user credentials
such as passwords and user names. Dumpster Diving is a term used to
explain the process of entering a large trash container. Also, garbage cans
from small offices normally have some lucrative information.
Downloading Kali
In the introduction, we pointed out that Kali Linux is a Linux distribution
and can be downloaded as an ISO file. You will be required to download it
from a different computer, after which you will burn it onto a disk before
installation. You can download this interesting distribution of Linux from
this link http://www.kali.org/downloads/ . To know how to install it, you
can get the documentation for configurations, advanced operations, and
special cases on http://www.kali.org/official-documentation/ . If you need
any additional help, we have an active community where you can make
any inquiries or you can help other members solve their problems.
Offensive Security manages these community boards, and new users are
required to register to enable them to obtain access.
At http://www.kali.org/ , you will find up to date guides for all the latest
releases of Kali Linux. As such, it is important to check out this site before
you carry out an installation. Kali Linux, besides being installed on a
computer’s hard drive, it can be run straight from the disk having the
converted image. This is what we call a Live CD. This enables the
operating system to boot. The tools that come with Kali will also execute.
The only thing to note here is that the operating system from the live CD
is nonpersistent. This terminology is used to mean that upon shutting
down the computer, any memory, documents, saved settings and any other
essential research or work is likely to be lost. A great way to learn Kali
Linux is by running it in a nonpersistent state. Additionally, your current
operating system will not be affected in any way. You can see that we have
an option for installation with Speech Synthesis. We will not be going into
the intricate details for that, but you should know that it is a recent
upgrade feature to the Debian operating system and Kali. Users can
control the installation procedure vocally if their hardware can support
speech synthesis. How exciting! Like I have said before, let us concentrate
on the graphical installation for
now. Using the directional keys, scroll and highlight Graphical Install and
bang the Enter key.
That will help to minimize networking complications. Once you are done
choosing a hostname, hit the Continue button to proceed. On the next
screen, you are going to provide a fully qualified domain name, FQDN.
For most lab environments, this is not necessary unless you wish to join a
domain environment. Let us leave it blank for now. We will click on the
Continue button to move ahead.
Setting Up Passwords
The next screen that comes up will prompt you for a root-level password.
In Kali Linux, the default password is toor. I recommend that you create a
new password that is strong, have no traceability to the user and that it
should not be easy to guess. On keying in the password twice, tap the
Continue button to move on to the next step. Are you still with me? Let us
now configure the system clock.
Partitioning Disks
We have several ways of configuring partitions for setting up a Linux OS.
We are going to focus on Guided Partitioning, which is the most basic
installation. The figures below display the settings that are normally
highlighted by default. You do not have to select anything till you reach
the figure under partition disks - 5. All you need to do is click on the
continue button until partitioning is complete. Let us take some time and
understand what is happening at each step of the installation wizard.
Below, you will see the various options that you can choose for
partitioning your computer’s hard drives during the installation.
Partition disks - 1.
For laptop SD card or thumb drive installation, it is not recommended to
use Logical Volume Management (LVM). Advanced users normally use
LVM for managing many hard drives. The option that you should select is
“Guided - user entire disk.” Hit the Continue button to move onto the next
step of the installation process. The figure below will indicate which drive
has been picked for installation. Click on Continue to proceed.
Partition disks - 2.
If you are a new Kali Linux user, select the option “All files in one
partition (recommended for new users).” This is the best option for you.
Hit the Continue button to proceed with the installation.
Partition disks - 3.
The wizard will take you through the above steps and present you with a
screen for your review. Now, a partition having all the system, scripting,
and user files, known as the primary partition, will be created as a single
partition. A second partition will be made for swap space. This is a virtual
memory in the system that is used for paging files to and from the
computer’s random-access memory and the central processing unit. It is
recommended that all systems running Linux have a swap area. The
common practice is to configure the swap area be one and a half times or
even equal to the amount of the computer’s installed physical random-
access memory (RAM).
Partition disks - 5.
From the figure above, you will be asked to “Finish partitioning and write
changes to disk.” Pick the Yes option and click on the Continue button to
proceed with the installation process. Take note that that will be the last
chance you will have to review your partitioning options prior to the
installation of the operating system on the hard drive. Should a need to
amend the sizes of the partition arise in the future, it is still possible to do
that. However, changing the partition sizes can destroy your operating
system if it is not carried out properly.
Installation in progress.
The partitioning of the hard drive and installation will begin after you
click continue (at the figure at partition disks – 5). The installation can
take an hour or even a few minutes depending on your computer’s
hardware.
Suppose you are utilizing a proxy; you will need to input the configuration
information on the next prompt the installation wizard will bring up. You
can leave it blank as below. Hit the Continue button to proceed to the
installation of the GRUB loader.
Configuring a proxy.
The Terminal
The very initial step in using Kali is to open the terminal, which is the
command-line interface we’ll use in this book. In Kali Linux, you’ll find
the icon for the terminal at the bottom of the desktop. Doubleclick this
icon to open the terminal or press CTRLALTT. The terminal opens the
command line environment, known as the shell, which enables you to run
commands on the underlying operating systems and write scripts.
Although Linux has many different shell environments, the most popular
is the bash shell, which is also the default shell in Kali and many other
Linux distributions. To change your password, you can use the command
passwd.
kali >pwd
/root
In this case, Linux returned /root, telling me I’m in the root user’s
directory. And
because you logged in as root when you started Linux, you should be in the
root user’s directory too, which is one level below the top of the filesystem
structure (/). If you’re in another directory, pwd will return that directory
name instead.
kali >whoami
root
root@kali:/etc# pwd
/etc
To move up one level in the file structure (toward the root of the file
structure, or /), we use cd followed by double dots (..), as shown here:
root@kali:/etc# cd ..
root@kali:/# pwd
/
root@kali:/#
This moves us up one level from /etc. to the /root directory, but you can
move up as many levels as you need. Just use the same number of double
dot pairs as the number of levels you want to move:
So, for example, to move up two levels, enter cd followed by two sets of
double dots with a space in between:
kali >cd .. ..
You can also move up to the root level in the file structure from anywhere
by entering cd /, where / represents the root of the filesystem.
To see the contents of a directory (the files and subdirectories), we can use
the ls (list) command. This is very similar to the dir command in
Windows.
This command lists both the files and directories contained in the
directory. You can also use this command on any particular directory, not
just the one you are currently in, by listing the directory name after the
command; for example, ls /etc. shows what’s in the /etc. directory. To get
more information about the files and directories, such as their
permissions, owner, size and when they were last modified, you can add
the -l switch after ls (the l stands for long). This is often referred to as the
long listing. See the example below:
Getting Help
Note the double dash here. The convention in Linux is to use a double dash
(--) before word options, such as help, and a single dash (-) before single
letter
options, such as –h. When you enter this command, you should see a short
description of the tool and guidance on how to use it. In some cases, you
can use either -h or -? to get to the help file. For instance, if I needed help
using the hacker’s best port scanning tool, Nmap, I would enter the
following:
kali >nmap -h
Finding Files
Until you become familiar with Linux, it can be frustrating to find your
way around, but knowledge of a few basic commands and techniques will
go a long way toward making the command line much friendlier. The
following commands help you locate things from the terminal.
If you’re looking for a binary file, you can use the whereis command to
locate it. This command returns not only the location of the binary but also
its source and main page if they are available. Here’s an example:
The which command is even more specific: it only returns the location of
the binaries in the PATH variable in Linux. For example, when I enter
aircrack-ng on the command line, the operating system looks to the PATH
variable to see in which directories it should look for aircrackng:
The find command is the most powerful and flexible of the searching
utilities. It is capable of beginning your search in any designated directory
and looking for several different parameters, including, of course, the
filename but also the date of creation or modification, the owner, the
group, permissions and the size.
Here is the basic syntax for find:
Very often, when using the command line, you may want to search for a
particular keyword. For this, you can use the grep command as a filter to
search for keywords. The grep command is often used when output is
piped from one command to another.
In the above example, the command will display all the services that are
running and then pipe that output to grep. What grep does is it will search
the received output for the keyword we asked it to look for. In our case, the
keyword is apache2. Grep will go ahead and output only the relevant
results. This command saves time.
Creating Files
There are many ways to create files in Linux, but for now, we will look at
two simple methods. The first is the cat, which is short for concatenate,
meaning to combine pieces (not a reference to your favorite domesticated
feline). The cat command is generally used for displaying the contents of a
file, but it can also be used to create small files. For creating bigger files,
it’s better to enter the code in a text editor such as vim, emacs, leafpad,
gedit or kate and then save it as a file.
The cat command followed by a filename will display the contents of that
file, but to create a file, we follow the cat command with a redirect,
denoted with the > symbol, and a name for the file we want to create. Here
is an example:
The second command for file creation is touch. This command was
initially developed so a user could touch a file to change some of its
details, such as the date it was created or modified. However, if the file
does not already exist, this command creates that file by default. Let’s
create newfile using the touch command:
Now when I then use ls –l to see the long list of the directory, I see that a
new file has been created named newfile. Note that its size is 0 because
there is no content in the newfile.
Creating a Directory
Copying a File
To copy files, we use the cp command. This creates a duplicate of the file
in the new location and leaves the old one in place. Here, we are going to
create the file oldfile in the root directory with touch and copy it to
/root/newdirectory, renaming it in the process and leaving the original
oldfile in place:
Renaming the file is optional and is done simply by adding the name you
want to give it to the end of the directory path. If you don’t rename the file
when you copy it, the file will retain the original name by default. When
we then navigate to newdirectory, we see that there is an exact copy of
oldfile called newfile:
Renaming a File
Unfortunately, Linux doesn’t have a command intended solely for
renaming a file, as Windows and some other operating systems do, but it
does have the mv (move) command. The mv command can be used to
move a file or directory to a new location or to give an existing file a new
name. To rename newfile to newfile2, you would enter the following:
Now when you list (ls) that directory, you see newfile2 but not newfile,
because it has been renamed. You can do the same with directories.
Removing a File
If you now do a long listing on the directory, you can confirm that the file
has been removed.
Removing a Directory
The command for removing a directory is similar to the rm command for
removing files but with dir (for directory) appended, like so:
It is important to note that rmdir will not remove a directory that is not
empty but will give you a warning message that the “directory is not
empty,” as you can see in this example. You must first remove all the
contents of the directory before removing it. This is to stop you from
accidentally deleting objects you did not intend to delete. If you do want to
remove a directory and its content all in one go, you can use the -r switch
after rm, as shown below:
Just a word of caution, though: be wary of using the -r option with rm, at
least at first, because it is straightforward to remove valuable files and
directories by mistake. Using rm -r in your home directory, for instance,
would delete every file and directory there, that is certainly not what you
were intending.
Note that we use the apt-cache command to search the apt cache or the
place it stores the package names. So if you were searching for the
intrusion detection system Snort, for example, you would enter the
command shown below.
As you can see, many files have the keyword snort in them, but near the
middle of the output, we see snort – flexible Network Intrusion Detection
System. That is what we are looking for.
Adding Softwares
Now that you know the snort package exists in your repository, you can
use apt-get to download the software. To install a piece of software from
your operating system’s default repository in the terminal, use the apt-get
command, followed by the keyword install, and then the name of the
package you want to install. The syntax looks like this:
Let us try this out by installing Snort on your system. Enter apt-get install
snort as a command statement, as shown below.
The output you see tells you what is being installed. If everything looks
correct, go
ahead and enter Y when prompted, and your software installation will
proceed.
Removing Softwares
When removing software, use apt-get with the remove option, followed by
the name of the software to remove. An example is listed below.
Again, you will see the tasks being done in real-time, and you will be
asked whether you want to continue. You can enter Y to uninstall, but you
might want to keep Snort since we will be using it again. The remove
command does not remove the configuration files, which means you can
reinstall the same package in the future without reconfiguring. If you do
want to remove the configuration files at the same time as the package,
you can use the purge option, as shown below.
Enter Y at the prompt to continue the purge of the software package and
the configuration files. To keep things small and modular, many Linux
packages are broken into software units that many different programs
might use. When you installed Snort, you installed several dependencies
or libraries with it that Snort requires so that it can run. Now that you are
removing Snort, those other libraries or dependencies are no longer
needed, so they are removed, too.
Updating Packages
Software repositories will be periodically updated with new software or
new versions of existing software. These updates do not reach you
automatically, so you need to request them to apply these updates to your
system. Updating is different from upgrading: updating updates the list of
packages available for download from the repository, whereas upgrading
will upgrade the package to the latest version in the repository. You can
update your system by entering the apt-get command, followed by the
keyword update. This will search through all the packages on your system
and check whether updates are available. If so, the updates will be
downloaded. See the example below.
Upgrading Packages
To upgrade the existing packages on your system, use apt-get upgrade.
Because upgrading your packages may make changes to your software,
you must be logged in as root or use the sudo command before entering an
apt-get upgrade. This command will upgrade every package on your
system that apt knows about, meaning only those stored in the repository,
as shown below. Upgrading can be time-consuming, so you might not be
able to use your system for a while.
You should see in the output that your system estimates the amount of
hard drive space necessary for the software package. Go ahead and enter Y
if you want to continue and have enough hard drive space for the upgrade.
Chapter 3: The Hacking Process
In short, Ethical hacking, performed by white hat hackers, is a term used
to describe defense hacking for companies and organizations, which
involves the identification of potential threats on a computer or network.
Like all good projects, ethical hacking also has a set of distinct phases. It
helps hackers to make a structured ethical hacking attack.Different
security training manuals explain the process of ethical hacking in
different ways, but in my experience, the entire process can be categorized
into the following six phases:
1. Reconnaissance.
2. Scanning.
3. Access Gain.
4. Maintain Access.
5. Clearing your Tracks.
6. Reports.
Reconnaissance
What is Reconnaissance? From the dictionary meaning, it is a preliminary
survey that is carried out to obtain information. An example is the
exploratory surveys that militaries conduct on the territory belonging to
the enemy. When it comes to cyber-security, Reconnaissance is a way of
gathering information on a target using different techniques. When
performing this exercise, there are three main information that is of
interest to an ethical hacker;
1. The Network.
2. The Host.
3. Users/People involved.
Enumeration
Enumeration, in the actual sense, is the complete listing of things in an
orderly manner with regards to items in a collection. Enumeration is the
act of making a list of policies, user accounts, shares and other resources.
This step happens just before vulnerability assessment and after scanning.
This helps the attacker put together the best strategy for gaining access.
Enumeration can be used to gain information on:
Scanning
This is a procedure that is used in the identification of services, active
hosts and the ports that are used by the target application. Let us say you
wish to unearth the vulnerabilities in a system, what you will need is a
point you can attack in the System. In ethical Hacking, Network Scanning
is employed to find out these points. These are points that Black Hats use
to penetrate a system. After discovering these points, the relevant teams
will then direct their efforts to improve the system. We know that all
organizations have networks. They can either be internal or even
connected to the internet. To hack these networks, you must first find a
vulnerable point within them so that you can use it to carry out exploits.
Network Scanning is the method we employ to help us discover such
points within a network.
Port Scanning
From the name, we can deduce that Port Scanning is a way of identifying
active ports on the network. A Port Scanner works by transmitting requests
from a client to the range of ports located on a network that they are
targeting. The details about the ports will be saved and then a response
will be transmitted back. This, good readers, is how active ports are found.
Upon acquiring a target’s IP address (through scanning a victim
organization’s UDP and TCP ports), the hacker will proceed to map the
organization’s network under his/her grab.
Inverse TCP Flag Scan: In this case, a hacker will transmit TCP probe
packets with a TCP flag (FIN, URG PSH) or with no flags. If there is no
response, then it indicates that the port is open and RST means the port is
closed.
ACK Flag Probe Scan: In this type of port scanning, an intruder will
transmit TCP probe packets to a point where an ACK flag is set to a
remote device that is used for the analysis of the header information. This
information comprises of WINDOW and the TTL field. To know if the
port is open or closed, one uses the RST packet. You can also use this scan
for checking a target's filtering system.
Vulnerability Scanning
Essentially speaking, this is a type of Network Scanning that we use in our
search for a network’s weak points. Vulnerability Scanning unearths the
vulnerabilities which can arise because of a misconfiguration of the
network or due to poor programming. Before we go far, let us have a look
at a few tools used for Network Scanning.
ZenMap: this scanner has a very powerful Graphical user interface tool
that can help one detect the type of OS version, port scanning, OS, ping
sweep, etc.
Net Scan Tool Suite Pack: this refers to a collection of different utilities
and tools that are used for performing web rippers, port scans, mass
emailers and flooding. Note that the tool is a trial version, but paid
versions are also available.
Omnipeak and Wireshark are famous and powerful tools that are used
for listening to network traffic. Both tools can be used as a network
analyzer.
Gaining Access
Gaining access is by far the most critical phase of an attack. I am talking
in terms of potential damage. Malicious actors do not always require to
have access to a system to cause damage. For example, a denial-of-service
attack can be carried out remotely with the potential to cause an abrupt
termination of the services that are actively being executed on the target or
in some cases, exhaust available resources. To stop a service, one can kill
processes. This can be accomplished by the use of a logic/time bomb.
Also, a reconfiguring and crashing of the system can achieve similar
results. Network resources can be exhausted locally via the filling up
outbound communication links. Such exploits can be done over a LAN or
the Internet, locally, or offline as a deception or theft. Let us list some
examples of these below:
Session hijacking
Buffer overflows that are Stack-based
Denial-of-service and distributed denial-of-service
Using this approach, they can transmit a malformed packet having a bug.
This bug will attempt to exploit vulnerabilities that are found in the target
system.
Maintaining Access
After a hacker gains access to his target system, he/she will need to
dedicate their efforts to ensure their boat remains afloat, metaphorically
speaking. The attacker can decide to exploit the hijacked system while
being in stealth mode, use it as a launching pad for attacks such as DDoS
or spam campaigns or use it for scanning and exploiting other systems. All
these actions can be damaging. Let me show you a practical example. A
hacker can create a sniffer to help them intercept all network traffic (both
inbound and outbound). Part of the traffic can include the telnet sessions
with other systems and file transfer protocols to enable them to send the
captured data to any destination. Those who do not wish to be detected
will be required to take steps that will help to conceal their presence. We
have many techniques to do this. The preferred method is where the hacker
installs hidden infrastructure based on covert channels, rootkits, Trojan
horses and backdoors to enable them to have unfettered access to those
systems.
A Covert Channel
This is a scenario where secret communication tunnels are used for
transmitting data. Examples of such paths include HTTP tunnels, DNS
tunnels, ICMP tunnels and VoIP. Take note that the covert channels we
have mentioned can be used for transporting encrypted data as well.
Detection of covert channels is possible. Only that it requires substantial
efforts on the victim’s part. There are indicators of anomalies in the traffic
going out, such as protocol analysis, network signatures and flow data
analysis. These require special tools to come across. Take note that the
detection of a covert channel is one thing, but blocking it is a different ball
game. You can employ one or more of the following measures.
Barring outbound ICMP at the corporate information border;
Rootkits
This is a malware that is highly adept at concealing itself from a computer
system. It is this feature that distinguishes rootkits from other malware
types. Their heightened capability to hide gives them the ability to
circumvent security measures that have been put in place on the computer.
The main idea behind their creation is the very fact that they are not easily
detected by normal malware detection software. Normally, Trojan horses
are used to load rootkits beginning with “user” level access on the
platform that is being targeted. Once in the target system, the rootkits will
spy on login details such as passwords so that they can get “administrator”
level access. Keen readers will say this is privilege escalation. That is
correct. Despite this, the real specialty of the rootkits is to maintain
access.
A computer system can be broken down into three basic layers. These are
the operating system, the kernel and the hardware level. The kernel is the
backbone of the operating system, essentially speaking. Many a time, low-
priority processes are used by user-level rootkits to compromise the
software tasked with safeguarding a computer. A dangerous and stealthier
rootkit is the kernel-level rootkit. This is majorly due to the following
reasons:
Rootkits that are installed at the kernel level will acquire complete
administrator access to the targeted systems. Rootkits normally create an
access path right to the operating system level, unlike Trojan horses.
Removing rootkits
The typical security measures, for instance, antivirus software, cannot
sufficiently deal with rootkits on their own. Alternatively, we have
purpose-built programs such as Malwarebytes Anti-rootkit, TDSSKiller,
Sophos Anti-Rootkit, and GMER that you can use to eradicate rootkits
from your system. Note that, in some cases, the rootkit cannot be removed
from your system for good. The programs above can only reduce the
adverse effects that the rootkit leaves all over your system. In addition to
using software to deal with rootkits, a user can also opt to initiate the clean
slate procedure. Here, the important files are backed up, and a clean re-
installation of the operating system is done. Normally, this will ensure that
the rootkit is removed from your system. Again, this is not a guarantee
that the removal will be 100%. We have BIOS-level rootkits, which are
rare but can survive the re-install. We will always have signs indicating a
presence of rootkits in any system, no matter how hard they try to hide.
This is major because they are designed to keep an ingress path for an
attacker from outside.
Data Exfiltration
This can be described as an unauthorized transfer of data to an external
device or system. The data can originate from IT servers or a computer
system. The process can either be manual (copy-pasting) or automatic
(through malware). Back in 2015, the security organization, McAfee,
reported that the majority of the data exfiltration cases (Around 60%)
were carried out through direct electronic means. The remaining 40%
happened via physical media, for example, stealing a laptop or using a
USB drive to download data. Interestingly, a significant portion of that
40% involved mobile phones. The data categories which were most
exfiltrated were personal health information, personally identifiable
information, financial data and intellectual property. Different kinds of
tunneling protocols, file transfers, web protocols or email transfers are
used in the electronic exfiltration of data. We know that the file transfer
protocol is a standard network protocol meant to help us transfer files. It
can also come in handy in data exfiltration campaigns.
Clearing Tracks
In this step, we will be learning about how hackers cover their tracks with
the objective of erasing any digital signs they may have left behind. It is
obvious that this as an unethical activity. Simply put, it is concerned with
the deletion of logs of the activities which took place during the hacking
process. I am going to be very detailed in the covering of this sub-topic
since it is of immense importance to the readers who seek to be
professional hackers. There is one more process after clearing tracks, that
is report writing, which is mostly paperwork. To know if a system has been
targeted, we can carefully examine digital signs left behind by an intruder.
It is in a hacker’s interest to clear any traces of such activity that can lead
to them. You may have noticed that in the previous phases, a penetration
tester or hacker successfully avoided detection by intrusion detection
systems and firewalls. In this phase, however, the objective is to conceal
any hints that are likely to disclose the nature of the hacker’s deeds.
Anti-Incident Response
The main objective of Anti-Incident Response is to disrupt, confuse and
out-maneuver the incident response team at work in the company, which
was targeted. Additionally, activities falling under this category make it
possible for a hacker/penetration tester to obtain a long-term foothold
within their target even after they have been detected. Crucial tasks that
can be carried out under anti-incident response include:
Anti-Forensics
Before we start devouring this topic, let us first understand what forensics
is. We define computer forensics as a discipline whose main objective is to
enable the acquisition, preservation, analysis and presentation of digital
evidence in a court of law by forensic experts. We define anti-forensics as
a discipline that encompasses all the existing means and tools for purposes
of deleting, modifying, or hiding digital evidence. The main objective of
anti-forensics is the destruction, erasure, or manipulation of digital
evidence. Anti-forensics has also been described by some as the “Attempts
made to negatively compromise the quality, amount, and the existence of
evidence from a crime scene or to complicate the examination and
analysis of evidence so that it is impossible or difficult to conduct.” One
can tell from the name that this is involved with the techniques or actions
that are supposed to create obstructions to an eventual digital investigation
and to reduce both the quantity and quality of digital evidence. Cyber
terrorists, hackers, counterfeiters, online pedophiles and other
cybercriminals are among the typical users of anti-forensic techniques and
tools. It is obvious that their intentions are to erase any existing traces
capable of incriminating them.
Deleting Evidence
There are those of us who are so paranoid to the extent that they have
invested resources on privacy protection tools and commercial disk
cleaners solely to wipe data they do not wish others to lay their eyes on. It
is believed that these tools can permanently delete everything from the
hard disk. The specific information that can be deleted include:
A forensic expert can use specific forensic tools to outsmart many of these
clean-up programs. For example, pictures of interest to a forensic expert
can be recovered. This is because even with the erasure of the original
image, Windows Thumbnails will still have a smaller version of this
picture. Even with the removal of the thumbnail, forensic can restore it by
doing what we call file carving. Jumplists can also give information
pertaining to pictures, applications, documents and numerous other types
of files that the user has interacted with. The jumplists are normally
created even for externally accessed files.
They will stay intact, regardless of whether there has been an erasure of
the original file or that the external device has been removed. These lists
will typically have a MAC address, the name, the path to the file being
accessed, the application used to view the file, the computer name,
alongside the time and date that the item was accessed. This implies that
jumplists can be used as an excellent proof of access. Deleting Skype
history manually will not clean internal data stored in the “chatsync”
folder. The folder’s content can be used to unearth bits of user
conversations. Despite the methods imperfectness (Deleting), when it is
done properly, it can dispose of evidence irreversibly, leading the forensics
experts to come out empty-handed.
Hiding, Moving, Renaming or Altering Files
This may sound naïve even though some of the wrongdoers can use this
method to evade detection. The method used to cover tracks here can
include renaming files, moving files containing conversation histories or
changing file extensions. This, my friends, is not an easy task. There exist
programs which can be used to break large files into small partitions.
These partitions can be concealed at the end of other files. Using
specialized programs, a hacker can use the unused file space, which is
known as slack space, for hiding crucial information from plain sight.
Additionally, a hacker can conceal a file inside another (You may have
heard of stenography). This method works fine with executable files.
Timestamping
Many a time, the investigators do not normally examine all the files in a
computer system. In most cases, they sort the information chronologically
so that they can prioritize their search for potentially relevant information.
They will want to view the information just at the time an attack occurred
in cases where it is known. Criminals will typically attempt to counter this
approach through the modification of the metadata belonging to the files
they require. Usually, they alter the times and the dates when each file was
last accessed, last modified and when it was created. This anti-forensic
technique is known as time stamping. Once the modification or
transformation of a file has been done, the computer or device will think
that the file is a different one. For instance, renaming an mp4 file to make
it look like a .gif file.
Log Tampering
In computers running Windows, log files are typically kept in the event
viewer. You can easily find it using the “Search” bar. The logs are stored in
the/var/log directory in most Linux/UNIX operating systems.
In summary
One precondition for success is being stealthy. Therefore, preventing
detection during the hacking process is not enough. The process should
continue even after the actual attack has been carried out. Any missteps
will likely set off the radar detection and the forensics team will be
quickly brought in to identify the attacker. This implies that the final step
of covering tracks is of immense significance and should not be
underestimated. If you wish to break into sophisticated systems,
maintaining a low profile is a key skill that you will be required to have.
We can say that covering tracks is a fail-safe technique that hackers
employ to keep them out of trouble. The trouble can be immediate or after
some time, say during an investigation.
Chapter 4: Wireless Network Hacking
Wireless Hacking
There are many advantages to using wireless networking. However, this
kind of technology comes with a host of threats and vulnerabilities that
hackers can take advantage of. Since information is sent over the air via
radio frequencies, it is easier for hackers to intercept it compared to wired
connections. This is more so when the information being sent is not
encrypted or the encryption algorithm is weak.
2. Malicious Association
This occurs when malicious hackers gain access to a private network using
their own device rather than through the legitimate access point (AP). A
hacker can create a "soft AP," which can be a laptop with software that
makes its wireless network card appear to be a genuine access point. This
allows the hacker to steal passwords, attack computers or send users
Trojan horse programs. A hacker can effectively have full control of every
computer that joins the fake network.
3. Ad-hoc Networks
These are networks between two wireless computers with no access point
separating them. Such networks can be attacked quite easily since they
rarely have adequate protection.
4. Non-traditional networks
5. MAC Spoofing
6. Man-in-the-middle Attacks
This occurs when a malicious hacker sets up their laptop as a soft access
point and then lures other users to use it. The hacker then connects the soft
access point to a genuine access point using a different wireless card, thus
forcing users to go through the fake AP to reach the real one. This enables
the hacker to sniff out whatever information they want from the traffic.
This type of attack has been made easier by software such as AirJack and
LANjack. Wireless Hotspots are a great place to launch this kind of attack
since there is hardly any meaningful security on such networks.
WEP
This stands for Wired Equivalent Privacy and was developed to provide
users with the same level of privacy as wired networks. It adheres to IEEE
802.11 WLAN standards. WEP encrypts data that is being sent over a
network to prevent eavesdropping.
WEP vulnerabilities
There are significant flaws in the design of this type of authentication
technique:
1. It uses Cyclic Redundancy Check 32 to verify the integrity of packets.
The problem with CRC32 is that a hacker only needs to capture two
packets to crack into the network. They can also modify the checksum and
encrypted stream to force the system to accept the packet.
4. It does not have a central key management system, thus making it very
difficult to change keys in big networks.
Due to the numerous security flaws, WEP has fallen out of favor and
replaced by WPA.
WEPCrack — This open-source tool can crack secret keys and can be
downloaded at www.wepcrack.sourceforge.net/
WPA vulnerabilities
1. Hackers can easily overcome it using denial of service attacks.
2. Its keys rely on passphrases and if weak passphrases are used, a
dictionary attack can be successfully launched.
Instructions:
1. Make sure your Wi-Fi adapter is in monitoring mode. To find the
wireless network that is being targeted as well as any clients connected to
it, enter this command:
A window will open up, displaying a list of clients who are connected to
the network. Their whitelisted MAC addresses will also be shown. These
are the addresses you need to spoof to enter the network.
2. Pick one of the whitelisted MAC addresses from the list to use to spoof
your own address. Before you can perform the spoofing, you must take
down the monitoring interface. Enter the command:
4. Then you use the Mcchanger software to change the address. Enter the
command:
5. Remember, you had taken down the wireless interface in step 3. Now it
is time to bring it back up. Use the command:
Ifconfig wlan0 up
Now that the MAC address of your wireless adapter has been changed to
that of an authorized user, test and see if the network will authenticate
your login. You should be able to connect to the wireless network.
Transmissions
Hacking of wireless networks poses three main threats: Disruption,
Alteration and Interception. To prevent malicious hackers from
eavesdropping on wireless transmission, you can use:
Access Points
Wireless access points that are poorly configured are a major vulnerability
and may allow malicious hackers unauthorized access to confidential
information. To secure wireless access points, the following
countermeasures must be taken:
Devices
There are two perspectives when it comes to assessing security threats
against wireless devices: Theft/Loss and Compromise. Laptops and PDAs
usually contain a lot of confidential and sensitive information and
therefore must be protected from theft or loss. Wireless client devices can
also be compromised when a malicious hacker gains access to stored data
in the device. Hackers can also use the device to launch attacks on other
systems and networks.
Networks
The Users
There is no greater way to secure a wireless network than educating and
training all users. Users are not just people who connect to the network but
IT personnel and administrators as well. It is very important to teach
people how to behave in a way that will maintain the security of the
wireless network. This user training and education must be a periodic
endeavor.
Let us face it. It is not possible to completely eliminate every risk that a
wireless network comes with. Eventually, a hacker will get through.
However, there are actions that can be taken to maintain a reasonable level
of general security. This is possible using systematic risk evaluation and
management techniques. Every component of a wireless network must be
considered when establishing countermeasures against malicious hackers.
Chapter 5: Uses and Applications of Kali Linux
The uses of Kali Linux are wide-ranging. Below, I have outlined and
discussed some of them. Feel free to download the documentation from
the links provided in chapter 2. Now let us get down to the serious stuff.
Penetration testing
This is a mechanism that is utilized by organizations to ascertain the
robustness of their security infrastructure. Here, security professionals
will play the role of the attackers, whereby they will attempt to discover
flaws and vulnerabilities in a system before the malicious fellows do. One
key objective is the identification and reporting of vulnerabilities to
companies and organizations. As organizations become increasingly
security conscious and the cost of security breaches rises exponentially,
many large organizations are beginning to contract out security services.
One of these critical security services is penetration testing. A
penetration test is essentially a legal, commissioned hack to demonstrate
the vulnerability of a firm’s network and systems. Generally, organizations
conduct a vulnerability assessment first to find potential weaknesses in
their network, operating systems and services. I emphasize potential, as
this vulnerability scan includes a significant number of false positives
(things identified as vulnerabilities that are, in reality, not vulnerabilities).
It is the role of the penetration tester to attempt to hack, or penetrate, these
vulnerabilities. Only then can the organization know whether the weakness
is real and decide to invest time and money to close the vulnerability.
Forensics:
For years, the popularity of Forensic Linux Live Boot environments has
become well known. There are so many forensic tools that are Linux based
on this distribution. Using Kali, forensic experts can do all that pertains to
their tradecraft starting from the initial triage, data imaging all the way to
case management and full analysis.
Reverse Engineering:
Recently, reverse engineering has become an indispensable skill in various
sectors, including law enforcement. Reverse Engineering is a primary
method that is used in the identification of vulnerabilities and the
development of exploits. That is on the offensive side of it. Defensively
speaking, reverse engineering can be utilized in the analysis of malware
that has been used to target a given system. Here, the objective will be to
establish the capabilities of a given piece of tradecraft.
Wireless Attacks:
Kali supports a wide range of wireless hacking tools. What makes wireless
networks a commonly attacked vector is their pervasive nature. Kali Linux
also supports multiple wireless cards and is a hacker’s favorite choice for
conducting attacks against different types of wireless networks.
Password Attacks:
Kali Linux can be used for conducting password attacks where a user
encounters an authentication system. The OS comes with numerous useful
tools and utilities for this purpose. We have both offline and online
password attack tools that a Kali Linux user can use to deal with hashing
and encryption systems.
Database Assessment:
Kali Linux is capable of database attacks such as SQL injection and
attacking credentials. All this is made possible by the tools present in
Kali’s vast repositories that can be used for testing attack vectors ranging
from data extraction and analysis to SQL injection.
Stress Testing
To check whether your system is stable, you carry out a stress test on it. In
this scenario, you will use the numerous tools provided by Kali Linux to
generate more than normal traffic. This way you will be able to know the
limits of your system. The tools for stress testing can either be proprietary
or open-source. As an expert, it is essential that you know all the tools that
are used for testing a system’s availability.
Hardware Hacking
Another application of Kali Linux is in hardware hacking. Kali Linux
comes with the following tools that can be used to accomplish this task.
Introduction
We define cybersecurity as being the protection of computer systems,
computer networks, and their associated programs from attacks that are of
a digital form. Typically, cyberattacks are carried out with the intent of
gaining access, modification or even destruction of information that is
sensitive. They also attempt to extorting money from victims and are
meant to interrupt the normal processes of a business.
Confidentiality:
This is a rough equivalent of privacy. While ensuring that the right people
can have access to crucial information, it is also prudent that vigorous
measures are undertaken to make sure that there is confidentiality. There
should be restricted access to the data in question by those who are
authorized to view it. Out there, it is not uncommon to categorized data
based on the type and amount of damage that can result from it falling into
unauthorized persons. Stringent measures can more or less be
implemented depending on these categories. Guarding the confidentiality
of data sometimes requires specialized training for authorized to view/use
persons. It would generally involve security risks that could harm that
information. It can, without a doubt, help people with the proper
authorization to get to know the various risk factors and equip them with
countermeasures. Additional aspects of the training may comprise best
practices in password-related issues alongside social engineering
mechanisms.
This will help them avoid breaching rules governing data-handling with
potentially disastrous results in as much as they may have intentions we
can describe as being noble. For example, using a routing number or an
account number is an effective measure that can be used to ensure
confidentiality. We can also employ the use of data encryption to make
sure that there is confidentiality. Passwords and user IDs are part of a
standard procedure that is becoming a common phenomenon, two-factor
authentication. There are different options. They include security tokens
(soft tokens or key fobs) and biometric verification.
Integrity:
This component of the triad comprises ensuring the trustworthiness,
consistency, and accuracy of data throughout its complete life cycle. It is
of immense importance that data that is in transit is not altered. Solid
steps need to be taken to make sure that no modification on the data by
unauthorized people happens. For instance, in cases where we have a
confidentiality breach. Here, the countermeasures can involve user access
controls and file permissions. To prevent accidental deletion or erroneous
changes by authorized users, we can employ the use of version control. In
place, there also need to exist mechanisms to help in the detection of data
changes, which may result from non-human events, including a server
crash or an electromagnetic pulse. We can include checksums and
cryptographic checksums to help with the integrity verification of data.
Lastly, it may be necessary to have some form of redundancies and
backups that will help in the restoration back to its former state.
Availability:
The rigorous maintenance of all the hardware ensures that there will
always be availability fo the services rendered by this hardware. Failing
equipment should be promptly and adequately repaired to keep in order a
properly functioning operating system environment that is devoid of any
software conflicts. One aspect of maintenance that should also be carried
out is updating all the necessary system components. It will also be to
provide ample bandwidth for communications and to ensure a minimal
occurrence of bottlenecks. Mitigation of hardware failures and their
repercussions can be done using high-availability clusters, redundancy,
RAID and even failovers.
For the worst-case scenarios that occur, disaster recovery that is both
adaptive and fast is essential. For this to be possible, the disaster recovery
plan laid down has to be comprehensive. Prevention of data loss or
connection interruptions needs to also account for unpredictable events.
Examples include fire and natural disasters. Copies of back up data can be
securely stored at a location that is geographically-isolated to prevent loss
of data resulting from such occurrences. Such sites also need to be water
and fire-resistant. To guard against issues such as downtime and
inaccessibility of data due to denial-of-service attacks and network
intrusions, we can employ the use of extra security equipment, for
instance, proxy servers, firewalls and software.
The transmitted data from a particular endpoint may not, on its own,
necessarily result in any privacy issues. The catch is, however, when the
fragmented data from multiple endpoints is accessed, gathered and
analyzed, sensitive information can be obtained. Securing the Internet of
Things is itself a formidable challenge since it comprises numerous
Internet-enabled devices besides computers. Such devices are, in most
cases, often set up with default passwords that are weak or in some cases,
the devices are unpatched. Unless IoT is protected adequately, there is a
likelihood that it may be used as a separate vector of attack or be made a
part of a thingbot. Recently, it has been demonstrated by researchers that it
is possible to compromise a network just by using a Wi-Fi-enabled light
bulb. It is essential for us that we consider the security of the numerous
network-capable products that are under development.
Encryption
We define encryption as a mechanism through which plaintext or other
data type are changed from their currently readable form to an encoded
way. It is only an entity having access to a decryption key that can decode
the data. This is an important measure that usually is used to provide end-
to-end data security across networks. Encryption, as a proactive security
measure, is commonly used all over the internet for purposes of protecting
crucial information belonging to users, which is being exchanged between
servers and browsers. That can include private information such as
payment information, passwords and other personal information.
Individuals, together with organizations, may also opt to use encryption to
ensure the safety of sensitive data that is stored on mobile devices, servers
and computers.
Benefits of Encryption
Confidentiality of digital data, which is stored on computer systems or
that which is sent through the internet or any other computer network, is
protected by using encryption. Organizations such as Payment Card
Industry Data Security Standard (PCI DSS) require that sensitive data be
encrypted to keep unauthorized entities from accessing the data. We also
have some standards requiring or recommending data encryption.
Nowadays, modern encryption algorithms serve an integral role in making
sure that the security of communications and IT systems possess not only
confidentiality but also the under listed key elements of security:
Authentication: the origin of a given message should be able to
be verified.
Integrity: This has got to do with keeping the message intact.
That is, the contents of messages have not been altered or
deleted from the time it was sent.
Nonrepudiation: Here, non-repudiation means that a particular
sender cannot dispute that they send the message.
Data Redundancy
For any organization, it is essential first that regular services are restored
as soon as possible after there has been a security breach. Data should be
able to be reconstructed as quickly as possible. To this end, businesses
have come up with various ways to make sure there is data redundancy. It
is common knowledge that these methods come with their own merits in
terms of cost-effectiveness, speed and management. The most common
way is using off-site tape backups. In this method, magnetic tapes are
used to store a complete bit-for-bit copy of a storage volume. The tapes
can be transferred to an off-site storage facility where they can be easily
retrieved whenever there is a catastrophic failure. Besides, we can use
Cloud Backup to safeguard data against losses.
Network Redundancy
Most of the infrastructure we use for our networks are unbelievably
fragile. For instance, when a router burns out due to one reason or another,
the result is that there will be a prolonged period of network downtime. To
mitigate against this, businesses make sure that networks they use have an
adequate redundancy so that they can survive and provide services in cases
of an emergency. Fundamentally, network redundancy means that no
matter what type of failure occurs, a network will still be up and running.
To be able to do this, we can have multiple network devices such as hubs,
routers and switches configured to stand in for one of them that fails. We
also have ISP redundancy, where a gateway in the network is joined to
more than one separate ISP. Just like with the devices, one ISP will take
over whenever there is a failure. In cases where a network is functioning
correctly, we can use the ISPs to share the traffic resulting in reduced
congestion of the network. This here is called load sharing.
Preventing a SPOFF
SPOFF is full for a single point of failure. We do not desire that one
critical part of a system failure can render the entire system unusable. Any
planning needs to mitigate this phenomenon. A single point of failure can
be reduced or eliminated by way of redundancy. This will make sure that
there is not a single component that can prevent the proper working of a
system.
Chapter 7: Network Scanning and Management
Introduction
The ability to scan for and connect to other network devices from your
system is crucial to becoming a successful hacker, and with wireless
technologies like WiFi
and Bluetooth becoming the standard, finding and controlling WiFi and
Bluetooth connections is vital. If someone can hack a wireless connection,
they can gain entry to a device and access to confidential information. The
first step, of course, is to learn how to find these devices. In this chapter,
we are going to examine two of the most common wireless technologies in
Linux: WiFi and Bluetooth.
Network Scanning
We say that it is the utilization of a computer network for purposes of
collecting information about IT systems. We carry out scanning of
networks primarily to help us do system maintenance or a security
assessment. Hackers can also conduct a network scanning exercise before
launching their attacks. The following are some of the reasons we scan
networks:
This, therefore, implies that network scanning is among the crucial steps
an attacker needs to be able to gather information.
When you do this correctly, Linux will go back to the command prompt
and say nothing. This is a good thing! Then, when you again check your
network connections with ifconfig, you should see that your IP address has
changed to the new IP address you just assigned.
IP Addresses assignment
Linux has a Dynamic Host Configuration Protocol (DHCP) server that
runs a daemon, a process that runs in the background, called dhcpd or the
dhcp daemon. The DHCP server will carry out the assignment of IP
addresses to all of the systems that are located on the subnet. It also keeps
a log of which IP address is allocated to which machine at any one time.
This makes it an excellent resource for forensic analysts to trace hackers
after an attack. For that reason, it’s useful to understand how the DHCP
server works. Usually, to connect to the internet from a LAN, you must
have a DHCP-assigned IP.
Therefore, after setting a static IP address, you must return and get a new
DHCP-assigned IP address. To do this, you can always reboot your system,
but I will show you how to retrieve a new DHCP without having to shut
your system down and restart it. To request an IP address from DHCP, all
that is required is to call the DHCP server using dhclient, followed by an
interface that you wish to assign the address. The different Linux distros
use different DHCP clients. Kali, for instance, is based on Debian that
uses dhclient.
DNS is the service that translates a domain name like google.com to the
appropriate IP address. This way, your system knows how to get to it.
Without DNS, it would mean that we would be required to remember the
thousands of IP addresses that belong to the websites we visit frequently.
Dig is one of the commands any aspiring hacker needs to know. It offers a
way to gather DNS information about a target domain. The stored DNS
information can be a crucial piece of early reconnaissance to obtain before
attacking. This information could include the IP address of the target’s
nameserver (the server that translates the target’s name to an IP address),
the target’s email server and potentially any subdomains and IP addresses.
You can also use the dig command to get information on email servers
connected to a domain by adding the mx option (mx is short for mail
exchange server). This information is critical for attacks on email systems.
In some cases, you may want to use another DNS server. To do so, you will
edit a plaintext file named /etc/resolv.conf on the system. Open that file in
a text editor. Then, on your command line, enter the precise name of your
editor, followed by the location of the file and the filename.
Wi-Fi Networks
Firstly, let us look at WiFi. Before doing so, here is a small introduction to
the various WiFi security protocols that usually are frequently used. The
original, Wired Equivalent Privacy (WEP), was severely flawed and easily
cracked. Its replacement, WiFi Protected Access (WPA), was a bit more
secure. Finally, WPA2PSK, which is much more secure and uses a
preshared key (PSK) that all users share, is now used by nearly all WiFi
AP’s (except enterprise WiFi).
iwevent
This command displays Wireless Events received through the RTNetlink
socket. Each line shows the specific Wireless Event, which describes what
has happened on the specified wireless interface. This command doesn't
take any arguments.
iwlist
This command can be used for scanning wireless networks available and
also for displaying any other information about the wireless networks
which are not displayed when the iwconfig command is used. Iwlist is
utilized in the generation of wireless access points that are nearby together
with their SSIDs and their MAC addresses.
iwspy
This command is used for monitoring nodes in a network. It can also be
used for recording the link quality of the nodes.
ifrename
This command is used for renaming wireless network interfaces depending
on multiple criteria that are static to allocate names consistently to each
interface. The interface names usually are dynamic by default. This
command helps users decide the name of the network interface.
iwgetid
This is used in the reporting of the NWID, ESSID or address of the access
point of the wireless network presently being used. By default, iwgetid
will display the devices’ ESSID. Suppose that it is unavailable, it will
output its NWID instead. The information reported is the same as the one
shown by iwconfig. In comparison, it is easier to do integration in various
scripts.
Technical information
Name
List of services
Class
Upon pairing, two Bluetooth devices will exchange a link key. The devices
will store the key to be used in the identification of the other device in
future pairings. Every device has a unique identifier and usually a
manufacturer-assigned name. These will be useful pieces of data when we
want to identify and access a device.
l2ping MACaddress
Summary
Wireless devices represent the future of connectivity and hacking. Linux
has developed specialized commands for scanning and connecting to Wi-
Fi APs in the first step toward hacking those systems. The aircrack-ng
suite of wireless hacking tools includes both airmon-ng and airodump-ng,
which enable us to scan and gather vital information from in-range
wireless devices. The BlueZ suite includes hciconfig, hcitool and other
tools capable of scanning and information gathering, which are necessary
for hacking the Bluetooth devices within range. It also includes many
other tools worth exploring.
Chapter 8: Web Security
Web Security
Just like physical stores, homes, government locations, web applications
alongside websites are also susceptible to their security arrangements and
protocols being circumvented. What is needed to counter cyber-crimes and
the compromising of web applications is robust and reliable security
measures.
Web security does this exactly. A functional definition of web security for
us can be that it is a set of protocols and protection measures employed in
the safeguarding of your website together with your web applications
against hacking and against unsanctioned access by personnel who are
unauthorized. The integral division of Information Security can protect
web services, websites and web applications. This provides crucial
security for anything that is carried out on the Internet.
It is risky to let visitors on your website upload files. The uploads may
contain a script meant to exploit vulnerabilities present on your website.
All uploads need to be treated as a threat to the security of the website.
This tells the visitors of a given website that essentially, they are dealing
with a proper server. This translates to “no one can intercept the
interactions they are having or the content they are viewing.”
Security starts with you! It is important that you take care of the security
of your devices. Hackers can use your PC as a gateway to your website.
Ensure that you have antivirus software that is updated with the latest
definitions. This will protect you from many malicious attacks including
from file downloads. It is also possible to inject malware to the websites
through stolen FTP login credentials. It is important that you frequently
scan your devices for malware and viruses regularly.
We have seen that numerous attacks are normally automated these days.
Malicious users do program bots to help them locate sites still using their
default settings. Make it hard for them. Upon installation of a CMS you
own, modify the settings which are still on default mode:
✓ Settings required for comments
✓ Controls that users require
✓ Information visibility
✓ Permissions for files
Software updates
All the software must stay up to date. This includes the CMS, plugins,
Word Press software, among many others. The updates bring improved
functionality, security patches to cover vulnerabilities, fixes for bugs and
software glitches, and so on.
Web hosting plans that are shared have higher chances of getting
compromised. In as much as they are appealing to users due to the
potential cost savings, the levels of protection are reduced. As such, they
are not a secure option. Remember, cheap is expensive!
Do a password change
Password changing is a significant shot in the arm for web security. So,
change your password. Changing the password alone is even not enough;
make it a habit to change it often.
You can get utilities that can help you monitor your websites’ security
online. Such utilities can help you with conducting security audits, which
can help to expose potential vulnerabilities. In so doing, you can launch
countermeasures before an attack happens.
It is said that when you have been forewarned, you should forearm
yourself. It is good to always be prepared for the worse. In this case, the
worst that can happen is your website getting compromised. A backup
ensures you are at peace since there will be no data that is lost in the event
of a compromise.
Conclusion
May I take this opportunity to thank you for being able to make it to the
end of this informative book, Kali Linux. I want to believe that it has been
edifying, and through it, you are now able to hit the ground running in
matters revolving around hacking. Also, I hope that you have gained the
relevant expertise to enable you to begin your hacking career or better
your skills if you are already one. I sincerely hope that you have enjoyed
turning pages right from the first topic which was Introduction to Kali
Linux, all through The Basics of Kali Linux, The Hacking Process,
Wireless Network Hacking, Uses and Applications of Kali Linux,
Introduction to Cybersecurity, Network Scanning and Management and
Web Security. I trust that by studying this book, you have gotten to learn
plenty of practical concepts that you need to become a hacking expert.
By now, you must have been able to get access to a vast body of theoretical
knowledge regarding the various types of attacks that can be launched on
your systems, the reason for launching them and how you are able to
safeguard your infrastructure against such attacks. These are your first
steps towards becoming a professional hacker. The book covers topical
issues like wireless network attacks, cyber-attacks and penetration testing,
among others. It, therefore, means that you are now in a good position to
discern network attack mechanisms that occur in the real world and
prescribe appropriate remedies.
I have also given you a few security measures you can implement to keep
your networks safe. The formatting is such that the language is a user-
friendly language that you can understand the importance of securing your
networks. Going forward, the next step is to put the concepts you have
acquired from this book into practice. They say practice makes perfect and
it is by practicing that one can become an expert in the field of hacking,
more so using Kali Linux. Let the knowledge you have acquired from the
book work for you.
Finally, if you found this book useful in any way, a review on Amazon is
always welcome!