Statistics
13
Views
0
Downloads
0
Donations
Uploader

高宏飞

Shared on 2025-12-21
Support
Share

AuthorRichard Bejtlich

Network security is not simply about building impenetrable walls—determined attackers will eventually overcome traditional defenses. The most effective computer security strategies integrate network security monitoring (NSM): the collection and analysis of data to help you detect and respond to intrusions. In The Practice of Network Security Monitoring, Mandiant CSO Richard Bejtlich shows you how to use NSM to add a robust layer of protection around your networks—no prior experience required. To help you avoid costly and inflexible solutions, he teaches you how to deploy, build, and run an NSM operation using open source software and vendor-neutral tools. You'll learn how to: • Determine where to deploy NSM platforms, and size them for the monitored networks • Deploy stand-alone or distributed NSM installations • Use command line and graphical packet analysis tools, and NSM consoles • Interpret network evidence from server-side and client-side intrusions • Integrate threat intelligence into NSM software to identify sophisticated adversaries There’s no foolproof way to keep attackers out of your network. But when they get in, you’ll be prepared. The Practice of Network Security Monitoring will show you how to build a security net to detect, contain, and control them. Attacks are inevitable, but losing sensitive data shouldn't be.

Tags
network security
ISBN: 1593275099
Publisher: No Starch Press
Publish Year: 2013
Language: 英文
Pages: 376
File Format: PDF
File Size: 17.4 MB
Support Statistics
¥.00 · 0times
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

R I C H A R D B E J T L I C H T H E P R A C T I C E O F N E T W O R K S E C U R I T Y M O N I T O R I N G U N D E R S T A N D I N G I N C I D E N T D E T E C T I O N A N D R E S P O N S E “An invaluable resource for anyone detecting and responding to security breaches.” —Kevin Mandia, Mandiant CEO SHELVE IN: COM PUTERS/SECURITY $49.95 ($52.95 CDN) E S C A L A T E A N A L Y Z E C O L L E C T “ I L I E F LAT .” Th is book uses RepKover — a durab le b ind ing that won’t snap shut. www.nostarch.com TH E F I N EST I N G E E K E NTE RTA I N M E NT ™ Foreword by Todd Heberlein, Developer of the Network Security Monitor System Network security is not simply about building impene- trable walls — determined attackers will eventually over- come traditional defenses. The most effective computer security strategies integrate network security monitoring • Interpret network evidence from server-side and client-side intrusions There’s no foolproof way to keep attackers out of • Integrate threat intelligence into NSM software to identify sophisticated adversaries your network. But when they get in, you’ll be prepared. The Practice of Network Security Monitoring will show you how to build a security net to detect, contain, and control them. Attacks are inevitable, but losing sensitive detect and respond to intrusions. Mandiant CSO Richard Bejtlich shows you how to In The Practice of Network Security Monitoring, use NSM to add a robust layer of protection around you avoid costly and inflexible solutions, he teaches you your networks — no prior experience required. To help You’ll learn how to: size them for the monitored networks • Determine where to deploy NSM platforms, and • Deploy stand-alone or distributed NSM installations how to deploy, build, and run an NSM operation using open source software and vendor-neutral tools. • Use command line and graphical packet analysis tools and NSM consoles (NSM): the collection and analysis of data to help you data shouldn’t be. General Electric. He is a graduate of Harvard University A B O U T T H E A U T H O R Richard Bejtlich is Chief Security Officer at Mandiant and was previously Director of Incident Response for and the United States Air Force Academy. His previous works include The Tao of Network Security Monitoring, Extrusion Detection, and Real Digital Forensics. He writes on his blog (http://taosecurity.blogspot.com) and on Twitter as @taosecurity. B E JT L IC H N E T W O R K S E C U R IT Y M O N IT O R IN G N E T W O R K S E C U R IT Y M O N IT O R IN G T H E P R A C T IC E O F T H E P R A C T IC E O F
(This page has no text content)
The PracTice of NeTwork SecuriTy MoNiToriNg
(This page has no text content)
T h e P r a c T i c e o f N e T w o r k S e c u r i T y M o N i T o r i N g u n d e r s t a n d i n g i n c i d e n t D e t e c t i o n a n d r e s p o n s e by Richard Bej t l ich San Francisco
The PracTice of NeTwork SecuriTy MoNiToriNg. Copyright © 2013 by Richard Bejtlich. All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. Printed in USA First printing 17 16 15 14 13 1 2 3 4 5 6 7 8 9 ISBN-10: 1-59327-509-9 ISBN-13: 978-1-59327-509-9 Publisher: William Pollock Production Editor: Serena Yang Cover Ilustration: Tina Salameh Developmental Editor: William Pollock Technical Reviewers: David Bianco, Doug Burks, and Brad Shoop Copyeditors: Marilyn Smith and Julianne Jigour Compositor: Susan Glinert Stevens Proofreader: Ward Webber For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly: No Starch Press, Inc. 38 Ringold Street, San Francisco, CA 94103 phone: 415.863.9900; fax: 415.863.9950; info@nostarch.com; www.nostarch.com Library of Congress Cataloging-in-Publication Data Bejtlich, Richard. The practice of network security monitoring : understanding incident detection and response / by Richard Bejtlich. pages cm Includes index. ISBN-13: 978-1-59327-509-9 ISBN-10: 1-59327-509-9 1. Computer networks--Security measures. 2. Electronic countermeasures. I. Title. TK5105.59.B436 2013 004.6--dc23 2013017966 No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it.
This book is for my youngest daughter, Vivian. Now you have a book, too, sweetie!
(This page has no text content)
B r i e f c o N T e N T S About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xvii Foreword by Todd Heberlein . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxv PaRt I: GettInG StaRted Chapter 1: Network Security Monitoring Rationale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Chapter 2: Collecting Network Traffic: Access, Storage, and Management . . . . . . . . . . . . . 33 PaRt II: SecuRIty OnIOn dePlOyment Chapter 3: Stand-alone NSM Deployment and Installation . . . . . . . . . . . . . . . . . . . . . . . . 55 Chapter 4: Distributed Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Chapter 5: SO Platform Housekeeping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 PaRt III: tOOlS Chapter 6: Command Line Packet Analysis Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Chapter 7: Graphical Packet Analysis Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Chapter 8: NSM Consoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 PaRt IV: nSm In actIOn Chapter 9: NSM Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Chapter 10: Server-side Compromise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Chapter 11: Client-side Compromise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Chapter 12: Extending SO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Chapter 13: Proxies and Checksums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 Appendix: SO Scripts and Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
(This page has no text content)
c o N T e N T S i N D e T a i l abouT The auThor xvii foreword by Todd heberlein xix Preface xxv Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxvi Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii A Note on Software and Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviii Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxix ParT i geTTiNg STarTed 1 NeTwork SecuriTy MoNiToriNg raTioNale 3 An Introduction to NSM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Does NSM Prevent Intrusions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 What Is the Difference Between NSM and Continuous Monitoring? . . . . . . . . . . 8 How Does NSM Compare with Other Approaches? . . . . . . . . . . . . . . . . . . . . 9 Why Does NSM Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 How NSM Is Set Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 When NSM Won’t Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Is NSM Legal? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 How Can You Protect User Privacy During NSM Operations? . . . . . . . . . . . . . 14 A Sample NSM Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 The Range of NSM Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Full Content Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Extracted Content Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Session Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Transaction Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Statistical Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Alert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 What’s the Point of All This Data? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 NSM Drawbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Where Can I Buy NSM? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Where Can I Go for Support or More Information? . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
x Contents in Detail 2 collecTiNg NeTwork Traffic: acceSS, STorage, aNd MaNageMeNT 33 A Sample Network for a Pilot NSM System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Traffic Flow in a Simple Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Possible Locations for NSM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 IP Addresses and Network Address Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Net Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 IP Address Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Address Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Choosing the Best Place to Obtain Network Visibility . . . . . . . . . . . . . . . . . . . . . . . . . 45 Location for DMZ Network Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Locations for Viewing the Wireless and Internal Network Traffic . . . . . . . . . . . 45 Getting Physical Access to the Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Using Switches for Traffic Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Using a Network Tap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Capturing Traffic Directly on a Client or Server . . . . . . . . . . . . . . . . . . . . . . . 49 Choosing an NSM Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Ten NSM Platform Management Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 ParT ii SecuriTy oNioN dePloyMeNT 3 STaNd-aloNe NSM dePloyMeNT aNd iNSTallaTioN 55 Stand-alone or Server Plus Sensors? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Choosing How to Get SO Code onto Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Installing a Stand-alone System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Installing SO to a Hard Drive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Configuring SO Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Choosing the Management Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Installing the NSM Software Components . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Checking Your Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 4 diSTribuTed dePloyMeNT 75 Installing an SO Server Using the SO .iso Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 SO Server Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Building Your SO Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Configuring Your SO Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Installing an SO Sensor Using the SO .iso Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Configuring the SO Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Completing Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Verifying that the Sensors Are Working . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Verifying that the Autossh Tunnel Is Working . . . . . . . . . . . . . . . . . . . . . . . . 84
Contents in Detail xi Building an SO Server Using PPAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Installing Ubuntu Server as the SO Server Operating System . . . . . . . . . . . . . 85 Choosing a Static IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Updating the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Beginning MySQL and PPA Setup on the SO Server . . . . . . . . . . . . . . . . . . . 89 Configuring Your SO Server via PPA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Building an SO Sensor Using PPAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Installing Ubuntu Server as the SO Sensor Operating System . . . . . . . . . . . . . 92 Configuring the System as a Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Running the Setup Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 5 So PlaTforM houSekeePiNg 99 Keeping SO Up-to-Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Updating via the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Updating via the Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Limiting Access to SO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Connecting via a SOCKS Proxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Changing the Firewall Policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Managing SO Data Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Managing Sensor Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Checking Database Drive Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Managing the Sguil Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Tracking Disk Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 ParT iii ToolS 6 coMMaNd liNe PackeT aNalySiS ToolS 113 SO Tool Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 SO Data Presentation Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 SO Data Collection Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SO Data Delivery Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Running Tcpdump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Displaying, Writing, and Reading Traffic with Tcpdump . . . . . . . . . . . . . . . . 117 Using Filters with Tcpdump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Extracting Details from Tcpdump Output . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Examining Full Content Data with Tcpdump . . . . . . . . . . . . . . . . . . . . . . . . 122 Using Dumpcap and Tshark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Running Tshark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Running Dumpcap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Running Tshark on Dumpcap’s Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Using Display Filters with Tshark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Tshark Display Filters in Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
xii Contents in Detail Running Argus and the Ra Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Stopping and Starting Argus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 The Argus File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Examining Argus Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 7 graPhical PackeT aNalySiS ToolS 135 Using Wireshark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Running Wireshark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Viewing a Packet Capture in Wireshark . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Modifying the Default Wireshark Layout . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Some Useful Wireshark Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Using Xplico . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Running Xplico . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Creating Xplico Cases and Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Processing Network Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Understanding the Decoded Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Getting Metadata and Summarizing Traffic . . . . . . . . . . . . . . . . . . . . . . . . 153 Examining Content with NetworkMiner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Running NetworkMiner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Collecting and Organizing Traffic Details . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Rendering Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 8 NSM coNSoleS 159 An NSM-centric Look at Network Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Using Sguil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Running Sguil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Sguil’s Six Key Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Using Squert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Using Snorby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Using ELSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 ParT iv NSM iN acTioN 9 NSM oPeraTioNS 185 The Enterprise Security Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 The Planning Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 The Resistance Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 The Detection and Response Phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Contents in Detail xiii Collection, Analysis, Escalation, and Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Escalation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Remediation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Using NSM to Improve Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Building a CIRT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 10 Server-Side coMProMiSe 207 Server-side Compromise Defined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Server-side Compromise in Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Starting with Sguil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Querying Sguil for Session Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Returning to Alert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 Reviewing Full Content Data with Tshark . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Understanding the Backdoor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 What Did the Intruder Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 What Else Did the Intruder Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Exploring the Session Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Searching Bro DNS Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Searching Bro SSH Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Searching Bro FTP Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Decoding the Theft of Sensitive Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 Extracting the Stolen Archive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Stepping Back . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Summarizing Stage 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Summarizing Stage 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 11 clieNT-Side coMProMiSe 235 Client-side Compromise Defined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 Client-side Compromise in Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Getting the Incident Report from a User . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Starting Analysis with ELSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Looking for Missing Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Analyzing the Bro dns .log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 Checking Destination Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 Examining the Command-and-Control Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Initial Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Improving the Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 Summarizing Stage 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Pivoting to a Second Victim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Installing a Covert Tunnel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
xiv Contents in Detail Enumerating the Victim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Summarizing Stage 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 12 exTeNdiNg So 263 Using Bro to Track Executables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Hashing Downloaded Executables with Bro . . . . . . . . . . . . . . . . . . . . . . . . 264 Submitting a Hash to VirusTotal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Using Bro to Extract Binaries from Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Configuring Bro to Extract Binaries from Traffic . . . . . . . . . . . . . . . . . . . . . . 266 Collecting Traffic to Test Bro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Testing Bro to Extract Binaries from HTTP Traffic . . . . . . . . . . . . . . . . . . . . . 269 Examining the Binary Extracted from HTTP . . . . . . . . . . . . . . . . . . . . . . . . . 270 Testing Bro to Extract Binaries from FTP Traffic . . . . . . . . . . . . . . . . . . . . . . 272 Examining the Binary Extracted from FTP . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Submitting a Hash and Binary to VirusTotal . . . . . . . . . . . . . . . . . . . . . . . . 273 Restarting Bro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 Using APT1 Intelligence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Using the APT1 Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Installing the APT1 Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 Generating Traffic to Test the APT1 Module . . . . . . . . . . . . . . . . . . . . . . . . 280 Testing the APT1 Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 Reporting Downloads of Malicious Binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Using the Team Cymru Malware Hash Registry . . . . . . . . . . . . . . . . . . . . . . 283 The MHR and SO: Active by Default . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 The MHR and SO vs . a Malicious Download . . . . . . . . . . . . . . . . . . . . . . . 286 Identifying the Binary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 13 ProxieS aNd checkSuMS 289 Proxies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 Proxies and Visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Dealing with Proxies in Production Networks . . . . . . . . . . . . . . . . . . . . . . . 294 Checksums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 A Good Checksum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 A Bad Checksum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 Identifying Bad and Good Checksums with Tshark . . . . . . . . . . . . . . . . . . . 296 How Bad Checksums Happen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Bro and Bad Checksums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Setting Bro to Ignore Bad Checksums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 coNcluSioN 303 Cloud Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 Cloud Computing Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 Cloud Computing Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Contents in Detail xv Workflow, Metrics, and Collaboration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Workflow and Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Collaboration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 aPPeNdix So ScriPTS aNd coNfiguraTioN 311 SO Control Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 /usr/sbin/nsm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 /usr/sbin/nsm_all_del . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 /usr/sbin/nsm_all_del_quick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 /usr/sbin/nsm_sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 /usr/sbin/nsm_sensor_add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 /usr/sbin/nsm_sensor_backup-config . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 /usr/sbin/nsm_sensor_backup-data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 /usr/sbin/nsm_sensor_clean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 /usr/sbin/nsm_sensor_clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 /usr/sbin/nsm_sensor_del . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 /usr/sbin/nsm_sensor_edit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 /usr/sbin/nsm_sensor_ps-daily-restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 /usr/sbin/nsm_sensor_ps-restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 /usr/sbin/nsm_sensor_ps-start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 /usr/sbin/nsm_sensor_ps-status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 /usr/sbin/nsm_sensor_ps-stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 /usr/sbin/nsm_server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 /usr/sbin/nsm_server_add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 /usr/sbin/nsm_server_backup-config . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 /usr/sbin/nsm_server_backup-data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 /usr/sbin/nsm_server_clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 /usr/sbin/nsm_server_del . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 /usr/sbin/nsm_server_edit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 /usr/sbin/nsm_server_ps-restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 /usr/sbin/nsm_server_ps-start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 /usr/sbin/nsm_server_ps-status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 /usr/sbin/nsm_server_ps-stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 /usr/sbin/nsm_server_sensor-add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 /usr/sbin/nsm_server_sensor-del . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 /usr/sbin/nsm_server_user-add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 SO Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 /etc/nsm/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 /etc/nsm/administration .conf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 /etc/nsm/ossec/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 /etc/nsm/pulledpork/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 /etc/nsm/rules/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 /etc/nsm/securityonion/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 /etc/nsm/securityonion .conf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 /etc/nsm/sensortab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 /etc/nsm/servertab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 /etc/nsm/templates/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 /etc/nsm/$HOSTNAME-$INTERFACE/ . . . . . . . . . . . . . . . . . . . . . . . . . . 326 /etc/cron .d/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
xvi Contents in Detail Bro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 CapMe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 ELSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Squert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Snorby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Syslog-ng . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 /etc/network/interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Updating SO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 Updating the SO Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 Updating MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 iNdex 335
about the author Richard Bejtlich is Chief Security Officer at Mandiant. He was previously Director of Incident Response for General Electric, where he built and led the 40-member GE Computer Incident Response Team (GE-CIRT). Prior to GE, he operated TaoSecurity LLC as an independent consultant, protected national security interests for ManTech Corporation’s Computer Forensics and Intrusion Analysis division, investigated intrusions as part of Foundstone’s incident response team, and monitored client networks for Ball Corporation. Richard began his digital security career as a military intelligence officer in 1997 at the Air Force Computer Emergency Response Team (AFCERT), Air Force Information Warfare Center (AFIWC), and Air Intelligence Agency (AIA). He is a graduate of Harvard University and the United States Air Force Academy. He is the author of The Tao of Network Security Monitoring and Extrusion Detection and co-author of Real Digital Forensics. He blogs (http://taosecurity.blogspot.com/), tweets (@taosecurity), and teaches for Black Hat.
(This page has no text content)
The above is a preview of the first 20 pages. Register to read the complete e-book.