Skip to content

Commit

Permalink
added setgroups before setuid
Browse files Browse the repository at this point in the history
  • Loading branch information
luizluca committed Jul 3, 2014
1 parent 2e3f648 commit c3fc945
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ static int base_init()
}

if (instance.user) {
/* This executable is calling setuid and setgid without setgroups or initgroups.
* There is a high probability this mean it didn't relinquish all groups, and
* this would be a potential security issue to be fixed. Seek POS36-C on the web
* for details about the problem. */
setgroups(0, NULL);
if (setuid(uid) < 0) {
log_errno(LOG_ERR, "setuid(%i)", uid);
goto fail;
Expand Down

0 comments on commit c3fc945

Please sign in to comment.