![]() |
|||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||
| Netcat
- The TCP/IP Swiss Army Knife Overview Netcat is a tool that every security professional should be aware of and possibly have in their security tool box. In May/June of 2000, insecure.org conducted a survey of 1200 Nmap users from the Nmap-hackers mailing list to determine their favorite security tools. Netcat was the second most popular tool, not including Nmap. A quick search on securityportal (www.securityportal.com) found 166 matches of netcat. Most of the matches describe or use netcat in some way. Netcat is a utility that is able to write and read data across TCP and UDP network connections. If you are responsible for network or system security it essential that you understand the capabilities of netcat. Netcat should not be installed unless you have authority to do so. Never install any executable unless you can trust the providor. If possible review the source and compile it yourself. To be safe only use netcat in a test environment. Hobbit (hobbit@avian.org) created netcat in 1995 as a feature-rich network debugging and exploration tool. Its purpose was to be able to create just about any type of network connection. According to Hobbit- Some of the features of netcat are:
Some of the potential uses of netcat:
The original version of netcat was released to run on Unix and Linux. Weld Pond (weld@l0pht.com) released the Windows NT version in 1998. The source code is available for both versions. Remote command prompt anyone? On a Windows NT server issue the following command in the directory that contains netcat:
This l puts netcat into listen mode, the -p1234 tells netcat to use port 1234, the d allows netcat to run detached from the console, the e cmd.exe tells netcat to execute the cmd.exe program when a connection is made, and the L will restart Netcat with the same command line when the connection is terminated. On the client system issue the following command:
This command causes netcat to connect to the server named destination on port 1234. Immediately you are given a console connection to the destination server. Be careful! To exit the remote console session type:
You will be returned to your own console and will be able to reconnect to the destination server because netcat was started on the destination server with the L option. FTP & drive mapping blocked? To receive a file named newfile on the destination system start netcat with the following command:
On the source system send a file named origfile to the destination system with the following command:
Issue a ^C on the source system and your done. Be sure to check the file to be sure it is the same size as the original. Hiding Netcat on Windows NT Here are a few ways that a hacker could use to hide netcat on a system or use it behind a firewall:
Port Scanning A scanning example from Hobbit is "nc -v -w 2 -z target 20-30". Netcat will try connecting to every port between 20 and 30 [inclusive] at the target, and will likely inform you about an FTP server, telnet server, and mailer along the way. The -z switch prevents sending any data to a TCP connection and very limited probe data to a UDP connection, and is thus useful as a fast scanning mode just to see what ports the target is listening on. To limit scanning speed if desired, -i will insert a delay between each port probe. Even though netcat can be used for port scanning it isnt its strength. A tool such as nmap is better suited for port scanning. Netcat + Encryption = Cryptcat Netcat is a useful tool as it is, but if someone were using it you would be able to at least get a feel for what they were doing. At least you could before Cryptcat! Cryptcat is the standard netcat enhanced with Bruce Schneiers twofish encryption. It can be found at www.farm9.com. Linux, OpenBSD, FreeBSD, and Windows versions are available. So much for sniffing any netcat traffic! Command Option Overview Netcat accepts its commands with options first, then the target host, and everything thereafter is interpreted as port names or numbers, or ranges of ports in M-N syntax. Netcat does not currently handle portnames with hyphens.
Conclusion Netcat is a powerful tool that every security professional should be familiar with. It should be used with caution. I would not recommend installing netcat on your production networks. I would suggest using it to test your firewall, and router configurations in a test environment. It can also be used to test your operating system lockdown procedures. Be certain that you have the authority to install and use netcat on your network before doing so. You might even want to review the source code to learn how Hobbit built netcat and how Weld Pond ported it to the Windows platform. References 1. Insecure.org, "Top 50 Security Tools" 2. Hobbit, "New tool available: Netcat" 3. Weld Pond, "Netcat 1.10 for NT" 4. Hobbit, "Netcat 1.10" 5. Farm9, "cryptcat = netcat + encryption" 6. Hobbit, "Netcat 1.10" |
|||||||||||||||||||||||||||||||||||||||||||
|
to top of page | to Auditing & Assessment | to Reading Room Home
|
|||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||