|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-19 02:20 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 07:00:01 2025 UTC |
Description: ------------ When calling posix_get[e]gid() to drop root privledges, it does NOT logout of group=0(root). Please look VERY closely at the 'id' output from the script, you will see that the third section "groups=" shows that i am effectively still logged into group "0". It indeed sets the current process group id to 0, however, it does NOT completely DROP all group memeberships, as well PHP provides no "posix_initgroups()" so there is no way to call initgroups() on linux to re-init the group memeberships from /etc/group, which would effectively, or should, drop the group=0(root) membership. Reproduce code: --------------- <? system("id"); posix_setgid(500); posix_setegid(500); posix_setuid(500); posix_seteuid(500); system("id"); ?> Expected result: ---------------- [root@admin cluster]# php test.php uid=0(root) gid=0(root) groups=0(root) uid=500(cluster) gid=500(cluster) groups=500(cluster) [root@admin cluster]# Actual result: -------------- [root@admin cluster]# php test.php uid=0(root) gid=0(root) groups=0(root) uid=500(cluster) gid=500(cluster) groups=0(root) [root@admin cluster]#