From: Ramoni <ramoni@databras.com.br>
To: netfilter@lists.netfilter.org
Subject: Re: Question about -m string module
Date: Fri, 4 Feb 2005 14:27:56 -0200 [thread overview]
Message-ID: <200502041427.56273.ramoni@databras.com.br> (raw)
In-Reply-To: <60578.142.169.215.10.1107532709.squirrel@142.169.215.10>
If you want to DROP some mail using string on iptables, you will DoS you
server.
Why ?
Ok that smtp is a plain protocol, and you may drop a smtp connection if you
find a string in it.
But you are dropping the emal, you are dropping a connection.
Pay attention that the string you are searching in the drop rule, wont be in
the first packet of the connection, so the connection to your mail server
will start. After that, you will drop the rest of the packets if you find the
string, and then, your mail server will be in a close wait state until the
timeout.
It will reach the point that all smtp processes are used and your server wont
accept any new connections.
Sorry about the english, but I'm sure that what I say will happen.
(I've done it... lol)
On Friday 04 February 2005 13:58, Samuel Jean wrote:
> On Fri, February 4, 2005 10:23 am, Maxime Ducharme said:
> > Hello guys
>
> Hiya Maxime!
>
> > I have a question about -m string module and
> > I think you iptables geeks can answer me :)
>
> I am no geek nor guru ;)
>
> > Suppose I want to drop TCP connections with
> > specific requests.
> >
> > Example : a mail which contains the word "sperm",
>
> I don't think iptables is the proper tool for such.
> Consider using a mail proxy able to scan message for virus
> and such instead.
>
> > I'd add a rule like
> >
> > $IPTABLES -t filter -A FORWARD -p tcp --dport 25 -d OURMAILSERVER \
> > -m string --string "sperm" -j DROP
> >
> > What is the reaction in the TCP connection ?
>
> That packet always gets lost in the black hole.
> The sender will keep sending that packet over and over again.
> However, I *think* TCP has a timeout mechanism.
>
> > The further packets of the same connection get dropped too ?
>
> No
>
> > This would mean the email cannot be sent, and stay in the foreign
> > mail server queue for X days ?
>
> My guess is the TCP algorithm would keep trying to send that particular
> packet as it didn't get any ACK for that sequence number.
>
> > Would it be the same if I use a REJECT rule ?
>
> No. I think a tcp-reset would do the trick.
>
> > Also, can fragmented TCP packets get through this ?
>
> Yes, but that `sperm' word is quite small. Most of the time,
> this whole word will stand in a framgented packet.
>
> > Thanks in advance
> >
> > Maxime Ducharme
> > Programmeur / Spécialiste en sécurité réseau
>
> Bonne journée,
>
> Samuel
>
> NOTE: This email reflects author _thoughts_, not the reality.
> I may be totally wrong, so just don't trust me :-)
--
André "Ramoni" (Cabelo)
Redes / Linux
Databras Informatica
Tel: (21) 2518-2363
Fax: (21) 2263-6830
next prev parent reply other threads:[~2005-02-04 16:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-04 15:23 Question about -m string module Maxime Ducharme
2005-02-04 15:58 ` Samuel Jean
2005-02-04 16:27 ` Ramoni [this message]
2005-02-04 20:23 ` Maxime Ducharme
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200502041427.56273.ramoni@databras.com.br \
--to=ramoni@databras.com.br \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.