You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@attglobal.net> on 2003/02/19 20:12:38 UTC
[PATCH] call hook from sig_coredump
The attached patch changes sig_coredump to call a hook. In the fullness
of time, the ap_exception_info_t provided to the hook would contain any
and all relevant information available to a signal/exception handler
(e.g., siginfo_t on many Unix variants).
mod_whatkilledus.c is a pretty trim module, with no current ability to
deal with multi-threaded MPMs, but with relatively little code it puts
the hook to good use in order to log a synopsis of what was going on at
the time of the fatal exception.
Here is an example of information written by mod_whatkilledus, followed
by the real trace message written by the parent when it realizes that a
child has died:
Fatal signal 11 received in pid 6518:
Active request: GET /silly?fn=govrr
Client IP: 127.0.0.1
Local port: 8080
Connection aborted? no
[Wed Feb 19 13:56:04 2003] [notice] child pid 6518 exit signal
Segmentation fault (11), possible coredump in /home/trawick/apacheinst
Some of the obvious things to consider:
have common sig_coredump for Unix
let sig_coredump receive siginfo_t on platforms that support that
flavor, and store it in ap_exception_info_t
recognize a recursive call to sig_coredump and don't call the hook since
presumably a hook has itself segfaulted
have a way for module to know that the hook is available (I have no
plans to implement exception handlers and related hook on Win32 :) )
get some feeling that Win32 or other non-Unix platforms could represent
relevant info in ap_exception_info_t
Thoughts/concerns?
Re: [PATCH] call hook from sig_coredump
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 01:14 PM 3/3/2003, Bill Stoddard wrote:
>William A. Rowe, Jr. wrote:
>>At 12:30 PM 3/3/2003, Bill Stoddard wrote:
>>>I don't like the idea of enabling this hook at configure time. Why not add the hook and leave it to modules whether they want to use it or not?
>>
>>Because it is a potential security hole? The only individual who should choose to expose or prevent the hole would be the administrator who installs (and therefore probably built) Apache.
>
>That same admin controls which modules are loaded as well.
And they psychically know that a module is using this hook, or not,
as the case may be? I rather like the "permit this or not" level of
control by the Administrator, without relying on module authors.
The paranoid Admin is unlikely to trust either the application or loadable
modules anyways, so giving them as many overrides as possible to
reduce exploitable behavior is goodness.
>>>I don't see the value in crufting up configure more that it already is.
>>
>>Can we piggy-back such features into a single --unwise-but-useful configure option?
>
>Obviously not. If it is -really- unwise, then we should just not do it. I see no evidence that is the case though. How, exactly, could this hook be remotely and uniquely exploited?
Code running post-segv after a stack overflow is subject to any number
of 'side-effects', Mark could provide better pointers to exploit code than
I can. IIUC you propose this hook in the child that is segfaulting. If I've misunderstood and this is code in the parent after the child segfaults,
ignore my musings.
Bill
Re: [PATCH] call hook from sig_coredump
Posted by Jeff Trawick <tr...@attglobal.net>.
William A. Rowe, Jr. wrote:
> At 02:12 PM 3/3/2003, Justin Erenkrantz wrote:
>
> >We've had strong recommendations from security types in the past to
> remove sig_coredump entirely. -- justin
>
>
> Maybe that's the answer. One compile flag to eliminate the segv handler
> altogether, along with the proposed hook, or keep segv handling along with
> the hook. --segv-handler=enable|disable ???
so at startup we'd then have to chdir to whatever was specified by
CoredumpDirectory...
Re: [PATCH] call hook from sig_coredump
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 02:12 PM 3/3/2003, Justin Erenkrantz wrote:
>--On Monday, March 3, 2003 2:14 PM -0500 Bill Stoddard <bi...@wstoddard.com> wrote:
>
>>Obviously not. If it is -really- unwise, then we should just not do it. I
>>see no evidence that is the case though. How, exactly, could this hook be
>>remotely and uniquely exploited?
>
>We need to keep our signal handling code to a minimum since we can make no assumptions about the system integrity once we enter such routines. Allowing a hook to always be run by default seems like asking for trouble (because it'd be a global structure that might be susceptible to being maliciously overwritten).
>
>We've had strong recommendations from security types in the past to remove sig_coredump entirely. -- justin
Maybe that's the answer. One compile flag to eliminate the segv handler
altogether, along with the proposed hook, or keep segv handling along with
the hook. --segv-handler=enable|disable ???
No need for an in between 'one but not the other', at least I don't believe.
Bill
Re: [PATCH] call hook from sig_coredump
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Monday, March 3, 2003 2:14 PM -0500 Bill Stoddard <bi...@wstoddard.com>
wrote:
> Obviously not. If it is -really- unwise, then we should just not do it. I
> see no evidence that is the case though. How, exactly, could this hook be
> remotely and uniquely exploited?
We need to keep our signal handling code to a minimum since we can make no
assumptions about the system integrity once we enter such routines. Allowing
a hook to always be run by default seems like asking for trouble (because it'd
be a global structure that might be susceptible to being maliciously
overwritten).
We've had strong recommendations from security types in the past to remove
sig_coredump entirely. -- justin
Re: [PATCH] call hook from sig_coredump
Posted by Bill Stoddard <bi...@wstoddard.com>.
William A. Rowe, Jr. wrote:
> At 12:30 PM 3/3/2003, Bill Stoddard wrote:
>
>>Jeff Trawick wrote:
>>
>>>Justin Erenkrantz wrote:
>>>
>>>
>>>>--On Wednesday, February 19, 2003 2:12 PM -0500 Jeff Trawick
>>>>wrote:
>>>>
>>>>
>>>>>The attached patch changes sig_coredump to call a hook. In the
>>>>>fullness of time, the ap_exception_info_t provided to the hook
>>>>>would contain any and all relevant information available to a
>>>>>signal/exception handler (e.g., siginfo_t on many Unix variants).
>>>>
>>>>
>>>>Here's a compromise that I'd be willing to accept: you have to explictly
>>>>enable this hook at configure-time. Otherwise, this hook won't be
>>>>executed on a signal.
>>>
>>>Does anybody agree with Justin's compromise (i.e., if I put more effort into this direction am I going to find out that somebody doesn't think the compromise is conservative enough :) )?
>>
>>I don't like the idea of enabling this hook at configure time. Why not add the hook and leave it to modules whether they want to use it or not?
>
>
> Because it is a potential security hole? The only individual who should
> choose to expose or prevent the hole would be the administrator who
> installs (and therefore probably built) Apache.
That same admin controls which modules are loaded as well.
>
>
>>I don't see the value in crufting up configure more that it already is.
>
>
> Can we piggy-back such features into a single --unwise-but-useful
> configure option?
Obviously not. If it is -really- unwise, then we should just not do it.
I see no evidence that is the case though. How, exactly, could this hook
be remotely and uniquely exploited?
Bill
Re: [PATCH] call hook from sig_coredump
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 12:30 PM 3/3/2003, Bill Stoddard wrote:
>Jeff Trawick wrote:
>>Justin Erenkrantz wrote:
>>
>>>--On Wednesday, February 19, 2003 2:12 PM -0500 Jeff Trawick
>>> wrote:
>>>
>>>> The attached patch changes sig_coredump to call a hook. In the
>>>> fullness of time, the ap_exception_info_t provided to the hook
>>>> would contain any and all relevant information available to a
>>>> signal/exception handler (e.g., siginfo_t on many Unix variants).
>>>
>>>
>>>Here's a compromise that I'd be willing to accept: you have to explictly
>>>enable this hook at configure-time. Otherwise, this hook won't be
>>>executed on a signal.
>>
>>Does anybody agree with Justin's compromise (i.e., if I put more effort into this direction am I going to find out that somebody doesn't think the compromise is conservative enough :) )?
>
>I don't like the idea of enabling this hook at configure time. Why not add the hook and leave it to modules whether they want to use it or not?
Because it is a potential security hole? The only individual who should
choose to expose or prevent the hole would be the administrator who
installs (and therefore probably built) Apache.
>I don't see the value in crufting up configure more that it already is.
Can we piggy-back such features into a single --unwise-but-useful
configure option?
Bill
Re: [PATCH] call hook from sig_coredump
Posted by Bill Stoddard <bi...@wstoddard.com>.
Jeff Trawick wrote:
> Justin Erenkrantz wrote:
>
>> --On Wednesday, February 19, 2003 2:12 PM -0500 Jeff Trawick
>> wrote:
>>
>> > The attached patch changes sig_coredump to call a hook. In the
>> > fullness of time, the ap_exception_info_t provided to the hook
>> > would contain any and all relevant information available to a
>> > signal/exception handler (e.g., siginfo_t on many Unix variants).
>>
>>
>> Here's a compromise that I'd be willing to accept: you have to explictly
>> enable this hook at configure-time. Otherwise, this hook won't be
>> executed on a signal.
>
>
>
> Does anybody agree with Justin's compromise (i.e., if I put more effort
> into this direction am I going to find out that somebody doesn't think
> the compromise is conservative enough :) )?
>
I don't like the idea of enabling this hook at configure time. Why not
add the hook and leave it to modules whether they want to use it or not?
I don't see the value in crufting up configure more that it already is.
Bill
Re: [PATCH] call hook from sig_coredump
Posted by Jeff Trawick <tr...@attglobal.net>.
Justin Erenkrantz wrote:
> --On Wednesday, February 19, 2003 2:12 PM -0500 Jeff Trawick
> wrote:
>
> > The attached patch changes sig_coredump to call a hook. In the
> > fullness of time, the ap_exception_info_t provided to the hook
> > would contain any and all relevant information available to a
> > signal/exception handler (e.g., siginfo_t on many Unix variants).
>
>
> Here's a compromise that I'd be willing to accept: you have to explictly
> enable this hook at configure-time. Otherwise, this hook won't be
> executed on a signal.
Does anybody agree with Justin's compromise (i.e., if I put more effort
into this direction am I going to find out that somebody doesn't think
the compromise is conservative enough :) )?
Re: [PATCH] call hook from sig_coredump
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Wednesday, February 19, 2003 2:12 PM -0500 Jeff Trawick
<tr...@attglobal.net> wrote:
> The attached patch changes sig_coredump to call a hook. In the
> fullness of time, the ap_exception_info_t provided to the hook
> would contain any and all relevant information available to a
> signal/exception handler (e.g., siginfo_t on many Unix variants).
Here's a compromise that I'd be willing to accept: you have to
explictly enable this hook at configure-time. Otherwise, this hook
won't be executed on a signal. Doing a directive to execute the hook
isn't safe enough because someone could somehow trounce our variable
and call the hook. (Actually, I wish the whole cwd so the core ends
up in the right place were the same way.)
I'm afraid of a malicious SIGSEGV finding the right space to
trampoline off. We've seen it before. But, if they are only enabled
explicitly, I'd be a bit more comfortable because it requires an
active step to enable it.
We can give 'em the gun, and we can point 'em where the ammo is.
But, as long as we don't hand 'em a loaded gun... -- justin
Re: [PATCH] call hook from sig_coredump
Posted by Jeff Trawick <tr...@attglobal.net>.
Cliff Woolley wrote:
> On Wed, 19 Feb 2003, Jeff Trawick wrote:
>
>
> >The attached patch changes sig_coredump to call a hook. In the fullness
> >of time, the ap_exception_info_t provided to the hook would contain any
> >and all relevant information available to a signal/exception handler
> >(e.g., siginfo_t on many Unix variants).
> >...
> >Thoughts/concerns?
>
>
> Why do I fear this would be a security problem waiting to happen? :-/
I can't guess.
Assume that we have a bug such that a malicious user can cause us to
segfault at will. If some module implements the fatal exception hook
then what are you afraid that it will do that it couldn't have done in
any other hook?
Re: [PATCH] call hook from sig_coredump
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Wednesday, February 19, 2003 2:33 PM -0500 Cliff Woolley
<jw...@virginia.edu> wrote:
> On Wed, 19 Feb 2003, Jeff Trawick wrote:
>
>> The attached patch changes sig_coredump to call a hook. In the
>> fullness of time, the ap_exception_info_t provided to the hook
>> would contain any and all relevant information available to a
>> signal/exception handler (e.g., siginfo_t on many Unix variants).
>> ...
>> Thoughts/concerns?
>
> Why do I fear this would be a security problem waiting to happen?
> :-/
I was thinking the same thing. Executing code after a SEGV (or other
coredump situation) seems risky. -- justin
Re: [PATCH] call hook from sig_coredump
Posted by Cliff Woolley <jw...@virginia.edu>.
On Wed, 19 Feb 2003, Jeff Trawick wrote:
> The attached patch changes sig_coredump to call a hook. In the fullness
> of time, the ap_exception_info_t provided to the hook would contain any
> and all relevant information available to a signal/exception handler
> (e.g., siginfo_t on many Unix variants).
> ...
> Thoughts/concerns?
Why do I fear this would be a security problem waiting to happen? :-/
--Cliff