netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Amm Snort <ammdispose-snort@yahoo.com>
Cc: "netfilter-devel@vger.kernel.org" <netfilter-devel@vger.kernel.org>
Subject: Re: NFQUEUE target with --treat-accept-as-continue?
Date: Sun, 1 Apr 2012 19:51:59 +0200	[thread overview]
Message-ID: <20120401175159.GA11401@1984> (raw)
In-Reply-To: <1333202982.55963.YahooMailNeo@web193402.mail.sg3.yahoo.com>

On Sat, Mar 31, 2012 at 10:09:42PM +0800, Amm Snort wrote:
> Hello all,
> 
> I would like to suggest a feature (additional parameter) for NFQUEUE target.
> 
> I am basically trying to use snort with NFQUEUE.
> 
> Basic iptables rule is somewhat like this:
> 
> iptables -A INPUT -i ppp1 -j NFQUEUE
> iptables -A INPUT -p tcp --dport 22 -j ACCEPT
> iptables -A INPUT -j DROP
> 
> Idea is to pass all packets to snort first and then if snort detects trojan signature then
> it can DROP (IPS) the packet (drop rule of snort). If snort detects port scan it can
> LOG but still ACCEPT (IDS) (alert rule of snort). If snort ACCEPTs the packet then
> continue processing next rule.
> 
> On side note, this idea also reduces load on snort as it does not have to sniff every
> packet coming on network card and also we can pass only selected packets to snort.
> 
> 
> This idea however, DOES NOT work because currently when QUEUE program (snort)
> gives verdict as NF_ACCEPT, iptables STOPS processing further rules and
> ACCEPTs the packet.
> 
> This actually becomes security risk because default snort rules DO NOT DO port blocking.
> and ACCEPTs everything that is not EXPLICITLY dropped.
> 
> And hence NFQUEUE target indirectly becomes ACCEPT target for all packets and
> full system gets exposed.
> 
> So my request and suggestion is to add additional parameter to NFQUEUE
> say, --treat-accept-as-continue (or rule not matched)
> 
> 
> which means, if QUEUE program returns NF_ACCEPT then instead of ACCEPTing
> the packet, continue processing next rule. (as if rule did  not match)
> 
> 
> I know there is NF_REPEAT, but that will PASS packet through all procesing again
> and I will also have to do packet marking etc. Which is more like HACK instead of
> sensible approach.
> 
> And to use NF_REPEAT I will need to change whole snort code and rules. Which is
> impossible.
>
> So please consider my suggestion. As it opens up many other possibilities as well.

That will not be straight forward to implement. The existing code does
not provide a way to resume packet filtering just after the rule that
enqueued the packet to user-space.

[...]
> PS:
> We can also extend this suggesion further with one more parameter as
> --treat-accept-as-return which becomes equivalent to RETURN target.

Same thing with RETURN.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2012-04-01 17:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-31 14:09 NFQUEUE target with --treat-accept-as-continue? Amm Snort
2012-04-01 17:51 ` Pablo Neira Ayuso [this message]
2012-04-02  3:11   ` Amm Snort
2012-04-02  9:13     ` Pablo Neira Ayuso
2012-04-03 12:25     ` Jan Engelhardt

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=20120401175159.GA11401@1984 \
    --to=pablo@netfilter.org \
    --cc=ammdispose-snort@yahoo.com \
    --cc=netfilter-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).