Commit 1c2df20d authored by Brian Pane's avatar Brian Pane
Browse files

Fix for suexec execution of CGI scripts from mod_include

(including security patch to ensure that <!--#include file="name.cgi"-->
is run as the suexec user rather than the httpd user)
PR: 7791, 8291
Submitted by: Colm MacCarthaigh <colmmacc@redbrick.dcu.ie>
Reviewed by:	Brian Pane


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95290 13f79535-47bb-0310-9956-ffa450edef68
parent a6f5676a
Loading
Loading
Loading
Loading
+3 −0
Changes for CHANGES: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
Changes with Apache 2.0.37
  *) Fix suexec execution of CGI scripts from mod_include.
     PR 7791, 8291  [Colm MacCarthaigh <colmmacc@redbrick.dcu.ie>]
  *) Fix segfaults at startup on some platforms when mod_auth_digest,
     mod_suexec, or mod_ssl were used as DSO's due to the way they
     were tracking the current init phase since DSO's get completely
+1 −1
Changes for modules/filters/mod_include.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1263,7 +1263,7 @@ static int handle_include(include_ctx_t *ctx, apr_bucket_brigade **bb,
                                    "in parsed file %s";
                    }
                    else {
                        rr = ap_sub_req_lookup_file(parsed_string, r, f->next);
                        rr = ap_sub_req_lookup_uri(parsed_string, r, f->next);
                    }
                }
                else {
+12 −3
Changes for os/unix/unixd.c: 12 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -350,16 +350,25 @@ static apr_status_t ap_unix_create_privileged_process(
	    }
    }
    /* allocate space for 4 new args, the input args, and a null terminator */
    newargs = apr_palloc(p, sizeof(char *) * (i + 5));
    newargs = apr_palloc(p, sizeof(char *) * (i + 4));
    newprogname = SUEXEC_BIN;
    newargs[0] = SUEXEC_BIN;
    newargs[1] = execuser;
    newargs[2] = execgroup;
    newargs[3] = apr_pstrdup(p, progname);

    i = 0;
    /*
    ** using a shell to execute suexec makes no sense thus
    ** we force everything to be APR_PROGRAM, and never
    ** APR_SHELLCMD
    */
    if(apr_procattr_cmdtype_set(attr, APR_PROGRAM) != APR_SUCCESS) {
        return APR_EGENERAL;
    }

    i = 1;
    do {
        newargs[i + 4] = args[i];
        newargs[i + 3] = args[i];
    } while (args[i++]);

    return apr_proc_create(newproc, newprogname, newargs, env, attr, p);