<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/include/net/netfilter, branch v5.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.1</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.1'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-04-15T05:31:44Z</updated>
<entry>
<title>netfilter: ctnetlink: don't use conntrack/expect object addresses as id</title>
<updated>2019-04-15T05:31:44Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2019-04-01T11:08:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3c79107631db1f7fd32cf3f7368e4672004a3010'/>
<id>urn:sha1:3c79107631db1f7fd32cf3f7368e4672004a3010</id>
<content type='text'>
else, we leak the addresses to userspace via ctnetlink events
and dumps.

Compute an ID on demand based on the immutable parts of nf_conn struct.

Another advantage compared to using an address is that there is no
immediate re-use of the same ID in case the conntrack entry is freed and
reallocated again immediately.

Fixes: 3583240249ef ("[NETFILTER]: nf_conntrack_expect: kill unique ID")
Fixes: 7f85f914721f ("[NETFILTER]: nf_conntrack: kill unique ID")
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: conntrack: don't set related state for different outer address</title>
<updated>2019-04-13T12:52:57Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2019-03-25T22:11:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1025ce75212bf06d93910297a03ed6a4d41d8213'/>
<id>urn:sha1:1025ce75212bf06d93910297a03ed6a4d41d8213</id>
<content type='text'>
Luca Moro says:
 ------
The issue lies in the filtering of ICMP and ICMPv6 errors that include an
inner IP datagram.
For these packets, icmp_error_message() extract the ICMP error and inner
layer to search of a known state.
If a state is found the packet is tagged as related (IP_CT_RELATED).

The problem is that there is no correlation check between the inner and
outer layer of the packet.
So one can encapsulate an error with an inner layer matching a known state,
while its outer layer is directed to a filtered host.
In this case the whole packet will be tagged as related.
This has various implications from a rule bypass (if a rule to related
trafic is allow), to a known state oracle.

Unfortunately, we could not find a real statement in a RFC on how this case
should be filtered.
The closest we found is RFC5927 (Section 4.3) but it is not very clear.

A possible fix would be to check that the inner IP source is the same than
the outer destination.

We believed this kind of attack was not documented yet, so we started to
write a blog post about it.
You can find it attached to this mail (sorry for the extract quality).
It contains more technical details, PoC and discussion about the identified
behavior.
We discovered later that
https://www.gont.com.ar/papers/filtering-of-icmp-error-messages.pdf
described a similar attack concept in 2004 but without the stateful
filtering in mind.
 -----

This implements above suggested fix:
In icmp(v6) error handler, take outer destination address, then pass
that into the common function that does the "related" association.

After obtaining the nf_conn of the matching inner-headers connection,
check that the destination address of the opposite direction tuple
is the same as the outer address and only set RELATED if thats the case.

Reported-by: Luca Moro &lt;luca.moro@synacktiv.com&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_tables: bogus EBUSY when deleting set after flush</title>
<updated>2019-03-11T12:19:24Z</updated>
<author>
<name>Pablo Neira Ayuso</name>
<email>pablo@netfilter.org</email>
</author>
<published>2019-03-08T14:30:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=273fe3f1006ea5ebc63d6729e43e8e45e32b256a'/>
<id>urn:sha1:273fe3f1006ea5ebc63d6729e43e8e45e32b256a</id>
<content type='text'>
Set deletion after flush coming in the same batch results in EBUSY. Add
set use counter to track the number of references to this set from
rules. We cannot rely on the list of bindings for this since such list
is still populated from the preparation phase.

Reported-by: Václav Zindulka &lt;vaclav.zindulka@tlapnet.cz&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_tables: fix set double-free in abort path</title>
<updated>2019-03-08T15:41:18Z</updated>
<author>
<name>Pablo Neira Ayuso</name>
<email>pablo@netfilter.org</email>
</author>
<published>2019-03-07T23:58:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=40ba1d9b4d19796afc9b7ece872f5f3e8f5e2c13'/>
<id>urn:sha1:40ba1d9b4d19796afc9b7ece872f5f3e8f5e2c13</id>
<content type='text'>
The abort path can cause a double-free of an anonymous set.
Added-and-to-be-aborted rule looks like this:

udp dport { 137, 138 } drop

The to-be-aborted transaction list looks like this:

newset
newsetelem
newsetelem
rule

This gets walked in reverse order, so first pass disables the rule, the
set elements, then the set.

After synchronize_rcu(), we then destroy those in same order: rule, set
element, set element, newset.

