Re: Smarty Built-in Function PHP
| From: | Monte Ohrt | Date: | Thu, 17 May 2001 20:06:15 +0000 |
| Subject: | Re: Smarty Built-in Function PHP | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-774@lists.php.net to get a copy of this message | ||
There are not really any template designer security precautions in
Smarty (yet). The $php_handling flag was created to let Smarty know how
to handle imbedded PHP. Not necessarily as a security precaution, but to
help make things easier, such as HTML that shows PHP source code without
having to escape everything.
Even without the new {php} tags, there are still _lots_ of holes in the
template language that allow template designers (or would be rogue
hackers) to execute PHP. For instance, variable modifiers. If one
doesn't exist, it handles it as a PHP function. Also {if ...}
statements. They are passed directly to the parser, so some fancy syntax
footwork could execute arbitrary php functions here.
To handle security issues would have to be done with another class
variable setting, such as $security_setting or something as such. We can
check for some things, but I'm sure it will be quite difficult to nail
everything down, if even possible.
So at the moment, a level of trust needs to be assumed to the person(s)
editing the templates. If you really want a safe third party method of
editing templates, create a web driven interface that doesn't allow them
to touch templates directly. ;)
Andreas Kossmeier wrote:
>
> hi,
>
>
> http://www.phpinsider.com/php/code/Smarty/docs/x587.htm#BUILTIN.FUNCTION.PHP
>
> i just recognized, that version 1.4.0 allows embedding php code
> regardless of the $php_handling setting through the function {php}.
>
> even if you set $php_handling to SMARTY_PHP_REMOVE, you now can execute
> php code on the server. maybe you should give a hint in your docs that
> you have to unregister the function to prevent template designers from
> executing php code, it may be a security issue in some cases.
>
> greetings,
> andreas