Re: openssh vulnerability

From: Robert A. Seace (ras_at_magrathea.com)
Date: 09/16/03

  • Next message: Steven M. Christey: "Re: [PAPER]: Integer array overflows."
    To: ffddfe@yahoo.com (Diode Trnasistor)
    Date: Tue, 16 Sep 2003 15:27:37 -0400 (EDT)
    
    

    In the profound words of Diode Trnasistor:
    >
    > In case you haven't been following it, on full
    > disclosure there's been some mention of a new ssh
    > vulnerability.
    >
    > The vulnerability is allegedly in the following
    > sniplet of code taken from buffer.c file of openssh
    > distrib:
    >
    [snip...]
    >
    > So all that's accomplished is not using the value
    > inside the buffer to be reallocated as the number of
    > bytes to allocate. It is now done with a new
    > variable.
    >
    > Is anyone familiar with what happens when you use
    > realloc like they are using originally (when using a
    > value instead the structure to reallocate as the
    > second value to realloc). I still fail to see how
    > this is a security problem, and would like it if
    > someone would explain it to me. Thanx :)

            I believe the problem lies in the fatal() calls... If you
    can force one of those to be done (the range check one or the
    ones inside xrealloc()), then one of the things fatal() does is
    call clean-up functions, and apparently one of those clean-up
    functions may call buffer_free() on that same buffer that's in
    the process of being grown... (I didn't track down all the
    clean-up functions to see if this really gets done, but that
    seems to be only possible concern I can think of...) And, for
    some reason (presumably to wipe sensitive info from RAM, though
    I tend to think it's a bit of overkill paranoia), buffer_free()
    memset()'s the buffer full of null bytes before freeing it...
    And, so for this buffer currently being grown, it would memset()
    using the new length that it's trying to grow to, however that
    space wouldn't actually be allocated for it, hence it'd write
    nulls off the end... But, as near as I can see, we're only
    talking about writing nulls... And, I'm not sure I see how it
    can be controlled in any reasonable way to actually allow anything
    more than crashing the thing (which it was already in the process
    of doing on its own, thanks to the fatal(), anyway!)... But,
    maybe someone else smarter or more devious than I has a way to
    make it execute code?? *shrug*

    -- 
    ||========================================================================||
    ||    Rob Seace    ||               URL              || ras@magrathea.com ||
    ||  AKA: Agrajag   || http://www.magrathea.com/~ras/ || rob@wordstock.com ||
    ||========================================================================||
    "You know, it's at times like this, when I'm trapped in a Vogon
     airlock with a man from Betelgeuse, and about to die of
     asphyxiation in deep space, that I really wish I'd listened to
     what my mother told me when I was young."
    "Why, what did she tell you?"
    "I don't know, I didn't listen."
            - The Hitchhiker's Guide to the Galaxy
    

  • Next message: Steven M. Christey: "Re: [PAPER]: Integer array overflows."

    Relevant Pages

    • Re: Buffer or Realloc?
      ... better to allocate memory and realloc it for the size of the what is ... between deciding to use a fixed size buffer or allocating memory ... Fixed size arrays are good for things that whose contents *CANNOT* ... becomes extremely small when I realloc it. ...
      (comp.lang.c)
    • Re: Buffer growing strategy?
      ... I'm looking into a buffer ... A very simple solution is to just call realloc for the new size ... The problem is not with the cost of an individual realloc ... If the allocator is a buddy system allocator there only be log n ...
      (comp.lang.c)
    • Re: Bug analysis
      ... char *ReadTextFile ... while (fgets(buffer, sizeof buffer, fp) { ... and in my view it /is/ a bug. ... Well, no, it is better to change the realloc. ...
      (comp.lang.c)
    • Re: Bug analysis
      ... char *ReadTextFile ... while (fgets(buffer, sizeof buffer, fp) { ... and in my view it /is/ a bug. ... Well, no, it is better to change the realloc. ...
      (comp.lang.c)