Problem is that the anonymous set has already been bound to the rule, so
the rule (lookup expression destructor) already frees the set, when then
cause use-after-free when trying to delete the elements from this set,
then try to free the set again when handling the newset expression.

Rule releases the bound set in first place from the abort path, this
causes the use-after-free on set element removal when undoing the new
element transactions. To handle this, skip new element transaction if
set is bound from the abort path.

This is still causes the use-after-free on set element removal.  To
handle this, remove transaction from the list when the set is already
bound.

Joint work with Florian Westphal.

Fixes: f6ac85858976 ("netfilter: nf_tables: unbind set in rule from commit path")
Bugzilla: https://bugzilla.netfilter.org/show_bug.cgi?id=1325
Acked-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_tables: nat: merge nft_masq protocol specific modules</title>
<updated>2019-03-01T13:36:59Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2019-02-28T11:02:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a9ce849e786787af4b7dffd48d49b97b04671f8c'/>
<id>urn:sha1:a9ce849e786787af4b7dffd48d49b97b04671f8c</id>
<content type='text'>
The family specific masq modules are way too small to warrant
an extra module, just place all of them in nft_masq.

before:
  text	   data	    bss	    dec	    hex	filename
   1001	    832	      0	   1833	    729	nft_masq.ko
    766	    896	      0	   1662	    67e	nft_masq_ipv4.ko
    764	    896	      0	   1660	    67c	nft_masq_ipv6.ko

after:
   2010	    960	      0	   2970	    b9a	nft_masq.ko

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_tables: nat: merge nft_redir protocol specific modules</title>
<updated>2019-03-01T13:36:58Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2019-02-28T11:02:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c78efc99c75089efd3df2ebd3bd279b52b4ab125'/>
<id>urn:sha1:c78efc99c75089efd3df2ebd3bd279b52b4ab125</id>
<content type='text'>
before:
 text	   data	    bss	    dec	    hex	filename
 990	    832	      0	   1822	    71e nft_redir.ko
 697	    896	      0	   1593	    639 nft_redir_ipv4.ko
 713	    896	      0	   1609	    649	nft_redir_ipv6.ko

after:
 text	   data	    bss	    dec	    hex	filename
 1910	    960	      0	   2870	    b36	nft_redir.ko

size is reduced, all helpers from nft_redir.ko can be made static.

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: conntrack: avoid same-timeout update</title>
<updated>2019-02-27T09:58:21Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2019-02-21T14:38:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cc16921351d8ba1eabc1923fd61d4f369fadde56'/>
<id>urn:sha1:cc16921351d8ba1eabc1923fd61d4f369fadde56</id>
<content type='text'>
No need to dirty a cache line if timeout is unchanged.
Also, WARN() is useless here: we crash on 'skb-&gt;len' access
if skb is NULL.

Last, ct-&gt;timeout is u32, not 'unsigned long' so adapt the
function prototype accordingly.

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nat: remove nf_nat_l3proto.h and nf_nat_core.h</title>
<updated>2019-02-27T09:54:08Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2019-02-19T16:38:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d2c5c103b1337f590b7edf1509a6e294bdf22402'/>
<id>urn:sha1:d2c5c103b1337f590b7edf1509a6e294bdf22402</id>
<content type='text'>
The l3proto name is gone, its header file is the last trace.
While at it, also remove nf_nat_core.h, its very small and all users
include nf_nat.h too.

before:
   text    data     bss     dec     hex filename
  22948    1612    4136   28696    7018 nf_nat.ko

after removal of l3proto register/unregister functions:
   text	   data	    bss	    dec	    hex	filename
  22196	   1516	   4136	  27848	   6cc8 nf_nat.ko

checkpatch complains about overly long lines, but line breaks
do not make things more readable and the line length gets smaller
here, not larger.

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nat: remove l3proto struct</title>
<updated>2019-02-27T09:53:57Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2019-02-19T16:38:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d6c4c8ffb5e54b0516742f3386ea9e329e019455'/>
<id>urn:sha1:d6c4c8ffb5e54b0516742f3386ea9e329e019455</id>
<content type='text'>
All l3proto function pointers have been removed.

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nat: remove csum_recalc hook</title>
<updated>2019-02-27T09:53:47Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2019-02-19T16:38:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dac3fe72596f91011afc649a9d181b18466dd895'/>
<id>urn:sha1:dac3fe72596f91011afc649a9d181b18466dd895</id>
<content type='text'>
We can now use direct calls.

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
</feed>
