Home > Store

Counter Hack: A Step-by-Step Guide to Computer Attacks and Effective Defenses

Register your product to gain access to bonus material or receive a coupon.

Counter Hack: A Step-by-Step Guide to Computer Attacks and Effective Defenses

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2002
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-033273-9
  • ISBN-13: 978-0-13-033273-8

The Next Generation Hacker Book

The step-by-step guide to defending against hacker intrusions!

  • Defend against today's most powerful hacker attacks!
  • Hands-on, step-by-step techniques for UNIX/Linux and Windows environments
  • Intrusion detection: New evasion techniques—and countermeasures
  • By the security expert who demonstrated hacking to the U.S. Senate!

This easy-to-use, step-by-step guide will empower network and system administrators to defend their information and computing assets—whether or not they have security experience. In Counter Hack, leading network security expert Edward Skoudis presents comprehensive, insider's explanations of today's most destructive hacker tools and tactics-and specific, proven countermeasures for both UNIX and Windows environments. Skoudis covers all this and more:

  • Know your adversary: from script kiddies to elite attackers
  • A hacker's view of networks, TCP/IP protocols, and their vulnerabilities
  • Five phases of hacking: reconnaissance, scanning, gaining access, maintaining access, and preventing detection
  • The most dangerous and widespread attack scenarios—explained in depth
  • Key hacker tools: port scanners, firewall scanners, sniffers, session hijackers, RootKits, and more
  • How hackers build elegant attacks from simple building blocks
  • Detecting and preventing IP spoofing, covert channels, denial of service attacks, and other key attacks
  • How hackers cover their tracks—and how you can uncover their handiwork
  • A preview of tomorrow's hacker tools, attacks, and countermeasures

Whatever your role in protecting network infrastructure and data, Counter Hack delivers proven solutions you can implement right now—and long-term strategies that will improve security for years to come.

Sample Content

Downloadable Sample Chapter

Untitled Document Download the Sample Chapter related to this title.

Table of Contents



Preface.


Acknowledgments.


1. Introduction.

The Computer World and the Golden Age of Hacking. Why This Book? Why Cover These Specific Tools and Techniques? How This Book Differs. The Threat: Never Underestimate Your Adversary. Attacker Skill Levels From Script Kiddies to the Elite. A Note on Terminology and Iconography. Hackers, Crackers, and Hats of Many Colors: Let's Just Use “Attackers”. Pictures and Scenarios. Naming Names. Caveat: These Tools Could Hurt You. Setting Up a Lab for Experimentation. Additional Concerns. Organization of the Rest of This Book. Getting up to Speed with the Technology. Common Phases of the Attack. Future Predictions, Conclusions, and References.



2. Networking Overview: Pretty Much Everything You Need to Know about TCP/IP to Follow the Rest of This Book, in 55 Pages or Less.

The OSI Reference Model and Protocol Layering. So How Does TCP/IP Fit In? Understanding TCP/IP. The Transmission Control Protocol (TCP). TCP Port Numbers. TCP Control Bits, the Three-Way Handshake, and Sequence Numbers. Other Fields in the TCP Header. The User Datagram Protocol (UDP). Is UDP Less Secure Than TCP? The Internet Protocol (IP) and the Internet Control Message Protocol (ICMP). IP: Drop That Acronym and Put Your Hands in the Air! Local Area Networks and Routers. IP Addresses. Netmasks. Packet Fragmentation in IP. Other Components of the IP Header. Security or (Lack Thereof) in Traditional IP. ICMP. Other Network-Level Issues. Routing Packets. Network Address Translation. Firewalls: Network Traffic Cops and Soccer Goalies. Getting Personal with Firewalls. Don't Forget about the Data Link and Physical Layers! Ethernet, the King of Connectivity. ARP ARP ARP! Hubs and Switches. Security Solutions for Networks. Application-Layer Security. The Secure Socket Layer (SSL). Security at the IP Level: IPSec. Conclusions.



3. UNIX Overview: Pretty Much Everything You Need to Know about UNIX to Follow the Rest of This Book, in 30 Pages or Less.

