buglwIP - A Lightweight TCP/IP stack - Bugs: bug #22692, TCP: Header length not checked to...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #22692: TCP: Header length not checked to be > 20

Submitted by:  Jared Grubb <jgrubb>
Submitted on:  Sat 22 Mar 2008 02:55:22 PM UTC  
 
Category:  TCP Severity:  6 - Security
Item Group:  Faulty Behaviour Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  None

Mon 24 Mar 2008 05:00:43 PM UTC, comment #4: 

Yes, it's true, but is it really one of the lwIP goal to check such values (this will increase -a  little- the code size)? Of course, the fix should be easy ans small. What about other headers checking? Is there something like that for them ? It doesn't seem there is something like this (a minimal lenght checking) in ip_input.

Frédéric Bernon <fbernon>
Project Member
Mon 24 Mar 2008 03:32:38 PM UTC, comment #3: 

The check Frederic mentions makes sure that there is room for a TCP header in general, but there is no explicit check that the field holding header length is valid (hdrlen must be >= 5). If hdrlen==0, for example, then the TCP header itself will be passed to the application/next layer as data.

Although I can't think of a way that this could be exploited, it is an error in functionality -- and it's easy to fix :).

Jared Grubb <jgrubb>
Project Member
Sat 22 Mar 2008 04:38:26 PM UTC, comment #2: 

I think it should be enough.

Simon Goldschmidt <goldsimon>
Project Administrator
Sat 22 Mar 2008 03:58:46 PM UTC, comment #1: 

I'm not sure, but the check line ~112-113 does this :

  /* remove header from payload */
  if (pbuf_header(p, -((s16_t)(IPH_HL(iphdr) * 4))) || (p->tot_len < sizeof(struct tcp_hdr))) {

the second part (evaluate after the pbuf_header) isn't enought ?

Frédéric Bernon <fbernon>
Project Member
Sat 22 Mar 2008 02:55:22 PM UTC, original submission:  

hdrlen = TCPH_HDRLEN(tcphdr);
if(pbuf_header(p, -(hdrlen * 4))){
...
}

There should be a check to make sure that hdrlen >= 5 (ie 20 bytes). The code currently checks whether the hdrlen given will overrun the whole packet, but does not verify that the value is a valid TCP header length.

Jared Grubb <jgrubb>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by fbernon (Posted a comment)
  • -email is unavailable- added by jgrubb (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-03-23 goldsimon StatusNone => Invalid
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.5