Bug in security?
| From: | John Wards | Date: | Sat, 28 Jun 2003 14:37:41 +0000 |
| Subject: | Bug in security? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9787@lists.php.net to get a copy of this message | ||
I am busy doing a SMARTY app and have come across an issue with the
security, well the include directory oprion more than anything.
Within smarty.class there is a bit of code that looks like this (around
line: 1430)
if (substr(realpath($resource_name),0, strlen(realpath($curr_dir))) ==
realpath($curr_dir)) {
$_smarty_secure = true;
break;
}
I have put together a little bit of code to replicate what happens with in
smarty:
http://cms.octoberdevelopment.co.uk/test.php
http://cms.octoberdevelopment.co.uk/test.txt
(source)
For those who don't know smarty security, what it is trying to do is see if
that template file has permission to read the $resource_name file. The
directorys within the $dir array are the directories that it should be able
to read from. So if its able to read the file it should return true or in my
example code it should echo "What the hell".
Is this a bug or is it done by design?
Cheers
John Wards