All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Schaaf <bof@bof.de>
To: macadanet@yahoo.es
Cc: lista de correo netfilter <netfilter-devel@lists.netfilter.org>
Subject: Re: string match -> new option
Date: Sat, 1 Mar 2003 07:39:48 +0100	[thread overview]
Message-ID: <20030301063948.GF24025@oknodo.bof.de> (raw)
In-Reply-To: <15760529186.20030301025308@yahoo.es>

> I modificated ipt_string.c

Sigh. Why is it that people must work on the pieces that others
already abandoned as fundamentally broken? See my point 1), below.

> This patch acepts regular expresions.

It was only a question of time...

> For example:
> 
> iptables -A INPUT -m string --string '"GET"[0-9]"HTTP"' -j LOG

> If some package includes the string: GET ???????8????????? HTTP
> the system will write in log file.

> What do people think? Is a good idea?

1) it is mostly a bad idea to use the string match at all, as it does
   not reassemble a TCP stream, and thus strings that happen to be
   broken up in two TCP segments, are not matchable. This is a
   fundamental limitation, making any security you get out of
   such a rule dubious, best-effort, only-in-good-weather pseudo
   security.
2) The string in your example, above, is not in a common form I would
   recognize as a regular expression - or your example is wrong, and the
   expression won't match that string. I assume that you invented an
   ad-hoc a-bit-similar-to-regexp matching and syntax, right?
   That's a bad idea. Yet another language to learn (or better ignore).
3) It is a bad idea to use the same --string option as before but
   totally change the interpretation of the string. See the other
   string extension proposal discussed right now. Use a new, extra
   option, or better yet, write a totally new match.
4) It is probably a bad idea, once you analyze the runtime overhead
   imposed by full packet regexp matching. But this would have to
   be quantified, it's just a feeling. It will DEFINITELY become
   really interesting to analyze when you solve points 1 (reassembly
   of TCP stream) and 2 (real regexpen), due to all the deep
   backtracking that regexpen could do. Also watch the severely
   limited kernel stack, if your implementation happens to be
   a naive recursive one! You won't want a slightly more complex
   packet to crash the kernel due to stack exhaustion!

best regards
  Patrick

  reply	other threads:[~2003-03-01  6:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-01  1:53 string match -> new option macadanet
2003-03-01  6:39 ` Patrick Schaaf [this message]
2003-03-01 15:47   ` Michael Rash
2003-03-02  9:59   ` Harald Welte
2003-03-02 11:36     ` Patrick Schaaf

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=20030301063948.GF24025@oknodo.bof.de \
    --to=bof@bof.de \
    --cc=macadanet@yahoo.es \
    --cc=netfilter-devel@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.