Skip to contentSkip to conversation

ctnetlink expect dumping bug

DISCUSSION Harald Welte 2 participants 3 messages Jan 29, 2006 – Feb 1, 2006 netfilter

lore
Share & tools
lore
#0 lore raw

Hi!

While doing some nf_conntrack development, I hit a bug that I originally thought to be in my modifications.

However, after reverting all my patches, the bug persists.

The issue is that for dumping the expect mask, we use regular tuple dumping functions. Those regular dumping functions call proto_find_get and l3proto_find_get with protocol value 0xffff, which leads to an array overflow in those NPROTO sized arrays.

Rather than using the mask value, we'd need to pass the respective value from the expect tuple for dumping the expect mask.

From looking at the code, it seems the bug also exists in ip_conntrack_netlink, but I didn't really test it.

Pablo, would you please prepare a fix for this, and confirm it by having helpers create expectations inside the kernel while running 'conntrack -E' ?

Thanks.

p.s.: Patrick and me agreed last week to re-work the structure of an expectation (and its handling). Despite any of those (probably 2.6.17) changes, we need to fix this bug in the current upstream stable releases now.

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#1 lore raw

Hi!

Quoted 10 lines · Harald Welte

The issue is that for dumping the expect mask, we use regular tuple dumping functions. Those regular dumping functions call proto_find_get and l3proto_find_get with protocol value 0xffff, which leads to an array overflow in those NPROTO sized arrays.

Rather than using the mask value, we'd need to pass the respective value from the expect tuple for dumping the expect mask.

From looking at the code, it seems the bug also exists in ip_conntrack_netlink, but I didn't really test it.

No problem, ip_conntrack doesn't have the l3num field.

Quoted 3 lines

Pablo, would you please prepare a fix for this, and confirm it by having helpers create expectations inside the kernel while running 'conntrack -E' ?

I did, we're still discussing :). Anyway Patrick have workaround for this but it still remains a bit tricky. Please have a look at:

expectation mask handling in nfctnetlink (Was Re: [PATCH] fix nf_conntrack_netlink expectation dumping/event notification)

cheers,

Signature · 1 line
Pablo
#2 lore raw
Quoted 4 lines · Pablo Neira Ayuso
Quoted 2 lines

From looking at the code, it seems the bug also exists in ip_conntrack_netlink, but I didn't really test it.

No problem, ip_conntrack doesn't have the l3num field.

the same problem exists with the 'proto' field.

Quoted 6 lines
Quoted 3 lines

Pablo, would you please prepare a fix for this, and confirm it by having helpers create expectations inside the kernel while running 'conntrack -E' ?

I did, we're still discussing :). Anyway Patrick have workaround for this but it still remains a bit tricky. Please have a look at:

ok, I'll look at it.

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie