You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Nigel Cole <N....@sc98c.demon.co.uk> on 1999/01/27 16:40:41 UTC
mod_cgi/3784: CGI scripts not executed if gid not equal to server's gid
>Number: 3784
>Category: mod_cgi
>Synopsis: CGI scripts not executed if gid not equal to server's gid
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache
>State: open
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Wed Jan 27 07:50:00 PST 1999
>Last-Modified:
>Originator: N.Cole@sc98c.demon.co.uk
>Organization:
apache
>Release: 1.3.4
>Environment:
Solaris 2.6, Generic_105181-05
gcc 2.8.0
>Description:
This is an expansion of PR 2580: I have a cgi-bin script which is executable
by a group the webserver belongs to, but which is different to the group the
server is running as. Apache won't execute it. I'm not using suexec.
MULTIPLE_GROUPS isn't being set by default, so Apache only checks permissions
using its own group id, decides it can't run it (in ap_can_exec in util.c,
called from cgi_handler in mod_cgi.c), and gives a confusing error message
("file permissions deny server execution" even though, as far as the OS is
concerned, the server is permitted to execute it).
I tried recompiling with MULTIPLE_GROUPS set (though I'm uncomfortable about
doing this since I can't find any references to it), and Apache still
refused to run the script. A look at http_main.c revealed that the array
group_id_list is only set when geteuid() returns 0 (ie running as root).
>How-To-Repeat:
No example URL, but it's easy to repeat: just change the permissions on a
cgi-bin script to 750 and put it in a group that the server belongs to but
doesn't run as.
>Fix:
Set MULTIPLE_GROUPS?
Also, move the "#ifdef MULTIPLE_GROUPS" block of code in set_group_privs (in
http_main.c) outside the "if (!geteuid())" block.
(These changes appear to work, but I haven't searched the code to find any
unwanted side-effects.)
Not a fix, but the error message would be a lot clearer if it reported
something like "cannot execute: not in server's group".
A work-round for those of us who need scripts restricted to a different group
is to use the directory permissions to limit access, since Apache only
considers the file permissions.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED. This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request ]
[from a developer. ]
[Reply only with text; DO NOT SEND ATTACHMENTS! ]