Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

anti hacker tool kit , 4th edition
Nội dung xem thử
Mô tả chi tiết
www.it-ebooks.info
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
Blind Folio i
ANTI-HACKER TOOL KIT
Fourth Edition
ANTI-HACKER TOOL KIT
Fourth Edition
00-FM.indd 1 17/12/13 12:47 PM
www.it-ebooks.info
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
Blind Folio ii
About the Author
Mike Shema is the co-author of several books on information security, including the
Anti-Hacker Tool Kit and Hacking Exposed: Web Applications, and is the author of Hacking
Web Applications. Mike is Director of Engineering for Qualys, where he writes software
to automate security testing for web sites. He has taught hacking classes and continues
to present research at security conferences around the world. Check out his blog at
http://deadliestwebattacks.com.
About the Technical Editors
Eric Heitzman is an experienced security consultant (Foundstone, McAfee, Mandiant)
and static analysis and application security expert (Ounce Labs, IBM). Presently, Eric
is working as a Technical Account Manager at Qualys, supporting customers in their
evaluation, deployment, and use of network vulnerability management, policy
compliance, and web application scanning software.
Robert Eickwort, CISSP, is the ISO of an agency within a major municipal
government, where he has worked for fifteen years in IT administration and
information security. The challenges of meeting wide-ranging regulatory and
contractual security requirements within the limited resources, legacy systems, and
slow-changing culture of local government have brought him a special appreciation
of DIY tactics and open-source tools. His responsibilities range from security systems
operation to vulnerability and risk assessment to digital forensics and incident
response. Rob holds a B.A. in History from the University of Colorado at Boulder
and an M.A. in History from the University of Kansas.
00-FM.indd 2 17/12/13 12:47 PM
www.it-ebooks.info
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
Blind Folio iii
ANTI-HACKER TOOL KIT
Fourth Edition
ANTI-HACKER TOOL KIT
Fourth Edition
Mike Shema
New York Chicago San Francisco
Athens London Madrid
Mexico City Milan New Delhi
Singapore Sydney Toronto
00-FM.indd 3 17/12/13 12:47 PM
www.it-ebooks.info
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / eBook_cr_pg
eBook_014-X CR_pg.indd 1 17/12/13 2:38 PM
Copyright © 2014 by McGraw-Hill Education (Publisher). All rights reserved. Printed in the United States of America. Except
as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any
means, or stored in a database or retrieval system, without the prior written permission of Publisher, with the exception that the
program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication.
ISBN: 978-0-07-180015-0
MHID: 0-07-180015-8
e-Book conversion by Cenveo® Publisher Services
Version 1.0
The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-180014-3,
MHID: 0-07-180014-X.
McGraw-Hill Education eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use
in corporate training programs. To contact a representative, please visit the Contact Us pages at www.mhprofessional.com.
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a
trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of
infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.
Information has been obtained by McGraw-Hill Education from sources believed to be reliable. However, because of the
possibility of human or mechanical error by our sources, McGraw-Hill Education, or others, McGraw-Hill Education does not
guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the
results obtained from the use of such information.
TERMS OF USE
This is a copyrighted work and McGraw-Hill Education (“McGraw Hill”) and its licensors reserve all rights in and to the work.
Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve
one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based
upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior
consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited.
Your right to use the work may be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR
WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED
FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA
HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your
requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you
or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom.
McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall
McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that
result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This
limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or
otherwise.
www.it-ebooks.info
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
Blind Folio v
For the Menagerie:
Fins, claws, teef, and all.
00-FM.indd 5 17/12/13 12:47 PM
www.it-ebooks.info
This page has been intentionally left blank
www.it-ebooks.info
vii
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
At a Glance
●– Part I The Best of the Basics ●–
1 Managing Source Code and Working
with Programming Languages. . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Command-Line Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3 Virtual Machines and Emulators. . . . . . . . . . . . . . . . . . . . . . . . . . 83
●– Part II Systems ●–
4 Vulnerability Scanning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5 File System Monitoring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6 Windows Auditing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
●– Part III Networks ●–
7 Netcat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
8 Port Forwarding and Redirection. . . . . . . . . . . . . . . . . . . . . . . . . 249
9 Network Reconnaissance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
10 Network Sniffers and Injectors. . . . . . . . . . . . . . . . . . . . . . . . . . . 315
11 Network Defenses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
12 War Dialers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
00-FM.indd 7 17/12/13 12:47 PM
www.it-ebooks.info
viii Anti-Hacker Tool Kit
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
●– Part IV Applications ●–
13 Binary Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
14 Web Application Hacking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
15 Password Cracking and Brute-Force Tools. . . . . . . . . . . . . . . . . 497
●– Part V Forensics ●–
16 Basic Forensics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
17 Privacy Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
00-FM.indd 8 17/12/13 12:47 PM
www.it-ebooks.info
ix
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
Contents
Acknowledgments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
●– Part I The Best of the Basics ●–
1 Managing Source Code and Working with Programming Languages . . . . . . . . . . . . . 3
SCM Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Git. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Working with Repositories. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Working with Subversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Mercurial. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Subversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Creating a Repository. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Working with Repositories. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Working with Revisions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Eclipse Integrated Developer Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Working with Source Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Programming Languages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Common Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
C++. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Java. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
JavaScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Perl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Python. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Ruby. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
00-FM.indd 9 17/12/13 12:47 PM
www.it-ebooks.info
x Anti-Hacker Tool Kit
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
2 Command-Line Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Unix Command Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Pipes and Redirection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Command Cornucopia. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
BackTrack Linux. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
MacPorts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Installing and Managing Ports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Tweaking the Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Cygwin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Download and Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
The X Window System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Choosing a Window Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
A Client/Server Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
How Remote X Servers and Clients Communicate. . . . . . . . . . . . . . . . 69
Securing X Hosts with Xhost and Xauth. . . . . . . . . . . . . . . . . . . . . . . . . 69
Securing X Communications with Secure Shell. . . . . . . . . . . . . . . . . . . 72
Other X Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Now You Know… . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Windows PowerShell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Verb Your Nouns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Scripting and Signing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
3 Virtual Machines and Emulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Benefits of Virtualization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Oracle VirtualBox. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Installing Guest Additions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Remote Access. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
VMware Player. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Download and Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Virtual PC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Parallels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Installing Parallels Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Open Source Alternatives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Bochs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
QEMU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
KVM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Qubes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Vice. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Wine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Xen Hypervisor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
00-FM.indd 10 17/12/13 12:47 PM
www.it-ebooks.info
Contents xi
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
●– Part II Systems ●–
4 Vulnerability Scanning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Overview of Vulnerability Scanning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Open Port/Service Identification. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Banner/Version Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Traffic Probe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Vulnerability Probe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Vulnerability Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
OpenVAS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Working with Vulnerability Standards. . . . . . . . . . . . . . . . . . . . . . . . . . 138
OpenVAS Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Metasploit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Hunting for Vulns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Compromising a System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
More Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
5 File System Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
File System Metadata. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Windows File Metadata. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
File Integrity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
AIDE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Samhain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Tripwire. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Securing Your Files with Tripwire. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
6 Windows Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Evolution of Windows Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Nbtstat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Retrieving a MAC Address. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Cain & Able. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Microsoft Baseline Security Analyzer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Using the MBSA Command-Line Interface. . . . . . . . . . . . . . . . . . . . . . 192
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
PsTools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
00-FM.indd 11 17/12/13 12:47 PM
www.it-ebooks.info
xii Anti-Hacker Tool Kit
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
●– Part III Networks ●–
7 Netcat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Network Communication Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Netcat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Netcat’s 101 Uses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Cryptcat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Ncat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Compile for Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Socat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
8 Port Forwarding and Redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Understanding Port and Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Secure Shell (SSH). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Datapipe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
FPipe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
WinRelay. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
9 Network Reconnaissance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Nmap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Nmap Scripting Engine (NSE). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
THC-Amap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
System Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Whois. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Host, Dig, and Nslookup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Traceroute. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
10 Network Sniffers and Injectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Sniffers Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Tcpdump and WinDump. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Wireshark. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Ettercap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Potential for Disaster. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
00-FM.indd 12 17/12/13 12:47 PM
www.it-ebooks.info
Contents xiii
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
Hping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Wireless Networks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Kismet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Expanding Kismet’s Capabilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Aircrack-ng. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
11 Network Defenses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Firewalls and Packet Filters: The Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
What Is a Firewall?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Packet Filter vs. Firewall. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
How a Firewall Protects a Network. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Packet Characteristics to Filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Stateless vs. Stateful Firewalls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Network Address Translation (NAT) and Port Forwarding. . . . . . . . 378
The Basics of Virtual Private Networks. . . . . . . . . . . . . . . . . . . . . . . . . 381
Inside the Demilitarized Zones. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Linux System Firewall. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
OS X System Firewall. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Windows System Firewall. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Snort: An Intrusion-Detection System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Installation and Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Snort Plug-ins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
So Much More…. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
12 War Dialers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
ToneLoc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
Implementation: Creating the tl.cfg File. . . . . . . . . . . . . . . . . . . . . . . . . 403
Implementation: Running a Scan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Implementation: Navigating the ToneLoc Interface. . . . . . . . . . . . . . . 409
.dat File Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
THC-Scan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Implementation: Configuring THC-Scan. . . . . . . . . . . . . . . . . . . . . . . . 414
Implementation: Running THC-Scan. . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Implementation: Navigating THC-Scan. . . . . . . . . . . . . . . . . . . . . . . . . 417
Implementation: Manipulating THC-Scan .dat Files. . . . . . . . . . . . . . 419
WarVOX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Inter-Asterisk Exchange. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Beyond the CONNECT String. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
00-FM.indd 13 17/12/13 12:47 PM
www.it-ebooks.info
xiv Anti-Hacker Tool Kit
AHTK_2013 / Anti-Hacker Tool Kit / Mike Shema / 7180014-X / Front Matter
●– Part IV Applications ●–
13 Binary Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
The Anatomy of a Computer Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Determining a Binary File Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Identifying Binary Obfuscation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Black Box Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Creating a Sandboxed System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Finding Text Clues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Conducting Unix-based Run-time Analysis with lsof. . . . . . . . . . . . . 438
Using a Sniffer to Examine Network Traffic. . . . . . . . . . . . . . . . . . . . . . 438
Identifying Unix-based System Calls. . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Obtaining Memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
Generating Assembly Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Analyzing Run-time Binaries with Debuggers. . . . . . . . . . . . . . . . . . . . . . . . . 445
Debugging Tools for Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
OllyDbg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Interactive Disassembler (IDA). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
GNU Debugger (GDB). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
14 Web Application Hacking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Scanning for Web Vulnerabilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Nikto. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
HTTP Utilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Curl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
OpenSSL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Stunnel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
Application Inspection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Zed Attack Proxy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Sqlmap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
15 Password Cracking and Brute-Force Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
We’re Doomed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Alternate Deployment Schemes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Password OpSec. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
John the Ripper. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
L0phtcrack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Hashcat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
Grabbing Windows Password Hashes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
Pwdump. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
Active Brute-Force Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
THC-Hydra. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
00-FM.indd 14 17/12/13 12:47 PM
www.it-ebooks.info