netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mr Dash Four <mr.dash.four@googlemail.com>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Dennis Jacobfeuerborn <dennisml@conversis.de>,
	netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org
Subject: Re: [ANNOUNCE] ipset-5.0 released
Date: Mon, 27 Dec 2010 16:23:28 +0000	[thread overview]
Message-ID: <4D18BD80.2030807@googlemail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1012271517330.11100@blackhole.kfki.hu>


>> Whatever the appropriate place holder is - 'all', '*', '@', '$$$$$$' etc. etc
>> - as long as it does the job at the end it won't matter.
>>     
>
> It does matter. Non-intuitive syntax and notation are bad. Moreover, the 
> notation should be open to handle other protocols too (see below).
>   
What I meant was that whatever the prefix *you* decide to put in, for 
*me* it won't matter as long as it does its job.

>> I wasn't aware that there are more than 2 (tcp and udp) protocols on which I
>> could define/use ports!
>>     
>
> sctp, udplite.
>   
I learn something new every day. Then it makes even more sense to store 
the protocol as a number, not as string for easier matching - useful if 
you one day decide to apply masking (or other convenient form of 
searching) against the captured protocol (which could also be a number). 
;-)

>> What are your plans?
>>     
>
> Double check and triple check both the kernel and userspace of ipset 5. 
> Get more feedback, especially from uncommon architecture. Submit for 
> kernel inclusion. After that new features can be added.
>   
Fair enough. Any idea when ipset 5.2 will be incorporated into xtables 
so that I could download it and start testing it? *nudges Jan*

As it stands, I do not have enough information to build the rpm spec 
file in order to create a complete xtables rpm package to incorporate 
your version of ipset (without this I cannot distribute it across my 
test machines easily), so unless I am able to build this rpm the whole 
thing is a no go from me.

>> So, in other words 'internally' you store something like (using your example
>> above) 192.168.0.0 (the IP part), 30 (the prefix), tcp, 80 in the structure,
>> is that right?
>>     
>
> Yes, exactly.
>
>   
>> Do you then use the mask of each member of that set (30 and 24 in your example
>> above) until you get a match? In other words, you 'walk through' every
>> internally stored element and try their mask and then lookup for a match, is
>> that how you do it?
>>     
>
> Besides the elements, the different prefixes are also stored in the set. 
> So the test set in the example "knows" that the prefixes 30 and 24 occur 
> only and use only those to find a match, starting from the most speficic 
> prefix to the least one.
>   
If I understand you correctly, you keep a separate structure which 
stores all prefixes used in the target set, walk through that structure 
and for each element you build start-end range based on the IP address 
captured and the current prefix. You then create a hash on the 
calculated start-end range, protocol and port triple and then test that 
hash against the hash value of the target set triple (IP range, 
protocol, port). Is that how you do it?

I understand that things are a bit easier with hash:ip,protocol,port as 
you don't need to store prefixes - you just calculate the hashes and 
match them against the corresponding hashes of the set triple, right?

>>> However, the problem with iptree(map) is that it's susceptible when used as
>>> a container to block attackers dynamically by the SET target: it's trivial
>>> to mount an attack by which the worst tree structure is forced to be
>>> created.
>>>       
>> Could you expand on that bit please? What do you mean?
>>     
>
> The iptree(map) sets store the elements in a tree structure which follows 
> the dotted decimal notation of the IPv4 addresses. Let's assume, someone 
> catches attackers by a given match and stores their IP addresses in the 
> iptree type of set called "attackers":
>
> # If some matches are true, it's an attacker, store the address
> ...... -j SET attackers src
> # Drop known attackers
> .... -m set attackers src -j DROP
>
> What I referred to was that it's not hard to send forged packets, which 
> create the widest and least filled in (i.e. worst) tree structure. It does 
> not slow down the set but pushes it to the worst memory usage case.
>   
Couldn't the same be said for the hash (or any other?) ipsets as well? I 
am not using that 'feature' anyway, as I include the ip addresses/ranges 
manually from script files (though some of them are automatically 
generated and are based on the geoip database which is downloaded at 
regular intervals), so that 'vulnerability' does not apply to me.

