How To Build A Pentesting Lab
How To Build A Pentesting Lab
Bruce Middleton
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
MATLAB is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does not warrant the accuracy of the text or exercises in this book. This books use or discussion of MATLAB software or related products does not
constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the
MATLAB software.
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
2014 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business
No claim to original U.S. Government works
Printed on acid-free paper
Version Date: 20140206
International Standard Book Number-13: 978-1-4822-0647-0 (Hardback)
This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made
to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all
materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all
material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not
been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any
future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in
any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.
copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-7508400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that
have been granted a photocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe.
Library of Congress CataloginginPublication Data
Middleton, Bruce, 1953Conducting network penetration and espionage in a global environment / Bruce Middleton.
pages cm
Includes index.
Summary: Penetration testing is used as a means to test the security of both private, government,
military and corporate computer networks. Suitable for both the novice and the experienced
professional, this book provides step-by-step procedures for using the mainly free commercially
available tools to perform these tests of computer networks. Covering basic and advanced tools
and procedures, the authors categorize tools according to their usage within the standard testing
framework and demonstrate how to perform an organized and efficient penetration test. Readers will
also learn techniques used to bypass anti-virus software and capture keystrokes of remote systems.
-- Provided by publisher.
ISBN 978-1-4822-0647-0 (hardback)
1. Computer networks--Security measures. 2. Penetration testing (Computer security) I. Title.
TK5105.59.M53 2014
005.8--dc23
2013047380
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
Contents
Preface.............................................................................................................xi
About the Author......................................................................................... xiii
Shodan....................................................................................................... 64
Using Google to Obtain Information.........................................................65
TheHarvester..............................................................................................72
Nslookup....................................................................................................73
Dig.............................................................................................................73
Dnsenum....................................................................................................74
Dnswalk.....................................................................................................75
Dnsrecon....................................................................................................75
Fierce..........................................................................................................76
Smtp-user-enum.........................................................................................76
Dnsmap......................................................................................................76
Dmitry....................................................................................................... 77
Itrace...........................................................................................................78
Tcptraceroute..............................................................................................78
Tctrace........................................................................................................78
Goorecon....................................................................................................78
v
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
viContents
Snmpenum.................................................................................................79
Snmpwalk...................................................................................................79
Snmpcheck.................................................................................................79
Target Discovery.........................................................................................81
Ping...................................................................................................81
#ping -c 2 <target>............................................................................81
#ping -c 3 -s 1000 IP.........................................................................82
Fping.................................................................................................82
Genlist...............................................................................................82
Hping................................................................................................83
Nbtscan.............................................................................................83
Nping................................................................................................83
Onesixtyone..................................................................................... 84
P0f.................................................................................................... 84
Xprobe2.............................................................................................85
Enumerating Target....................................................................................86
Some Miscellaneous Items to Keep in Mind (Refer to as Needed)..............87
Start Networks..................................................................................87
Create Videos.....................................................................................87
Whois xumpidhjns.it.cx.....................................................................89
Whois 95.141.28.91.......................................................................... 90
Whois nucebeb.changeip.name......................................................... 90
Whois 64.120.252.74........................................................................ 90
Netcraft.............................................................................................91
Host...................................................................................................95
DNS Tools (More).............................................................................95
Nslookup...........................................................................................96
5 Nmap.....................................................................................................97
Nmap -T0 -O -sTV -vv -p- -PN IP...........................................................106
Nmap -O -sSV -vv -p- -PN IP..................................................................108
Nmapscript http-enum,http-headers,http-methods,http-php-version
-p 80 IP.................................................................................................... 110
Nmap -A -vvv -p- -PN -iL IPlist.txt.......................................................... 110
Nmap -f -f -vvv -p- -PN IP....................................................................... 111
Nmap -sP -PA IP.0/24............................................................................... 111
Nmap -sS -sU -p U:53,T:22,134-139 IP....................................................112
Nmap -O -sUV -vvv -p- -PN IP...............................................................113
Nmap -O -sXV -vvv -p- -PN IP...............................................................113
Nmap -O -sNV -vvv -p- -PN IP...............................................................113
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
Contentsvii
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
viiiContents
The Burning.............................................................................................245
China....................................................................................................... 246
Syria..........................................................................................................248
SafeBack...................................................................................................331
New Technologies, Inc....................................................................331
GetTime...................................................................................................334
New Technologies, Inc....................................................................334
FileList and FileCnvt and Excel................................................................334
New Technologies, Inc....................................................................334
GetFree.....................................................................................................336
New Technologies, Inc....................................................................336
Swap Files and GetSwap...........................................................................336
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
Contentsix
xContents
NTFS GetFree..........................................................................................362
New Technologies, Inc....................................................................362
Example.................................................................................362
General Information...............................................................363
NTFS GetSlack........................................................................................363
New Technologies, Inc....................................................................363
Example.................................................................................363
General Information...............................................................363
NTFS VIEW........................................................................................... 364
New Technologies, Inc................................................................... 364
Example................................................................................ 364
NTFS Check........................................................................................... 364
New Technologies, Inc................................................................... 364
Example................................................................................ 364
NTIcopy...................................................................................................365
New Technologies, Inc....................................................................365
Disk Search 32......................................................................................... 366
New Technologies, Inc................................................................... 366
Example.................................................................................367
IP Scanner................................................................................................431
NetPro......................................................................................................452
WiFi Scanner............................................................................................475
iNet..........................................................................................................479
Net Detective........................................................................................... 484
Net Swiss Army Knife..............................................................................505
Ping Analyzer...........................................................................................532
WiFi Net Info...........................................................................................536
TraceRoute...............................................................................................538
PortScan.................................................................................................. 543
Net Utility................................................................................................ 551
zTools........................................................................................................554
Index............................................................................................................565
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
Preface
The past 40 years have seen a phenomenal growth in the area of data communications, to say the least. During the Vietnam War, one of my duty stations was on an
island in the China Sea. I was part of a signal intelligence group, intercepting and
decoding wartime communications traffic. We did our best to decode and analyze
the information we intercepted, but there were many times when we required the
help of a high-end (at that time) mainframe computer system. Did we have a communications network in place to just upload the data to the mainframe, let it do
the processing, and then download it back to us? Not a chance! We had to take the
large magnetic tapes, give them to the pilots on the SR-71 Blackbird, and fly them
to the United States for processing on the mainframe computer system. Once the
results were obtained, we would receive a telephone call informing us of any critical
information that was found. Its hard to believe now that 40 years ago thats the
way things were done.
Fast-forward to today. Now we have data networks in place that allow us to
transmit information to and from virtually any location on Earth (and even in outer
space to a degree) in a timely and efficient manner. But what did this tremendous
enhancement in communications technology bring us? Another place for criminal
activity to take place. Who are these criminals in cyberspace? You could start with
organized crime, such as the Mafia and others. What is their major focus here?
Financial activity, of course. They have found a new way to mismanage the financial resources (among other things) of others. We also have foreign espionage activities making good use of our enhanced communications systems. They routinely
break into government, military, and commercial computer networked systems and
steal trade secrets, new designs, new formulas, and so on. Even the data on your
home computer are not safe. If you bring your work home or handle your finances
on your computer system, both your personal data and your employers data could
easily be at risk. I could go on, but Im sure you get the picture.
Why is it like this? Why cant we make these communications systems fully
secure? Think about it. Banks and homes and businesses have been in existence as
far back as we can remember. Despite all the security precautions put in place for
banks, homes, aircraft, and businesses, we havent been able to fully secure them.
xi
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
xiiPreface
There are still bank robberies, aircraft hijackings, businesses, and homes being broken into. Almost nothing in the physical world is really secure. If someone wants
to focus on and target something, more than likely he or she will obtain what he or
she wants (if he or she has the time, patience, and other sufficient resources behind
him or her). We shouldnt expect it to be any different in cyberspace. Just like in the
physical world, where we have to be constantly alert and on guard against attacks
on our government, military, corporations, and homes, in cyberspace we have to
be even more alert. Why? Because now people can come into your homes, your
businesses, and your secured government and military bases without being physically seen. They can wreak havoc, change your formulas, change your designs, alter
your financial data, and obtain copies of documentsall without you ever knowing they were there.
Where does this bring us? This brings us to the fact that we need to keep doing
the same things we have been doing for many years in the realm of physical security. Do not let your guard down. But it also means that we must continue to
enhance our security in the cyber realm. Many excellent products (hardware and
software) have been developed to protect our data communications systems. These
products must be further enhanced. Numerous new and enhanced laws over the
past 35 years have provided law enforcement with more teeth to take a bite out of
cybercrime and cyber espionage. What is also needed are those who know how to
test the security of computer networks via an art termed penetration testing. Just
as we have tested the physical security of banks and other institutions for thousands
of years, we must test the security of our computer networks. That is what this book
is abouttesting the security of computer networkscoupled with discussions
pertaining to ongoing global cyber espionage via the same tools used for testing the
security of computer networks globally.
Bruce Middleton, CISSP, CEH, PMP, BSEET, MBA
University of Houston Alumni (Go Cougars!)
[email protected]
MATLAB and Simulink are registered trademarks of The MathWorks, Inc.
For product information, please contact:
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098 USA
Tel: 508 647 7000
Fax: 508-647-7001
E-mail: [email protected]
Web: www.mathworks.com
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
xiii
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
Chapter 9
Building a Penetration
Testing Lab
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
Click here to buy Conducting Network Penetration and Espionage in a Global Environment
We want a variety of operating systems, two firewalls, IPS/IDSs, one web server,
web applications, one database server, a web application firewall, workstations
(two Windows, Linux), servers (one Windows, one Linux, one FreeBSD), one
domain controller (Windows 2008), one FTP server (Ubuntu), one wireless
router, one radius server, two laptops with WiFi, a debugger, one website, and
one Web 2.0 application.
Server/victim workstations = VMware Workstation 8.0.
Hardware platform must have at least 4 GB RAM and be at least
dual core.
Server operating systems:
MSW 2008 server
MSW 2003 server
Ubuntu 12.04 LTS = Linux Server OS
Workstations
MSW XP Pro
MSW 7 Pro
Router
ASUS WL-520gc = LAN/W LAN router
Laptop will be the attacker.
Samsung Galaxy Tab will be our WiFi target.
The web server, FTP server, and web app will all be free downloads.
Vulnerable web applications you can install:
DVWA
OWASP Broken Web Applications Project.
NOWASP Web Pen-Test Practice Application.
Our host workstation (target) can hold the following VMs using VMware
Workstation 8.0:
FTP server (Ubuntu Server 12)
Domain controller (MSW Server 2008) -.iso installer disk image
Win 7 Pro -.iso installer disk image
Win XP Pro -.iso installer disk image
Online hacking labs:
https://www.hacking-lab.com
http://try2hack.nl
http://www.HackThisSite.org
http://www.DareYourMind.net
http://hax.tor.hu
Click here to buy Conducting Network Penetration and Espionage in a Global Environment