About nixCraft

Topics

Linux Cutting the tcp/ip network connection with cutter command

Posted by Vivek Gite [Last updated: September 29, 2007]

Recently I came across very powerful and nifty tool called cutter. Just imagine that people in your private network using peer to peer (P2P) software such as Kazaa, iMesh or others and you want to cut them or just want to cut all ftp connection over your firewall but not all traffic to host. Network security administrators sometimes need to be able to abort TCP/IP connections routed over their firewalls on demand

cutter utility

In the following sample network diagram client workstation 192.168.1.1 sending ftp, http, ssh traffic using 192.168.1.254 (Linux based) router to server outside our network, and you would like to cut ftp traffic without interrupting other connection? So how do you block and cut traffic? Simply, use cutter utility.

client ->    Linux firewall -> Internet --> Servers
FTP    ->    192.168.1.254  -> Internet --> FTP Server
HTTP   ->    192.168.1.254  -> Internet --> HTTP Server
SSH    ->    192.168.1.254  -> Internet --> SSH Server
192.168.1.1

Cutter is an open source program that allows Linux firewall administrators to abort TCP/IP connections routed over Linux based firewall. This tool is very handy in situation like:

How do I use cutter command?

Use apt-get to install cutter on a Debian / Ubuntu Linux firewall:
# apt-get install cutter

1) Login to your iptables based firewall router

2) Identify your internal connection (use netstat or tcpdump)

3) Use cutter the command as follows:
cutter {IP-address} {Port}

Examples:
Cut all connections from 192.168.1.5 to server
# cutter 192.168.1.5

Cut all ssh connection from 192.168.1.5 to server
# cutter 192.168.1.5 22

Cut all ssh connection from 192.168.1.5 to ssh server 202.54.1.20
# cutter 202.54.1.20 192.168.1.5 22

Please note that cutter has been designed for use as a administrators tool for Linux firewalls do not use this tool for malicious purpose. For more information about this tool & how actually it works by sending FIN -> ACK -> RST sequence of packets to terminate connection, see the official web site.

Update: As pointed out by Mina Naguib you can also use tcpkill command for same purpose.

Related articles:

E-mail this to a Friend    Printable Version

Acer Aspire One 8.9-inch Mini Laptop (1.6 GHz Intel Atom N270 Processor, 1 GB RAM, 160 GB Hard Drive, XP Home, 6 Cell Battery) Sapphire Blue

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Bryan Jr. Says:

    I saw your post at adminpointing.net, never know such command exist ever. I’m looking to kill kazza traffic with this ;)

    Bryan Jr.

  2. Anonymous Says:

    Very useful but not for everybody, untile and unless your are net admin ;)

  3. kdefanboy Says:

    Very cool, now where is my router box?

  4. Anonymous Says:

    Okay, so how is this different from making a change to the iptables config files or from executing an iptables command on the command line?

  5. Mina Naguib Says:

    `tcpkill`, part of Dug Song’s “dsniff” package, does the same thing plus a bit more

  6. Sundar Says:

    Really good stuff, pal.

  7. LinuxTitli Says:

    Mina Naguib, thanks for pointing out tcpkill tool. I appreciate your post

  8. LinuxTitli Says:

    >Anonymous said…
    >Okay, so how is this different from making a change to the iptables config files or from executing an iptables command on the command line?

    Making changes to firewall script is another solution only if you wanna block your user permanently; it is all about cutting connections what will you do suppose workstation 192.168.1.5-10 left unused ssh tunnels or vpn connection Friday night and they will only back on monday? Solution is simple cut it that connection as I cannot shutdown workstation (they may login from home) …this will also save memory load on Linux route (you can see the difference using following command on router itself)
    cat /proc/slabinfo

  9. Anonymous Says:

    Well Anonymous user it is diffrent than iptables as some one pointed out on digg:

    iptables is only active on future connections, not current ones. you could institute a snort-inline setup which if you added rules to then it would drop current connections that matched your rules.

    Also this utility is in gentoo portage. Source: diecastbeatdown @ digg.com

  10. sameer Says:

    well on non-routers you can use netstat to kill a tcp connection

    # netstat -p | grep
    192.168.1.x

    # kill -9 pid

    done.

  11. mohamed Says:

    nice work

  12. marek Says:

    ># sameer Says:
    >October 3rd, 2006 at 9:43 pm
    >
    >well on non-routers you can use netstat to kill a tcp connection
    >
    ># netstat -p | grep
    >192.168.1.x
    >
    ># kill -9 pid
    >
    >done.

    Well what if I don’t want to kil the process, but only the connection? kill -9 PID is a bit excessive, IMHO.

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , ,

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.