Introduction. Learning about UNIX. Architecture. UNIX File System Structure. The Kernel and Processes. Automatically Starting up Processes: Init, Inetd, and Cron. Manually Starting Processes. Interacting with Processes. Accounts and Groups. The /etc/passwd File. The /etc/group File. Root: It's a Bird: It' a Plane: No, it's Super-User! Privilege Control: UNIX Permissions. SetUID Programs. UNIX Trust. Logs and Auditing. Common UNIX Network Services. Telnet: Command-Line Remote Access. FTP: The File Transfer Protocol. TFTP: The Trivial File Transfer Protocol. Web Servers: HTTP. Electronic Mail. r-Commands. Domain Name Services. The Network File System (NFS). X Window System. Conclusion.



4. Windows NT/2000 Overview: Pretty Much Everything You Need to Know about Windows to Follow the Rest of This Book, in 40 Pages or Less.

Introduction. A Brief History of Time. Fundamental NT Concepts. Domains: Grouping Machines Together. Shares: Accessing Resources across the Network. Service Packs and Hot Fixes. Architecture. User Mode. How Windows NT Password Representations Are Derived. Kernel Mode. Accounts and Groups. Accounts. Groups. Privilege Control. Policies. Account Policy. User Properties Settings. Trust. Auditing. Object Access Control and Permissions. Ownership. NTFS and NTFS Permissions. Share Permissions. Local Access. Weak Default Permissions and Hardening Guides. Network Security. Limitations in Basic Network Protocols and APIs. The Remote Access Service (RAS). Windows 2000: Welcome to the New Millennium. What Windows 2000 Offers. Security Considerations in Windows 2000. Architecture: Some Refinements over Windows NT. Accounts and Groups. Privilege Control. Windows 2000 Trust. Auditing. Object Access Control. Network Security. Conclusion.



5. Phase 1: Reconnaissance.

Low-Technology Reconnaissance: Social Engineering, Physical Break-in, and Dumpster Diving. Social Engineering. Physical Break-In. Dumpster Diving. Search the Fine Web (STFW). Searching an Organization's Own Web Site. The Fine Art of Using Search Engines. Listening in at the Virtual Watering Hole: Usenet. Defenses against Web-Based Reconnaissance. Who is Databases: Treasure Chests of Information. Researching .com, .net, and .org Domain Names. Researching Domain Names Other than .com, .net, and .org. We've Got the Registrar, Now What? IP Address Assignments through ARIN. Defenses against Who is Searches. The Domain Name System. Interrogating DNS Servers. Defenses from DNS-Based Reconnaissance. General Purpose Reconnaissance Tools. Sam Spade, a General-Purpose Reconnaissance Client Tool. Web-Based Reconnaissance Tools: Research and Attack Portals. Conclusion.



6. Phase 2: Scanning.

War Dialing. War Dialer vs. Demon Dialer. A Toxic Recipe: Modems, Remote Access Products, and Clueless Users. SysAdmins and Insecure Modems. More Free Phone Calls, Please. Finding Telephone Numbers to Feed into a War Dialer. A Brief History of War-Dialing Tools. THC-Scan 2.0. L0pht's TBA War-Dialing Tool. The War Dialer Provides a List of Lines with Modems: Now What? Defenses against War Dialing. Network Mapping. Sweeping: Finding Live Hosts. Traceroute: What Are the Hops? Cheops: A Nifty Network Mapper and General-Purpose Management Tool. Defenses against Network Mapping. Determining Open Ports Using Port Scanners. Nmap: A Full-Featured Port Scanning Tool. Defenses against Port Scanning. Determining Firewall Filter Rules with Firewalk. Vulnerability Scanning Tools. A Whole Bunch of Vulnerability Scanners. Nessus. Vulnerability Scanning Defenses. Intrusion Detection System Evasion. How Network-Based Intrusion Detection Systems Work. How Attackers Can Evade Network-Based Intrusion Detection Systems. IDS Evasion Defenses. Conclusion.



7. Phase 3: Gaining Access Using Application and Operating System Attacks.

Script Kiddie Exploit Trolling. Pragmatism for More Sophisticated Attackers. Stack-Based Buffer Overflow Attacks. What Is a Stack? What is a Stack-Based Buffer Overflow? Exploiting Stack-Based Buffer Overflows. Finding Buffer Overflow Vulnerabilities. The Make up of a Buffer Overflow. Intrusion Detection Systems and Stack-Based Buffer Overflows. Application Layer IDS Evasion for Buffer Overflows. Once the Stack Is Smashed: Now What? Beyond Buffer Overflows. Stack-Based Buffer Overflow and Related Attack Defenses. Password Attacks. Guessing Default Passwords. Password Guessing through Login Scripting. The Art and Science of Password Cracking. Let's Crack Those Passwords! Cracking Windows NT/2000 Passwords Using L0phtCrack. Cracking UNIX (and Other) Passwords Using John the Ripper. Defenses against Password-Cracking Attacks. Web Application Attacks. Account Harvesting. Undermining Web Application Session Tracking. SQL Piggybacking. Defenses against Piggybacking SQL Commands. Conclusions.



