Mailing List Archive

httpd security holes
> On Sat, 11 Mar 1995, Robert S. Thau mentioned two paches in apache-pre:
>> patch.security-CERT --- CERT security patch
>> patch.security-NCSA --- NCSA security patch
>
> I changed httpd.h from
>
> #define MAX_STRING_LEN HUGE_STRING_LEN
>
> to
>
> #if defined(MEMHOGBUTSECURE)
> #define MAX_STRING_LEN HUGE_STRING_LEN
> #else
> #define MAX_STRING_LEN 256
> #endif
>
> and added a comment to the top of the Makefile appropriately.


I'd rather not have this in the server, for a couple reasons.

1) It does not completely fix the scribble bug -- I have no idea why
CERT thinks it would, but if you look at the code carefully the
temporary variable needs to be MAX_STRING_LEN+HUGE_STRING_LEN in
order to hold a maximal replacement. Even with that, it is possible
(I think) to create an internal replacement loop that will blow out
any length if the server has been misconfigured.

2) Even if it did fix that bug, it does not make the overall server "secure".

The only real solution to (1) is a rewrite of the utility calls such
that they never increase the length of a string without checking the
string's bounds. As I said earlier, this means fixing in util.c:

strsubfirst() -- dest is growing (even with the obfuscated patch)
http2cgi() -- w is growing
escape_shell_cmd() -- cmd is growing
escape_url() -- url is growing
escape_uri() -- ditto (why are there two identical copies?)
make_full_path() -- dst is growing

The only way to fix these is to change all of their calling routines
(and, in many cases, the parents and grandparents of those routines)
so that they include a MAX length value in the argument list.

That's just util.c (i.e., not including the bugs in translate_name and
unmunge_name).

Normally, I'd put my code where my mouth is (:-) and supply patches for
the appropriate changes. Unfortunately, I don't have the time right now
and probably won't until September (i.e. forever). In any case, the
changes would be so extensive that they would interfere with everyone
else's patches. However, I do *strongly* encourage someone to take on
this task and make it a high priority -- the server will not be secure
until it is done. HINT: this would be A GOOD PLACE FOR NCSA to FOCUS
its effort.

.......Roy
Re: httpd security holes [ In reply to ]
Date: Sun, 12 Mar 1995 00:27:54 -0800
From: "Roy T. Fielding" <fielding@avron.ics.uci.edu>

I'd rather not have this in the server, for a couple reasons.

1) It does not completely fix the scribble bug -- I have no idea why
CERT thinks it would, but if you look at the code carefully the
temporary variable needs to be MAX_STRING_LEN+HUGE_STRING_LEN in
order to hold a maximal replacement. Even with that, it is possible
(I think) to create an internal replacement loop that will blow out
any length if the server has been misconfigured.

It does not *completely* fix the scribble bug, but it makes it a whole
heck of a lot harder to exploit. In my book, that's worthwhile.

2) Even if it did fix that bug, it does not make the overall
server "secure".

Ummmm.... who said it did? Nothing we can do to the string handling
could possibly guarantee the absence of bugs elsewhere. That doesn't
mean that improving the string handling itself is a bad idea!

rst