> I regard it as a weakness of the type: an attacker must not be able to 
> trigger any worst case situation of a set type intentionally.
>   
How is that changed in the hash (or bitmap even) ipsets - would that not 
be the same then: an attacker crafts specifically designed packets to 
include certain ip/port ranges in a set (*a* set - it could be any set)?

I think the culprit is not the set itself, but the SET target as I find 
it rather foolish that someone would let an outsider to manipulate a set 
using this SET target. For example, if I am an attacker and I know that 
the target machine relies on access to certain IP address, then I could 
craft a packet in such a way that it triggers this SET target which then 
includes the IP address/range in the 'attackers' set and therefore 
disable access to that address on the target machine - job done!


  reply	other threads:[~2010-12-27 16:23 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 22:26 [ANNOUNCE] ipset-5.0 released Jozsef Kadlecsik
2010-12-17 23:32 ` Jan Engelhardt
2010-12-18 10:40   ` Jozsef Kadlecsik
2010-12-18  7:29 ` Rob Sterenborg (lists)
2010-12-18 11:13   ` Jozsef Kadlecsik
2010-12-18 15:43     ` Jan Engelhardt
2010-12-18 19:50       ` Jozsef Kadlecsik
2010-12-18 21:49         ` Jan Engelhardt
2010-12-19  0:05           ` Jozsef Kadlecsik
2010-12-19  0:28             ` Jan Engelhardt
2010-12-19  5:56           ` Jan Engelhardt
2010-12-19 18:23     ` Rob Sterenborg (lists)
2010-12-21 11:14     ` Rob Sterenborg (lists)
2010-12-21 14:03       ` Jozsef Kadlecsik
2010-12-18 14:22 ` Mr Dash Four
2010-12-18 20:23   ` Jozsef Kadlecsik
2010-12-18 21:51     ` Mr Dash Four
2010-12-18 22:10       ` Jan Engelhardt
2010-12-18 22:23         ` Mr Dash Four
2010-12-19  0:34       ` Jozsef Kadlecsik
2010-12-19 13:52         ` Mr Dash Four
2010-12-19 15:20           ` Dennis Jacobfeuerborn
2010-12-19 17:04             ` Mr Dash Four
2010-12-22 10:59               ` Jozsef Kadlecsik
2010-12-22 12:48                 ` Mr Dash Four
2010-12-23 15:39                   ` Jozsef Kadlecsik
2010-12-23 17:50                     ` Mr Dash Four
2010-12-23 17:55                       ` David Miller
2010-12-23 18:00                         ` Mr Dash Four
2010-12-23 18:06                           ` David Miller
2010-12-23 18:10                             ` Mr Dash Four
2010-12-23 19:35                       ` Jozsef Kadlecsik
2010-12-23 22:23                         ` Mr Dash Four
2010-12-23 22:46                           ` Jozsef Kadlecsik
2010-12-23 22:56                             ` Jozsef Kadlecsik
2010-12-23 23:06                               ` Mr Dash Four
2010-12-26 10:30                                 ` Jozsef Kadlecsik
2010-12-26 13:47                                   ` Mr Dash Four
2010-12-26 20:09                                     ` Jozsef Kadlecsik
2010-12-26 21:44                                       ` Mr Dash Four
2010-12-27 14:49                                         ` Jozsef Kadlecsik
2010-12-27 16:23                                           ` Mr Dash Four [this message]
2010-12-27 18:20                                             ` Jozsef Kadlecsik
2010-12-27 18:52                                               ` Mr Dash Four
2010-12-28 19:26                                                 ` Jozsef Kadlecsik
2010-12-23 23:03                             ` Mr Dash Four
2010-12-26 10:32                               ` Jozsef Kadlecsik
2010-12-23 21:51                       ` 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=4D18BD80.2030807@googlemail.com \
    --to=mr.dash.four@googlemail.com \
    --cc=dennisml@conversis.de \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@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).