public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Saritha Yellanki" <ysaritha@broadcom.com>
To: "Marcos Del Puerto" <mpuertog@gmail.com>
Cc: ecos-discuss <ecos-discuss@ecos.sourceware.org>
Subject: RE: [ECOS] RE: Security issue with bsd stack
Date: Fri, 03 Apr 2009 14:50:00 -0000	[thread overview]
Message-ID: <3B0AC7A3DE042D478300B74F7E21C1281028E31328@SJEXCHCCR01.corp.ad.broadcom.com> (raw)
In-Reply-To: <270dc33e0904010359v2f3f449eg931ea426514f2a68@mail.gmail.com>

Hi  Marcos Del Puerto,

Thank you for your inputs. We have made the change and it is fine.

 ..................................................
 /*
   * Now, copy old ip header (without options)
   * in front of icmp message.
   */
  if (m->m_data - sizeof(struct ip) < m->m_pktdat)
   {
    diag_printf("error: icmp len!\n");
    m_free(m);
    goto freeit;
    /*  panic("icmp len"); */

   }
 ..............................................

With this change , we have tested it. And it works fine. We sent traffic to the system ( ran the tool)  for substantial  amount of time. We did not see any issues.

Thanks  a lot.
Saritha.


-----Original Message-----
From: Marcos Del Puerto [mailto:mpuertog@gmail.com] 
Sent: Wednesday, April 01, 2009 4:29 PM
To: Saritha Yellanki
Cc: ecos-discuss
Subject: Re: [ECOS] RE: Security issue with bsd stack

A capture of the datagram which caused the error with wireshark or
some other sniffer could be useful. Anyway IMHO the solution would be
as follows:

* Short answer: Replace panic("icmp len") with a logging function
(printf of whatever), then a call to freeit and finish the function
execution with return.

*Explanation: In the BSD TCP/IP stack m->m_data would point to the IP
header and m->m_pktdat to 16 (ethernet header) or 72 bytes (ethernet
header + IP options) before m_data . If (m->m_data - sizeof(struct ip)
< m->m_pktdat) I would say that the IP header was malformed and wasn't
properly parsed in the m_buf so IMHO you can discard it and not
sending the ICMP message. (I think Linux, for example,  expects that
the original datagram's header is properly formed, otherwise no ICMP
answer is sent).

I hope it helps.

Best regards,
Marcos Del Puerto

On Tue, Mar 31, 2009 at 8:33 PM, Saritha Yellanki <ysaritha@broadcom.com> wrote:
>  More info on the ISIC can be found at <http://www.packetfactory.net/projects/ISIC/>
>
> Thanks
> saritha
>
>
> -----Original Message-----
> From: Saritha Yellanki
> Sent: Tuesday, March 31, 2009 11:59 PM
> To: 'ecos-discuss'
> Subject: Security issue with bsd stack
>
> Hi All,
>
> I am testing our ecos system  with bsd tcp/ip stack with ISIC tool (ISIC -- IP Stack Integrity Checker)  and found an issue as mentioned below
>
> Description:
>
> (ISIC is a suite of utilities to exercise the stability of an IP Stack and its component stacks (TCP, UDP, ICMP et. al.) It generates piles of pseudo random packets of the target protocol. The packets be given tendancies to conform to. Ie 50% of the packets generated can have IP Options. 25% of the packets can be IP fragments... But the percentages are arbitrary and most of the packet fields have a configurable tendancy.)
>
> When  we send stream of packets  using the command  "tcpsic -s 10.10.10.10,23 -d 10.10.10.100 -I 100" ,our system hangs ,and we  observed that  the  code ( panic ("icmp len") )  highlighted  below was hit , when  we run the above test case
>
> What should be the correct behaviour?
> Could you please give your inputs or opinion on how to handle this case ?
>
> Thanks
> saritha
>
> Details of the Panic message
> ============================
> In  the file "src/sys/netinet/ip_icmp.c"
>
> /*
>  * Generate an error packet of type error
>  * in response to bad packet ip.
>  */
> void
> icmp_error(n, type, code, dest, destifp)
>  struct mbuf *n;
>  int type, code;
>  n_long dest;
>  struct ifnet *destifp;
>
> {
>  register struct ip *oip = mtod(n, struct ip *), *nip;
>  register unsigned oiplen = IP_VHL_HL(oip->ip_vhl) << 2;
>  register struct icmp *icp;
>  register struct mbuf *m;
>  unsigned icmplen;
>   .......
>   ..........
>
>     /*
>   * Now, copy old ip header (without options)
>   * in front of icmp message.
>     if (m->m_data - sizeof(struct ip) < m->m_pktdat)
>       panic("icmp len");                                                   //////////////////////////////////////////  This PANIC OCCURED when the test case was run  //////////////////////////////////
>
>  ..............
>  ............
>
> }
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>
>



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

      reply	other threads:[~2009-04-03 14:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 13:53 [ECOS] running ecos application on redboot Atilay Yilmaz
2009-03-30  6:58 ` Andrew Lunn
     [not found] ` <3B0AC7A3DE042D478300B74F7E21C1281027D3D51E@SJEXCHCCR01.corp.ad.broadcom.com>
2009-04-01 10:59   ` [ECOS] RE: Security issue with bsd stack Marcos Del Puerto
2009-04-03 14:50     ` Saritha Yellanki [this message]

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=3B0AC7A3DE042D478300B74F7E21C1281028E31328@SJEXCHCCR01.corp.ad.broadcom.com \
    --to=ysaritha@broadcom.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=mpuertog@gmail.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).