From: "Gael Mauleon" Subject: Concerning ULOG and the MAC logging bug Date: Thu, 5 Dec 2002 22:27:48 +0100 Sender: netfilter-devel-admin@lists.netfilter.org Message-ID: <003101c29ca5$289c8b40$0200a8c0@KevlarPC> Reply-To: "Gael Mauleon" Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_002E_01C29CAD.8A3D3EA0" Return-path: To: Errors-To: netfilter-devel-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: List-Id: netfilter-devel.vger.kernel.org This is a multi-part message in MIME format. ------=_NextPart_000_002E_01C29CAD.8A3D3EA0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I am new here so excuse me first for my bad english and then for all mistake i can make :)) So I found a bug in ULOG concerning the logging of MAC Address, = searching the list archive i found a patch from Harald Welte but I think a better = one can be=20 written in this, but since i am new to kernel/netfilter coding perhaps = that's not the way to do it ..... (ipt_ULOG.c) : --------------------------------------------- Line 210 pm =3D NLMSG_DATA(nlh); memset(pm, 0, sizeof(ulog_packet_msg_t)); =20 /* copy hook, prefix, timestamp, payload, etc. */=20 pm->data_len =3D copy_len; pm->timestamp_sec =3D (*pskb)->stamp.tv_sec; pm->timestamp_usec =3D (*pskb)->stamp.tv_usec;=20 pm->mark =3D (*pskb)->nfmark; pm->hook =3D hooknum; if (loginfo->prefix[0] !=3D '\0')=20 strncpy(pm->prefix, loginfo->prefix, = sizeof(pm->prefix)); =20 if (in && in->hard_header_len > 0 && (*pskb)->mac.raw !=3D (void *) (*pskb)->nh.iph && in->hard_header_len <=3D ULOG_MAC_LEN) { memcpy(pm->mac, (*pskb)->mac.raw, in->hard_header_len); pm->mac_len =3D in->hard_header_len;=20 }=20 if (in)=20 strncpy(pm->indev_name, in->name, = sizeof(pm->indev_name)); =20 if (out)=20 strncpy(pm->outdev_name, out->name, = sizeof(pm->outdev_name)); =20 if (copy_len)=20 memcpy(pm->payload, (*pskb)->data, copy_len);=20 ------------------------------------------------ Since the payload can also be exploited with wrong data , i would prefer = a memset solution like this to the else solution proposed. And we can then erase = all the else. Please let me know, what do you think of it. And let me know if there is a better way to tell about bugs and put some = code changes. Thx. ------=_NextPart_000_002E_01C29CAD.8A3D3EA0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi, I am new here so excuse me first = for my bad=20 english and then for all
mistake i can make :))
 
So I found a bug in ULOG concerning the = logging of=20 MAC Address, searching the
list archive i  found a patch from = Harald  Welte but I think a better one can be
written in this, but since i am new=20 to kernel/netfilter coding perhaps that's not the way = to
do it .....
 
(ipt_ULOG.c) :
 
---------------------------------------------
Line 210
 
        pm =3D=20 NLMSG_DATA(nlh);
        = memset(pm, 0,=20 sizeof(ulog_packet_msg_t));
 
     &n= bsp; =20 /* copy hook, prefix, timestamp, payload, etc. */=20
        pm->data_len =3D=20 copy_len;
        = pm->timestamp_sec =3D=20 (*pskb)->stamp.tv_sec;
       =20 pm->timestamp_usec =3D (*pskb)->stamp.tv_usec;=20
        pm->mark =3D=20 (*pskb)->nfmark;
        = pm->hook =3D=20 hooknum;
        if = (loginfo->prefix[0]=20 !=3D '\0')=20
           &nb= sp;   =20 strncpy(pm->prefix, loginfo->prefix,=20 sizeof(pm->prefix));
 
      =  =20 if (in && in->hard_header_len >=20 0
           =20 && (*pskb)->mac.raw !=3D (void *)=20 (*pskb)->nh.iph
        &nb= sp;  =20 && in->hard_header_len <=3D ULOG_MAC_LEN)=20 {
           &n= bsp;   =20 memcpy(pm->mac, (*pskb)->mac.raw,=20 in->hard_header_len);
       &nb= sp;       =20 pm->mac_len =3D in->hard_header_len;=20
        }
 
        if (in)=20
           &nb= sp;   =20 strncpy(pm->indev_name, in->name,=20 sizeof(pm->indev_name));
 
     &n= bsp; =20 if (out)=20
           &nb= sp;   =20 strncpy(pm->outdev_name, out->name,=20 sizeof(pm->outdev_name));
 
     &= nbsp; =20 if (copy_len)=20
           &nb= sp;   =20 memcpy(pm->payload, (*pskb)->data, copy_len);
------------------------------------------------
Since the payload can also be exploited = with wrong=20 data , i would prefer a memset
solution like this to the else solution = proposed.=20 And we can then erase all the else.
 
Please let me know, what do you think = of=20 it.
And let me know if there is a better = way to tell=20 about bugs and put some code changes.
 
Thx.
 
 
------=_NextPart_000_002E_01C29CAD.8A3D3EA0--