Would you use a script that required globals to be turned on?
There are many projects that use registered globals without causing troubles, eg. osCommerce requires them, and I never heared of any security problem with that piece of software.
Bill Gates is my home boy
Gender:
Posts: 634
3957 credits Members referred : 2
« Reply #5 on: Jan 09, 2007, 11:21:40 PM »
As you may already know, I have been supporting the efforts being made for a new directory script phpLynx.
It came up in discussion yesterday that globals must be turned on to use the script. The script owner and head programmer were talking to someone who couldn't get the script to work and didn't want to turn globals on to get the script to work. When I asked about it the programmer explained that some folks worry as it can be a security risk, but that the risk has been somewhat resolved with later versions of php. The site owner simply said there was no risk.
I thought I would ask over here and get a perhaps more unbiased opinion as so many here are php gurus.
As you may already know, I have been supporting the efforts being made for a new directory script phpLynx.
It came up in discussion yesterday that globals must be turned on to use the script. The script owner and head programmer were talking to someone who couldn't get the script to work and didn't want to turn globals on to get the script to work. When I asked about it the programmer explained that some folks worry as it can be a security risk, but that the risk has been somewhat resolved with later versions of php. The site owner simply said there was no risk.
I thought I would ask over here and get a perhaps more unbiased opinion as so many here are php gurus.
If the script is fine (secure code) there should not be a problem. But writing scripts for "register_globals = on" is for lazy people an brings up problems in may cases (f.e. split vars with the same key name coming from different global arrays like $_GET and$_ POST)
A lot of shared hosting provider don't support this feature (in this case you have to convert all vars like provided by Nick somewhere here)
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8249
42481 credits Members referred : 3
« Reply #7 on: Jan 09, 2007, 11:39:34 PM »
Look what's going on. When registered globals is on, every get variable (?var=....) will be inserted in the script as an internal variavle ($var) That caused problems in the past. I am not sure what those problems were (maybe buffer overflow, or changing predefined vars?) but I am sure that there is no problem of using them. It is just olf fashioned as I said before.
And to be honest I still have sites that use registered globals (hope I wont get hacked for this )
Bill Gates is my home boy
Gender:
Posts: 634
3957 credits Members referred : 2
« Reply #10 on: Jan 10, 2007, 12:04:23 AM »
So, would you recommend if using a script that has globals on (assuming provider allows this) that is should be hosted in a hosting account by itself? Or is it OK with other sites?
from the manual: Whether or not to register the EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables.
there is a complete page about this...
Quote
Perhaps the most controversial change in PHP is when the default value for the PHP directive register_globals went from ON to OFF in PHP » 4.2.0. Reliance on this directive was quite common and many people didn't even know it existed and assumed it's just how PHP works. This page will explain how one can write insecure code with this directive but keep in mind that the directive itself isn't insecure but rather it's the misuse of it.
When on, register_globals will inject (poison) your scripts will all sorts of variables, like request variables from HTML forms. This coupled with the fact that PHP doesn't require variable initialization means writing insecure code is that much easier. It was a difficult decision, but the PHP community decided to disable this directive by default. When on, people use variables yet really don't know for sure where they come from and can only assume. Internal variables that are defined in the script itself get mixed up with request data sent by users and disabling register_globals changes this. Let's demonstrate with an example misuse of register_globals: