Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws array access of type bool error in chroot jail #31

Closed
rgpublic opened this issue Sep 4, 2020 · 0 comments
Closed

Throws array access of type bool error in chroot jail #31

rgpublic opened this issue Sep 4, 2020 · 0 comments

Comments

@rgpublic
Copy link

rgpublic commented Sep 4, 2020

_writeHeaderBlock in vendor/pear/archive_tar/archive/tar.php contains:

        if (function_exists('posix_getpwuid')) {
            $userinfo = posix_getpwuid($v_info[4]);
            $groupinfo = posix_getgrgid($v_info[5]);

            $v_uname = $userinfo['name'];
            $v_gname = $groupinfo['name'];
        } else {
            $v_uname = '';
            $v_gname = '';
        }

But posix_getpwuid can in fact return false in a chroot jail. This unfortunately isn't documented here:

https://www.php.net/posix_getpwuid

But someone in the comments writes:

If You are useing kernel security module, such as LIDS, GrSec or Selinux it will work only if '/etc/passwd' is readable for user, under which PHP/Apache runs, otherwice you get FALSE.

In my case it's a chroot jail that's preventing access to /etc/passwd.

It would be nice if v_uname and v_gname could be set to an empty string in this case - just like it's done anyway in the else case.

@mrook mrook closed this as completed in 8dd8b31 Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant