Skip to contentSkip to conversation

ICMP DNAT bug fix no longer applies?

DISCUSSION Chris Wilson 4 participants 5 messages Apr 24, 2003 – Apr 28, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

Hi all,

Since the ICMP DNAT advisory came out last year
[http://www.iptables.org/security/2002-04-02-icmp-dnat.html], we have been applying this patch to all kernels we build. However, in between patch-o-matic 20030107 and 20030422 this has been broken and no longer applies.

I think the culprit is submitted/11_inner-icmp-translation-fix.patch, with the following change:

- if (info->manips[i].hooknum == opposite_hook[hooknum]) {
+ if (info->manips[i].hooknum == hooknum) {

Since the ICMP DNAT bugfix wants to change the same line to:

+ if (map_innards(info->manips[i].hooknum, hooknum)) {

the patch does not apply.

The map_innards function appears to expect the hooknum to be the opposite_hook:

+static inline int
+map_innards(unsigned int maniphook, unsigned int hooknum) +{
+ return (maniphook == opposite_hook[hooknum]
+ || (hooknum == NF_IP_LOCAL_OUT
+ && HOOK2MANIP(maniphook) == IP_NAT_MANIP_SRC));
+}

It is only called from that one place, so changing the first condition to "return (maniphook == hooknum)" should make the logic of that test equivalent to the patched logic put in place by 11_inner-icmp-translation-fix.patch. However, I'm not sure what change, if any, should be made to the second test for consistency.
Can anyone shed some light on this?

Does anyone know why the DNAT bug fix hasn't been incorporated into the main codebase yet?

Cheers, Chris.

Signature · 4 lines
   ___ __     _
 / __// / ,__(_)_  | Chris Wilson -- UNIX Firewall Lead Developer |
/ (_ / ,\/ _/ /_ \ | NetServers.co.uk http://www.netservers.co.uk |
\ _//_/_/_//_/___/ | 21 Signet Court, Cambridge, UK. 01223 576516 |
#1 lore raw

Hi all!

Quoted 2 lines · Chris Wilson

Does anyone know why the DNAT bug fix hasn't been incorporated into the main codebase yet?

AFAIK, this patch was too intrusive into the IP layer of the linux kernel to be included.

But I've seen this some times ago :

Summary of changes from v2.4.21-pre5 to v2.4.21-pre6
============================================

[...]

<[email protected]>:
o [NETFILTER]: fix NAT ICMP reply translation of inner packet
[...]

I see that as the so long waited fix. Harald, do you confirm that ?

Signature · 4 lines
Philippe Biondi <biondi@ cartel-securite.fr> Cartel Sécurité
Security Consultant/R&D                      http://www.cartel-securite.fr
Phone: +33 1 44 06 97 94                     Fax: +33 1 44 06 97 99
PGP KeyID:3D9A43E2  FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2
#2 lore raw
Quoted 2 lines · Philippe Biondi

AFAIK, this patch was too intrusive into the IP layer of the linux kernel to be included.

yup.

Quoted 5 lines

But I've seen this some times ago :

Summary of changes from v2.4.21-pre5 to v2.4.21-pre6
============================================

Quoted 8 lines

[...]

<[email protected]>:
o [NETFILTER]: fix NAT ICMP reply translation of inner packet
[...]

I see that as the so long waited fix. Harald, do you confirm that ?

It is a fix two two or more related ICMP bugs. And it should also fix the old DNAT information leak.

Would be happy if anyboudy could explicitly test and verify that.

Quoted 1 line

Philippe Biondi <biondi@ cartel-securite.fr> Cartel Sécurité

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.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
#3 lore raw
In reply to Chris Wilson
Quoted 7 lines · Chris Wilson

Hi all,

Since the ICMP DNAT advisory came out last year
[http://www.iptables.org/security/2002-04-02-icmp-dnat.html], we have been applying this patch to all kernels we build. However, in between patch-o-matic 20030107 and 20030422 this has been broken and no longer applies.

This is becaue this bug should now finally have disappeared from all future kernels ;)

Quoted 2 lines

Does anyone know why the DNAT bug fix hasn't been incorporated into the main codebase yet?

The reason was that the solution at that time was too intrusive into the core ipv4 stack to be applied by David Miller.

What we now have is a probably unclean solution, that mangles the same stuff in a packet twice :( But this was necessarry for yet another number of ICMP NAT bugs (see bugzilla)

Quoted 1 line

Cheers, Chris.

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.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
#4 lore raw
Quoted 15 lines · Harald Welte
Quoted 7 lines · Chris Wilson

Hi all,

Since the ICMP DNAT advisory came out last year
[http://www.iptables.org/security/2002-04-02-icmp-dnat.html], we have been applying this patch to all kernels we build. However, in between patch-o-matic 20030107 and 20030422 this has been broken and no longer applies.

This is becaue this bug should now finally have disappeared from all future kernels ;)

Quoted 2 lines

Does anyone know why the DNAT bug fix hasn't been incorporated into the main codebase yet?

Quoted 6 lines

The reason was that the solution at that time was too intrusive into the core ipv4 stack to be applied by David Miller.

What we now have is a probably unclean solution, that mangles the same stuff in a packet twice :( But this was necessarry for yet another number of ICMP NAT bugs (see bugzilla)

Which bugzilla bug do you mean? Assuming you mean bug#55, the patch I've submitted does not mangle packets twice. Instead of doing packet mangling at two different hooks as it was done originally (hook and its opposite hook), it does it one go, but translation is not performed twice. (or there's something I don't see)

Signature · 2 lines
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1