Re: Usage of eval()
| From: | Justin Patrin | Date: | Mon, 15 Aug 2005 19:59:46 +0000 |
| Subject: | Re: Usage of eval() | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-2874@lists.php.net to get a copy of this message | ||
On 8/15/05, Tobias Schlitt <tobias@schlitt.info> wrote:
> Hi all!
>
> After having XML_RPC finally freed from evil eval() I tried searching
> the CVS for calls to it. The results of my grep can be found here:
>
> http://www.schlitt.info/misc/eval_usage.txt
>
> There are many cases we can actually leave unconsidered (like
> DB_DataObjects, since I completly trust in Alan, and HTML_Progress2,
> since this is JavaScript coder where eval() is used.
>
> Would be nice if all of you can pick a package and examine the lines
> spit out by grep to look if one can replace evil eval() with something
> else. (Don't get me wrong, there are indeed places where eval() maybe
> secure, but actually it can cause more harm than any other function and
> should be replaced wherever possible).
>
The DB_DO uses should be perfectly ok. The stuff in DataObject.php
gets around problems with re-implementing functions and classes and
syntax differences between PHP4 and 5. There is *no* user input in
there.
The Generator.php eval usage is for creating classes I believe and
could very well have code inclusion vulnerabilities, but it's not user
input per-se. It uses ini file values and table/field names. No user
data. Since this is almost always dev-created this isn't that bad, but
perhaps a bit of sanity checking should be put into place (if it's not
already there). I think at least some fo the fields are checked,
though.
--
Justin Patrin