Originally released in 1996, Netcat is a netowrking program designed to read and write data across both Transmission Control Protocol TCP and User Datagram Protocol (UDP) connections using the TCP/Internet Protocol (IP) protocol suite. Netcat is often referred to as a "Swiss Army knife" utility, and for good reason. Just like the multi-function usefullness of the venerable Swiss Army pocket knife, Netcat's functionality is helpful as both a standalone program and a backe-end tool in a wide range of applications. Some of the many uses of Netcat include port scanning, transferring files, grabbing banners, port listening and redirection, and more nefariously, a backdoor. This is the only book dedicated to comprehensive coverage of the tool's many features, and by the end of this book, you'll discover how Netcat can be one of the most valuable tools in your arsenal. * Get Up and Running with Netcat Simple yet powerful. . . Don't let the trouble-free installation and the easy command line belie the fact that Netcat is indeed a potent and powerful program. * Go PenTesting with Netcat Master Netcat's port scanning and service identification capabilities as well as obtaining Web server application information. Test and verify outbound firewall rules and avoid detection by using antivirus software and the Window Firewall. Also, create a backdoor using Netcat. * Conduct Enumeration and Scanning with Netcat, Nmap, and More! Netcat's not the only game in town. . . Learn the process of network of enumeration and scanning, and see how Netcat along with other tools such as Nmap and Scanrand can be used to thoroughly identify all of the assets on your network. * Banner Grabbing with Netcat Banner grabbing is a simple yet highly effective method of gathering information about a remote target, and can be performed with relative ease with the Netcat utility. * Explore the Dark Side of Netcat See the various ways Netcat has been used to provide malicious, unauthorized access to their targets. By walking through these methods used to set up backdoor access and circumvent protection mechanisms through the use of Netcat, we can understand how malicious hackers obtain and maintain illegal access. Embrace the dark side of Netcat, so that you may do good deeds later. * Transfer Files Using Netcat The flexability and simple operation allows Netcat to fill a niche when it comes to moving a file or files in a quick and easy fashion. Encryption is provided via several different avenues including integrated support on some of the more modern Netcat variants, tunneling via third-party tools, or operating system integrated IPsec policies. * Troubleshoot Your Network with Netcat Examine remote systems using Netat's scanning ability. Test open ports to see if they really are active and see what protocls are on those ports. Communicate with different applications to determine what problems might exist, and gain insight into how to solve these problems. * Sniff Traffic within a System Use Netcat as a sniffer within a system to collect incoming and outgoing data. Set up Netcat to listen at ports higher than 1023 (the well-known ports), so you can use Netcat even as a normal user.
- Comprehensive introduction to the #4 most popular open source security toolavailable
- Tips and tricks on the legitimate uses of Netcat
- Detailed information on its nefarious purposes
- Demystifies security issues surrounding Netcat
- Case studies featuring dozens of ways to use Netcat in daily tasks
Inhaltsverzeichnis
1;Front Cover;1 2;Netcat Power Tools;4 3;Technical Editor;6 4;Contributing Authors;7 5;Contents;10 6;Chapter 1: Introduction to Netcat;16 6.1;Introduction;17 6.2;Installation;18 6.2.1;Windows Installation;18 6.2.2;Linux Installation;20 6.2.2.1;Installing Netcat as a Package;21 6.2.2.2;Installing Netcat from Source;22 6.2.3;Confirming Your Installation;25 6.3;Netcats Command Options;26 6.3.1;Modes of Operation;26 6.3.2;Common Command Options;27 6.3.3;Redirector Tools;33 6.4;Basic Operations;34 6.4.1;Simple Chat Interface;34 6.4.2;Port Scanning;35 6.4.3;Transferring Files;36 6.4.4;Banner Grabbing;38 6.4.5;Redirecting Ports and Traffic;39 6.4.6;Other Uses;40 6.5;Summary;41 6.6;Solutions Fast Track;42 6.6.1;Introduction;42 6.6.2;Installation;42 6.6.3;Options;42 6.6.4;Basic Operations;42 6.7;Frequently Asked Questions;43 7;Chapter 2: Netcat Penetration Testing Features;46 7.1;Introduction;47 7.2;Port Scanning and Service Identification;47 7.2.1;Using Netcat as a Port Scanner;47 7.2.2;Banner Grabbing;49 7.2.2.1;Scripting Netcat to Identify Multiple Web Server Banners;50 7.2.2.2;Service Identification;51 7.2.3;Egress Firewall Testing;51 7.2.3.1;System B - The System on the Outside of the Firewall;52 7.2.3.2;System A - The System on the Inside of the Firewall;54 7.3;Avoiding Detection on a Windows System;55 7.3.1;Evading the Windows XP/Windows 2003 Server Firewall;55 7.3.1.1;Example;56 7.3.1.2;Making Firewall Exceptions using Netsh Commands;56 7.3.1.2.1;Determining the State of the Firewall;57 7.3.2;Evading Antivirus Detection;59 7.3.2.1;Recompiling Netcat;59 7.4;Creating a Netcat Backdoor on a Windows XP or Windows 2003 Server;61 7.4.1;Backdoor Connection Methods;62 7.4.1.1;Initiating a Direct Connection to the Backdoor;62 7.4.1.1.1;Benefit of this Method;63 7.4.1.1.2;Drawbacks to this Method;63 7.4.1.2;Initiating a Connection from the Backdoor;64 7.4.1.2.1;Benefits of this Connection Method;65 7.4.1.2.2;Drawback to this Method;65 7.4.2;Backdoor Execution Methods;65 7.4.2.
1;Executing the Backdoor using a Registry Entry;65 7.4.2.1.1;Benefits of this Method;67 7.4.2.1.2;Drawback to this Method;67 7.4.2.2;Executing the Backdoor using a Windows Service;67 7.4.2.2.1;Benefits of this Method;69 7.4.2.2.2;Drawback to this Method;69 7.4.2.3;Executing the Backdoor using Windows Task Scheduler;69 7.4.2.3.1;Benefit to this Method;71 7.4.2.4;Backdoor Execution Summary;71 7.5;Summary;72 7.6;Solutions Fast Track;72 7.6.1;Port Scanning and Service Identification;72 7.6.2;Egress Firewall Testing;72 7.6.3;Avoid Detection on a Windows System;72 7.6.4;Creating a Netcat Backdoor on a Windows XP or Windows 2003 Server;73 7.7;Frequently Asked Questions;74 8;Chapter 3: Enumeration and Scanning with Netcat and Nmap;76 8.1;Introduction;77 8.2;Objectives;77 8.2.1;Before You Start;77 8.2.2;Why Do This?;78 8.3;Approach;79 8.3.1;Scanning;79 8.3.2;Enumeration;80 8.3.2.1;Notes and Documentation;81 8.3.2.2;Active versus Passive;82 8.3.2.3;Moving On;82 8.4;Core Technology;82 8.4.1;How Scanning Works;82 8.4.1.1;Port Scanning;83 8.4.2;Going behind the Scenes with Enumeration;86 8.4.2.1;Service Identification;86 8.4.2.2;RPC Enumeration;87 8.4.2.3;Fingerprinting;87 8.4.3;Being Loud, Quiet, and All That Lies Between;88 8.4.3.1;Timing;88 8.4.3.2;Bandwidth Issues;89 8.4.3.3;Unusual Packet Formation;89 8.5;Open Source Tools;89 8.5.1;Scanning;90 8.5.1.1;Nmap;90 8.5.1.1.1;Nmap: Ping Sweep;90 8.5.1.1.2;Nmap: ICMP Options;91 8.5.1.1.3;Nmap: Output Options;92 8.5.1.1.4;Nmap: Stealth Scanning;92 8.5.1.1.5;Nmap: OS Fingerprinting;93 8.5.1.1.6;Nmap: Scripting;94 8.5.1.1.7;Nmap: Speed Options;95 8.5.1.2;Netenum: Ping Sweep;98 8.5.1.3;Unicornscan: Port Scan and Fuzzing;98 8.5.1.4;Scanrand: Port Scan;99 8.5.2;Enumeration;100 8.5.2.1;Nmap: Banner Grabbing;100 8.5.2.2;Netcat;102 8.5.2.3;P0f: Passive OS Fingerprinting;103 8.5.2.4;Xprobe2: OS Fingerprinting;103 8.5.2.5;Httprint;104 8.5.2.6;Ike-scan: VPN Assessment;106 8.5.2.7;Amap: Application Version Detection;107 8.5.2.8;Windows Enumerat
ion: Smbgetserverinfo/smbdumpusers/smbclient;107 9;Chapter 4: Banner Grabbing with Netcat;112 9.1;Introduction;113 9.2;Benefits of Banner Grabbing;113 9.2.1;Benefits for the Server Owner;114 9.2.1.1;Finding Unauthorized Servers;114 9.2.2;Benefits for a Network Attacker;116 9.2.2.1;Why Not Nmap?;118 9.3;Basic Banner Grabbing;119 9.3.1;Web Servers (HTTP);119 9.3.1.1;Acquiring Just the Header;121 9.3.1.2;Dealing With Obfuscated Banners;122 9.3.1.2.1;Apache ServerTokens;124 9.3.1.2.2;Reading the Subtle Clues in an Obfuscated Header;125 9.3.1.3;HTTP 1.0 vs. HTTP 1.1;125 9.3.1.4;Secure HTTP servers (HTTPS);127 9.3.2;File Transfer Protocol (FTP) Servers;131 9.3.2.1;Immense FTP Payloads;133 9.3.3;E-mail Servers;135 9.3.3.1;Post Office Protocol (POP) Servers;135 9.3.3.2;Simple Mail Transport Protocol (SMTP) Servers;136 9.3.3.2.1;So, Back to the Banner Grabbing;137 9.3.3.2.2;Fingerprinting SMTP Server Responses;139 9.3.3.3;How to Modify your E-mail Banners;140 9.3.3.3.1;Sendmail Banners;141 9.3.3.3.2;Microsoft Exchange SMTP Banners;143 9.3.3.3.3;Microsoft Exchange POP and IMAP Banners;144 9.3.4;Secure Shell (SSH) Servers;145 9.3.4.1;Hiding the SSH Banner;147 9.4;Banner Grabbing with a Packet Sniffer;147 9.5;Summary;152 9.6;Solutions Fast Track;154 9.6.1;Benefits of Banner Grabbing;154 9.6.2;Basic Banner Grabbing;155 9.6.3;Banner Grabbing with a Packet Sniffer;155 9.7;Frequently Asked Questions;156 10;Chapter 5: The Dark Side of Netcat;158 10.1;Introduction;159 10.2;Sniffing Traffic within a System;160 10.2.1;Sniffing Traffic by Relocating a Service;161 10.2.2;Sniffing Traffic without Relocating a Service;166 10.3;Rogue Tunnel Attacks;171 10.3.1;Connecting Through a Pivot System;175 10.3.2;Transferring Files;180 10.3.2.1;Using Secure Shell;180 10.3.2.2;Using Redirection;181 10.3.3;Man-in-the-middle Attacks;182 10.4;Backdoors and Shell Shoveling;183 10.4.1;Backdoors;183 10.4.2;Shell Shoveling;185 10.4.2.1;Shoveling with No Direct Connection to Target;185 10.4.2.2;Shoveling with
Direct Connection to Target;188 10.5;Netcat on Windows;189 10.6;Summary;191 11;Chapter 6: Transferring Files Using Netcat;194 11.1;Introduction;195 11.2;When to Use Netcat to Transfer Files;195 11.2.1;Sometimes Less Really is Less;196 11.2.1.1;Security Concerns;196 11.2.1.2;Software Installation on Windows Clients;197 11.2.2;Where Netcat Shines;197 11.2.2.1;Speed of Deployment;198 11.2.2.2;Stealth;198 11.2.2.3;Small Footprint;199 11.2.2.4;Simple Operation;199 11.3;Performing Basic File Transfers;200 11.3.1;Transferring Files with the Original Netcat;200 11.3.1.1;Closing Netcat When the Transfer is Completed;201 11.3.1.2;Other Options and Considerations;202 11.3.1.2.1;Timing Transfers, Throughput, etc;203 11.3.1.2.2;Tunneling a Transfer Through an Intermediary;204 11.4;Using Netcat Variants;205 11.4.1;Cryptcat;205 11.4.2;GNU Netcat;207 11.4.3;SBD;208 11.4.4;Socat;209 11.4.4.1;Socat Basics;209 11.4.4.2;Transferring Files with Socat;210 11.4.4.3;Encryption;211 11.4.4.4;Mixing and Matching;212 11.5;Ensuring File Confidentiality;213 11.5.1;Using OpenSSH;213 11.5.1.1;Installing and Configuring Secure Shell;214 11.5.1.2;Configuring OpenSSH Port Forwarding;216 11.5.2;Using SSL;217 11.5.2.1;Configuring Stunnel;217 11.5.3;Using IPsec;220 11.5.3.1;Configuring IPSec on Windows;221 11.5.3.2;Configuring IPSec on Linux;227 11.6;Ensuring File Integrity;232 11.6.1;Hashing Tools;232 11.7;Using Netcat for Testing;234 11.7.1;Testing Bandwidth;234 11.7.2;Testing Connectivity;235 11.8;Summary;236 11.9;Solutions Fast Track;236 11.9.1;When to Use Netcat to Transfer Files;236 11.9.2;Performing Basic File Transfers;236 11.9.3;Using Netcat Variants;236 11.9.4;Ensuring File Confidentiality;237 11.9.5;Ensuring File Integrity;237 11.9.6;Using Netcat for Testing;237 11.10;Frequently Asked Questions;238 12;Chapter 7: Troubleshooting with Netcat;240 12.1;Introduction;241 12.2;Scanning a System;242 12.3;Testing Network Latency;245 12.3.1;Using Netcat as a Listener on Our Target System;246 12.3.2;Us
ing a Pre-existing Service on Our Target System;249 12.3.2.1;Using a UDP Service;249 12.3.2.2;Using a TCP Service;250 12.4;Application Connectivity;251 12.4.1;Troubleshooting HTTP;252 12.4.2;Troubleshooting FTP;258 12.4.2.1;Troubleshooting Active FTP Transfers Using Netcat;260 12.4.2.2;Troubleshooting Passive FTP Transfers using Netcat;263 12.5;Summary;266 13;Index;268