Ceh
Ceh
SOFTWARE REQUIREMENTS
1. ORACLE VIRTUAL BOX - Enable Virtualization Technology Via
BIOS environment
SYSTEM REQUIREMENTS
1. RAM: at least 8gb ram above (On search bar, search for system
information, click on it, you’ll find the RAM there).
4. HDD (Hard disk): You should have a free space of at least 250GB
5. Your system should support Virtualisation technology
AN ALTERNATIVE IS:
- DUAL BOOTING
- LIVE BOOT FROM USB - (for this, you need tools like
RUFUS to make the USB drive bootable)
Monday 24/7/23
INTRODUCTION TO KALI
- File structure
- The Terminal
- apt: to download
Note: you must first update your repository before you can do
anything on kali.. without that, if you want to install anything it won't
go... We also need permission from the admin to update repository. the
command is - (sudo apt update)
- pwd: shows the current directory or folder that you are. pwd
means print working directory. home/[username] is the default
directory when you start up your terminal
cd .. : this will take you one step down to the former directory
- ls: this command list the content of a directory. we can also use ls
command to see hidden files and folders.
right click, click on create folder, then you add (.) before the file
name... it will automatically hide the folder (to hide a file in linux, you'll
add a . at the beginning of the file name)
- nano: nano is a cli text editor. this editor can only be used on the
terminal. it can be used to read a file and write into a file
cat [filename.extension]
Permission in Kali:
(-rw-r--r--) --> -[rw-] [r--] [r--] : this means the first file is for
the owner, therefore the owner is given read and write permission, the
second part is group and the group is given only read permission and
the third part is others and the others is given only read permission.
to give permission to owner is (sudo chmod u+x
(filename) ] -
- cp: this command is used to copy a file from one directory to the
other. It duplicates the file i.e the original file will be there and it justs
copy it to another directory
Note: the file might be locked i.e it will bring that the file
belong to root. the command to remove the restriction on the
file is;
eth0 - interface
netmast -
inet6
netstat -ano
to end a process: press k and it will ask you input the PID
number
man [command]
[command] --help
ANONYMITY IN KALI
Step3: use the command (sudo apt install tor) to install tor
Step6: go to the proxy tab and click on it, click options, then add
Step7: give the add a name (tor proxy), then choose SOCKSS5 under
proxy type
Step8: go to your terminal and copy the ip address, and port address
Step10: go to your proxy server and click on the new one you add
we'll be using MAC changer for mac address. press ctrl + C to stop tor
on the terminal
SNIFFING
acive sniffing: this is relative. you can both monitor and alter on
the active sniffing.
practically:
to start sniffing:
TASK
Footprinting: this means the tool will carry out information passively.
it is based on third party knowledge
Fingerprinting: this means the tool will carry out the attack actively.
DNS server: dns is the phone book of the internet. it is your domain
name provider that have the server of the dns. the webserver depends
on the dns server.
Tool to use
Steps:
under the host's address, you'll get two ip address for the
web server which means that either of them is a
secondary server or a load balancer i.e anytime you
connect to the website, it can connect to either of the ip
address. when an attacker attack one of the ip address, it
means there is still another ip address left.
the first time there (5) means TTL (time to leave) - it means
how many time does the packet have to be discarded
Class, this is where you get the class of the ip address. most
network are already subnetted
whatweb [domainname]
Email reconnaisance: this gives you the email address of the staffs
in that organization. we will be using the tool theHarvester to gather
those information.
after that, cd to the above path and sudo open the file [sudo api-
keys.yaml]
Types of Firewal
- statefull
- hybrid firewall
CLASSWORK
Carry out reconnaisance with the whatweb and wafw00f tool using
proxy
Note: that whatweb only recognize HTTP proxy so you have to use
Burpsuite but watw00f recognizes both HTTP proxy and SOCKS5
proxy
reconftw is the best tool you can use for reconnaisance. it does all
watw00f and whatweb tool. reconftw doesn't come with kali so we
have to download it from github. to get the tool from kali is the
following;
(each time you want to download a tool from the github, you have to
scroll down and look for the installation setup and guide. that will give
you the guide to download and setup the tool)
- check on the instruction and see, you might have to install golang
first
to install golang
- then login as root using sudo bash - this will login as root under
the downloads file
- then go to your installation guide and copy the codes there and
follow the process
now go back to your github installation guide and follow the steps
under it
- after the first step, go to the second step and copy the code under
it then run it line by line
after installation, to run the tool reconftw, you'll cd into the recon file
and type in the command ./reconftw.sh -d [domainname.com] -r
WEDNESDAY 16/08/23
192.168.0.21:80 when you scan a port and you saw a port 80, that
means the service is running on the web
Types of Ports
- well known ports: the port number ranging from 0 to 1023 and
examples are
0 Reserved TCP/UDP
21 FTP TCP
23 telnet TCP/UDP
25 SMTP
53 DNS
80 HTTP
FTP (file transfer protocol) is for files, if you break into a FTP port
you can steal files
SMTP (simple mail transfer protocol) - this means it can send and
receive emails
Port Scanning with Nmap - Nmap is one of the best opensource tool
you can use for portscanning. Nmap is flexible aiside from port
scanning it can carry out other functions, it is powerful and easy to
use.
Syn stealth scan: this carry out scans without raising flags. it is
stealthy, it can not be noticed. the concept behind this scan is that, it
will send a syn flag to the target and the target will respond with syn-
ack but instead of nmap to send an ack flag, it will send a reset to
bypass the server. The syn steath scan does not complete the 3way
handshake
by default, the syn stealth scan will only scan for well known ports so
to get nmap to scan from a range of port, you'll use the command
sudo nmap -p 21-65535 -sS [domainname] ; -p is for port range
Fragmented Scan - you carry out this scan when you don't get
results from the syn stealth scan. fragmented scan bypasses firewall
and. it splits the packet into hidden bits and it will get into the firewall.
firewall doesnt have the capability to defragment packets. you'll use
the command sudo nmap -f [domain.name] for fragmented scan.
Note that both syn stealth scan and fragmented scan will get you the
same result just that they use different approach.
Ping scan - ping scan is similar to ping you normally use. it send an
ICMP ECHO REQUEST and if the port is . it will show you the ip address
and mac address of a network. ping scan is used for auditing
networks. we'll be carrying out ping scan locally and remotely. if we
want to know how many people connected to our wifi, you can use
ping scan to know how many people connected - locally. to do it
remotely, it'll scan the number of connected devices on the network
and can instruct all the devices to attack the system
to do it remotely
bridge shares the same network with your windows i.e while NAT uses
another network. NAT (Network Address Translator) is used to translate
a private IP to a public IP
- to initiate the ping scan, type in the command sudo nmap -sP
[your.kali.IP.address] Note that you'll change the last octet to
1-255 as in 192.168.136.[1-255]
to scan for ipaddress of port in a target host, use the command sudo
nmap -sp [ipaddress.1-255]
Version Detection Scan - this nmap scan is not only going to tell us
the port number, its going to give us the version number and their
product name of the web servers too. to do this, we'll use the
command sudo nmap -sV [domainname]
OS Fingerprinting Scan - this type of scan will get you the operating
system the target is using.
when you carry out the scan, you'll determing the type of OS the
server is running on by the ttl
ASSIGNMENT
nmap -sC [domain.name] - this will carry out a scan on all the
scripting lang
using nmap:
to open a port, you use this command sudo service apache2 start;
this will open port 80. for port 21, you have to install vsftpd first. to
install that you use the command sudo apt install vsftpd then to
open it, you use the command sudo service vsftpd start
to stop port you'll use the command sudo service [porttype] stop
to close port 21, you use the command sudo service vsftpd stop
and likewise for port 80 to sudo service apache2 stop
Mitigation
Vulnerability Assessment
- wireshark
- nmap
- metasploit
for web security,
- Nikto
- OWASP
for automated:
- Nessus; one of the best tool. here we'll learn how to install nessus on
windows and kali.
for windows;
- it will take you to the download page, click on it and install it on your
windows
- after installation, it will take you to your browser where you'll click on
connect via SSL
- click on continue and make sure you tick register for nessus
essentials
- skip to the next step since you already have an activation code
- after that click on the next button and wait for it to download the
plugins
- cd Tenable
- cd Nessus
- nessuscli.exe update
https://localhost:8834 127.0.0.1
- click on 'create a new policy', there are many type of scan nessus
can carry out but we'll go with 'Advanced Scan'
- next, go to 'Port Scanning', type in your port range but we'll use
default. the default is from 1-1024
- next is the brute force, if the server is using Oracle Database, you
should check on Test on default accounts
- check on do not stop after first flaw and check on 'look for all flaws'
also
- click on new scan, you'll see user defined at the top - click on it and
you'll see the policy you created.
the only thing we need to use for this scan is the ip address.
- click on scheduled and make sure its not enabled since we are
scanning now
- click on launch to begin the scan and you can also click on it to check
the progress
you'll see report at the top, click on it and click on detailed vulnerabilities
by host and click on generate. then save the file
Credential Scan
To carry out a credential scan, create a new policy (its the same as the
step above) but when you reach Credentials, you'll select SSH and under
authentication method, you'll choose password, then create a username
and password then continue the step. Save when done and you can carry
out your scan........
credential scan usually take more time because nessus will be able to
login into the system to carry out the scan. credential scan will also give
you more result than the non credential
the next one is the vulnerabilities, it start from the highest to the lowest
and it will tell you the name of the vulnerabily and the sypnosis will tell
you what the vulnerability is about. the description will tell you what an
attacker can do with the vulnerability. the next part is the solution where
it'll tell you what you can do to fix the vulnerability. the risk factor wi.
The CVSS Score tells you the impact of that vulnerability. The highest is
10. it means the damage will be high if an attacker is able to exploit the
vulnerability. The CVSS has 2 version which are CVSSv3.0
you can over on it and it will give you more information about it.
PASSWORD HACKING
active:
non-electronic:
- keyboard sniffing
- time consuming
Hashing is one way i.e if you want to make a doughnut, you'll have to
combine all the ingredients together to make the doughnut. now imagine
if you can extract the ingredients after you make the doughnut.
- copy the password hash keys and paste it in a text editor and save it.
there is a tool called hash identifier to help you identify the type of hash
algorithm it's used to create a password hash
md5 is a hash you can use to encrypt your password into hash
- copy the hash it generated and paste it on the hash identifier - it will
tell you the hash is MD5 hash in the possible hashes.
Kali hash is secured so if you copy a Kali hash and paste it in the hash
identifier, it will give you an error.
John has a lot of format you can use to crash passwords hash. you can
check it by sudo john --list=formats. We choose crypt because of the
hash algorithm we want to crack.
SERVER HACKING
ftp client - this is a software you can use to connect to ftp server so
we'll be using the tool filezilla. to install filezilla,
it's still the same step and the command will be sudo hydra -L
[/wordlist.file path] -P [/wordlist.filepath] -t 4 ssh://[target.ip]
any time you attack a ssh server, to connect to it, you'll use the
command ssh [username]@[target.ip] on the terminal and it will ask
for password.
after breaking into the server, steal the password hash and crack it.
you will get an error on this, so go to your wordlish and make a space
on the first line and add root to your wordlist username and password.
- you'll see a drop down beside the ip address, click on it and double
click on the database and it will bring out the database
- double click on dvwa database and it will show you the tables
under it
- select on the user tables (the attacker will be interest in the user
since that is where usernames are stored)
- click on table data and it will show you the usernames and password
hash
determine what type of hash the password it and generate a new one
yourself, then copy the hash of the password you generated and replace
it with the password hash of the target then save it. Now go back and
login with the your own password and viola - it logs in
2.Known Exploit
- carry out a version detection scan on the target - this will show you
the product number and product version
we are going to use this to check if there is exploit for those product
version and the version number
- use search command to search for exploit on the product name and
the version number as in search "vsftpd 2.3.4"
- you'll use this to select the exploit by use 0 (Note: 0 is the number
of the exploit)
you'll see some options set to No or Yes under required, the one's set to
No means they are not necesssary
- msfconsole
- show payloads
- show options
- exploit
We are going to ngrok. Ngrok is used for port forwarding. You can use it
to hack anyone anywhere.
- Start up your browser search for ngrok and create an account with
them and verify your email and then go on to download
- After downloading, unzip the file and follow the instructions of the
installation on the website. Note that under connect account, you will
add ./ at the beginning of the command and run it with sudo right and
without sudo right.
To start up ngrok;
Note: you can use any port number that is available on the system but
4444 is fine
For the virus you created to work, the system you intend to hack
must have a python interpreter installed on the system. So we are going
to couple it in a way that python will be automatically installed on the
system if python is not on it when the link is clicked.
the command above will convert the virus into digital certificate
- you'll notice that in the crypt_deliver folder, you'll find a file named
payload_delivery, right click on it and click on edit
- after it opens on notepad, you'll find a command "hello.py" on the
page at the beginner and replace it with the encrypted virus you created
[encrypted_virus_name.py] and save it
- after saving it, close it and rename the file with something else
maybe (data_bot)
Now, we are going to see where we'll be controlling the victims machine
after they have clicked on the virus, that is where we will start up listener
to start up listener
- open up a new terminal and type in the command sudo apt install
ufw
- Click on the one for github and follow the instructions to install it and
after installation, run it
- The next option, will be icon. Then go to your browser and search for
a png image related to your payload name and save it in the
EvilDroidNew folder under icon
- Now, go to your terminal and select the png image and wait for it to
build
you might get an error ([!] Failed to verify signed artifacts), if you do
get the error, run the following command
After you're done with the above process, now run EvilAndroidNew again
you might get an error ([!] Failed to align recompiled APK) again, to
fix this error, you'll go through the following process;
- start up your kali browser and search for "SDK build tool
download"
Now, go back and run EvilDroidNew, it'll bring done and some options
and continue the following process
Note: the android device and your kali must be on the same
network and on bridge for you to be able to gain access.
For NAT user, you can use Ngrok ip address and port number to
access it.
Note: if you don't have android device, you can download NoxPlayer on
windows and install it.
another terminal
Project - doubletrouble
WIFI HACKING
the next step now is to monitor wifi around, to do that. follow the process
below;
you'll see the BSSID column, that is where the MAC addresses are
the CH is the Channel column and the ESSID is the wifi/hotspot name
get the MAC address on the station and save it somewhere coz it
won't allow you to copy
Now, the next step is to perform a deauthentication attack to capture the
pre-shared key
the next step now is to crack the pre-shared key using crunch. and
crunch has a character set in the path /usr/share/crunch/charset.lst
we cannot save this file since the size is large, so what we are going to do
is tell crunch to use it immediately as it is generating it instead of saving
it. to do that;
- open a new terminal and login as root then type in the command
airbase -ng -e [wifi.name] -c [channel.no] [mon]
at this point, you cannot access the wifi yet so we are going to
configure it now
- open a new terminal and login as root then type in the command
ifconfig at0 up
after this, open the dhcp configuration file
- open a new terminal as root and type in the command ifconfig at0
[gateway.ip] netmask [subnetmask.ip]
- open a new terminal as root and type route add -net [network.ip]
netmask [subnetmask.ip] gw [gateway.ip]
the next step now is to install the dhcp server. the dhcp server is the one
that will give the victims ip address. to install; below
- open a new terminal and type in the command sudo apt-get install
isc-dhcp-server
after installation, the next step is to start up our dhcp server, to do that;
after, configuration, you will be able to connect to the network. the next
step is to give it internet connection
- next you cd into /etc/hostapd and copy the hostapd.conf file into the
path
- after opening the file, add the path to your hostapd configuration file
to the DEAMON_CONF=
- next step is open a new terminal and login as root and switch you
network card to monitor mode
- next, you'll run the command systemctl enable hostapd (if you
check your wifi, you'll see the name of your wifi)
- now, the next step is configure the wifi using the command ifconfig
[interface] [gw.ip] netmask [subnetmask.ip] - run is as root
- open a new terminal and login as root then type in the command
dhcpd -d -f -cf [/path to dhcpd config file] [interface] - this will start
up the dhcp server
- open a new terminal with root and run the command iptables -P
FORWARD ACCEPT
after this command, this will give the access point (fake wifi) internet
access
sslstrip
sss7
Man in the middle attack is when an attacker places himself in the middle
to intercept information. MITM attack is very dangerous.
ARP poisoning updates the ARP table with fake IP address and MAC
addresses.
Scroll through the file until you see LINUX and you'll see #redir line,
remove the hash before the redir line on the four of them and save it
next is to configure the dns server, you open etter.dns file again and
scroll to the last page and type in the command
After that, cd into /etc and open the hosts file and you'll fine the IP
address for localhost and kali - Add # in the front of the ipaddress of
localhost and kali and add your ip address to the next line and domain
name you want to spoof as in; 192.168.2.120 hiitplc.com
www.hiitplc.com *.hiitplc.com
the final configuration is to cd into /etc and open the file hostname and
delete kali then put the domain name you want to spoof there. (Note: you
can only put one domain name here)
-c is for mac address, the options you have is own/host or you can
set it to both
after this