8. Phase 3: Gaining Access Using Network Attacks.

Sniffing. Sniffing through a Hub: Passive Sniffing. Active Sniffing: Sniffing through a Switch and Other Cool Goodies. Dsniff, A Sniffing Cornucopia. Sniffing Defenses. IP Address Spoofing. IP Address Spoofing Flavor 1: Simple Spoofing: Simply Changing the IP Address. IP Address Spoofing Flavor 2: Undermining UNIX r-Commands. IP Address Spoofing Flavor 3: Spoofing with Source Routing. IP Spoofing Defenses. Session Hijacking. Session Hijacking with Hunt. Session-Hijacking Defenses. Netcat: A General Purpose Network Tool. Netcat for File Transfer. Netcat for Port Scanning. Netcat for Making Connections to Open Ports. Netcat for Vulnerability Scanning. Using Netcat to Create a Passive Backdoor Command Shell. Using Netcat to Actively Push a Backdoor Command Shell. Relaying Traffic with Netcat. Netcat Defenses. Conclusions.



9. Phase 3: Denial-of-Service Attacks.

Stopping Local Services. Defenses from Locally Stopping Services. Locally Exhausting Resources. Defenses from Locally Exhausting Resources. Remotely Stopping Services. Defenses from Remotely Stopping Services. Remotely Exhausting Resources. SYN Flood. Smurf Attacks. Distributed Denial-of-Service Attacks. Conclusions.



10. Phase 4: Maintaining Access: Trojans, Backdoors, and RootKits: Oh My!

Trojan Horses. Backdoors. Netcat as a Backdoor on UNIX Systems. The Devious Duo: Backdoors Melded into Trojan Horses. Nasty: Application-Level Trojan Horse Backdoor Tools. Let's Check out Back Orifice 2000 (BO2K). Defenses against Application-Level Trojan Horse Backdoors. Bare Minimum: Use Antivirus Tools. Don't Use Single-Purpose BO2K Checkers. Know Your Software. User Education Is Also Critical. Even Nastier: Traditional RootKits. What Do Traditional RootKits Do? The Centerpiece of Traditional RootKits on UNIX: /bin/login Replacement. Traditional RootKits: Sniff Some Passwords. Traditional RootKits: Hide that Sniffer! Traditional RootKits: Hide Everything Else! Traditional RootKits: Covering the Tracks. Some Particular Examples of Traditional RootKits. Defending against Traditional RootKits. Don't Let Them Get Root in the First Place! Looking for Changes in the File System. Host-Based Security Scanners. The Best Defense: File Integrity Checkers. Uh-oh: They RootKitted Me. How Do I Recover? Nastiest: Kernel-Level RootKits. The Power of Execution Redirection. File Hiding with Kernel-Level RootKits. Process Hiding with Kernel-Level RootKits. Network Hiding with Kernel-Level RootKits. How to Implement Kernel-Level RootKits: Loadable Kernel Modules. Some Particular Examples of Kernel-Level RootKits. Defending against Kernel-Level RootKits. Fighting Fire with Fire: Don't Do It! Don't Let Them Get Root in the First Place! Looking for Traces of Kernel-Level RootKits. Automated RootKit Checkers. The Best Answer: Kernels without LKM Support. Conclusion.



11. Phase 5: Covering Tracks and Hiding.

Hiding Evidence by Altering Event Logs. Attacking Event Logs in Windows NT/2000. Attacking System Logs and Accounting Files in UNIX. Altering UNIX Shell History Files. Defenses against Log and Accounting File Attacks. Activate Logging, Please. Set Proper Permissions. Use a Separate Logging Server. Encrypt Your Log Files. Making Log Files Append Only. Protecting Log Files with Write-Once Media. Creating Difficult-to-Find Files and Directories. Creating Hidden Files and Directories in UNIX. Creating Hidden Files in Windows NT/2000. Defenses from Hidden Files. Hiding Evidence on the Network: Covert Channels. Tunneling. More Covert Channels: Using the TCP and IP Headers to Carry Data. Defenses against Covert Channels. Conclusion.



