Re: dl() problems with 4.2.0
| From: | Markus Fischer | Date: | Mon, 06 May 2002 12:18:44 +0000 |
| Subject: | Re: dl() problems with 4.2.0 | ||
| References: | 1 2 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-5329@lists.php.net to get a copy of this message | ||
Hi,
ok, absolute paths should never work (security restrictions).
The string you pass to dl() is always appended to the default
path (which would be
/usr/local/lib/php/extensions/no-debug-non-zts-20010901 in
your case) and it's also checked for malicous use of '/'
slashes in the name (if I'm not wrong).
Were you running the tests from apache or CGI ?
Either way, can you provide a strace output which shows where
and how it tries to access the files on the system e.g.
strace -e trace=file -o file_io.log ~/path/php -f script.php
and put the file_io.log on some url (if you concerned about
privacy because of pathnames in the logfile, you can mail it
to me privately).
thanks,
- Markus
On Mon, May 06, 2002 at 11:39:13AM +0000, Russ Garrett wrote :
> Markus Fischer wrote:
>
> > Can you and/or someone else please double verify this?
> >
> > - Markus
> >
> >
> >
> OK here we go:
>
> My system is Linux 2.2 (glibc 2.1.3), Apache 1.3.24, with PHP 4.2.0
> loaded as DSO.
>
> $ ls -la
/usr/local/bin/php-config --extension-dir
> total 58
> drwxr-xr-x 2 root root 1024 May 5 17:28 .
> drwxr-xr-x 5 root root 1024 Apr 16 13:04 ..
> -rwxr-xr-x 1 root root 56186 May 5 17:35 rrdtool.so
>
>
> Ok, so now we run the following PHP script:
> <?php dl("rrdtool.so"); ?>
>
> And we get:
> Warning: Unable to load dynamic library './rrdtool.so' -
> ./rrdtool.so: cannot open shared object file: No such file or directory
> in /path/to/test.php on line 1
>
> Right, so let's try putting this in (/usr/local/bin/php-config
> --extension-dir is /usr/local/lib/php/extensions/no-debug-non-zts-20010901):
> <?php
> dl("/usr/local/lib/php/extensions/no-debug-non-zts-20010901/rrdtool.so"); ?>
>
> Returns:
> Warning: Unable to load dynamic library
> './/usr/local/lib/php/extensions/no-debug-non-zts-20010901/rrdtool.so' -
> .//usr/local/lib/php/extensions/no-debug-non-zts- 20010901/rrdtool.so:
> cannot open shared object file: No such file or directory in
> /path/to/test.php on line 1
>
> Finally we do:
> cp /usr/local/bin/php-config --extension-dir/rrdtool.so ./
>
> And it all works successfully.
>
> I've only tried this with rrdtool.so - so it could *concievably* be
> rrdtool.so not finding another SO - if so the error message given is a
> little cryptic. However, I doubt this is the case due to the "./"
> appended to the path by dl().
>
>
> Russ Garrett (russ@garrett.co.uk)
>
>
>
--
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"I'm not stupid, you know? :)" - Jani Taskinen