12. Putting It All Together: Anatomy of an Attack.

Scenario 1: Dial “M” for Modem. Scenario 2: Death of a Telecommuter. Scenario 3: The Manchurian Contractor. Conclusion.



13. The Future, Resources, and Conclusions.

Where Are We Heading? Scenario 1: Yikes! Scenario 2: A Secure Future. Scenario 1, Then Scenario 2. Keeping up to Speed. Web Sites. Mailing Lists. Conferences. Final ThoughtsLive Long and Prosper.



Glossary.


Index.

Preface

Preface

My cell phone rang. I squinted through my sleepy eyelids at the clock. Ugh! 4 a.m., New Year's Day. Needless to say, I hadn't gotten very much sleep that night.

I picked up the phone to hear the frantic voice of my buddy, Fred, on the line. Fred was a security administrator for a medium-sized Internet Service Provider, and he frequently called me with questions about a variety of security issues.

"We've been hacked big time!" Fred shouted, far too loudly for this time of the morning.

I rubbed my eyes to try to gain a little coherence.

"How do you know they got in? What did they do?" I asked.

Fred replied, "They tampered with a bunch of Web pages. This is bad, Ed. My boss is gonna have a fit!"

I asked, "How did they get in? Have you checked out the logs?"

Fred stuttered, "W-Well, we don't do much logging, because it slows down performance. I only snag logs from a couple of machines. Also, on those systems where we do gather logs, the attackers cleared the log files."

"Have you applied the latest security fixes from your operating system vendor to your machines?" I asked, trying to learn a little more about Fred's security posture.

Fred responded with hesitation, "We apply security patches every three months. The last time we deployed fixes was?um?two-and-a-half months ago."

I scratched my aching head and said, "Two major buffer overflow attacks were released last week. You may have been hit. Have they installed any RootKits? Have you checked the consistency of critical files on the system?"

"You know, I was planning to install something like Tripwire, but just never got around to it," Fred admitted.

I quietly sighed and said, "OK. Just remain calm. I'll be right over so we can start to analyze your machines."

You clearly don't want to end up in a situation like Fred, and I want to minimize the number of calls I get at 4 a.m. on New Year's Day. While I've changed Fred's name to protect the innocent, this situation actually occurred. Fred's organization had failed to implement some fundamental security controls, and it had to pay the price when an attacker came knocking. In my experience, many organizations find themselves in the same state of information security unpreparedness.

But the situation goes beyond these security basics. Even if you've implemented all of the controls discussed in my Fred narrative above, there are a variety of other tips and tricks you can use to defend your systems. Sure, you may apply security patches, use a file integrity checking tool, and have adequate logging, but have you recently looked for unsecured modems? Or, how about activating port-level security on the switches in your critical network segments to prevent powerful, new active sniffing attacks? Have you considered implementing non-executable stacks to prevent one of the most common types of attacks today, the stack-based buffer overflow? Are you ready for kernel-level RootKits? If you want to learn more about these topics and more, please read on.

As we will see throughout the book, computer attacks happen each and every day, with increasing virulence. To create a good defense, you must understand the offensive techniques of your adversaries. In my career as a system penetration tester, incident response team member, and information security architect, I've seen numerous types of attacks ranging from simple scanning by clueless kids to elite attacks sponsored by the criminal underground. This book boils down the common and most damaging elements from these real-world attacks, while offering specific advice on how you can proactively avoid such trouble from your adversaries. We'll zoom in on how computer attackers conduct their activities, looking at each step of their process so we can implement in-depth defenses.

The book is designed for system administrators, network administrators, and security professionals, as well as others who want to learn how computer attackers do their magic and how to stop them. The offensive and defensive techniques laid out in the book apply to all types of organizations using computers and networks today, including enterprises and service providers, ranging in size from small to gigantic.

Computer attackers are marvelous at sharing information with each other about how to attack your infrastructure. Their efficiency at information dissemination about victims can be ruthless. It is my hope that this book can help to even the score, by sharing practical advice about how to defend your computing environment from the bad guys. By applying the defenses from this book, you can greatly improve your computer security and, perhaps, we'll both be able to sleep in late next New Year's Day.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020