21, November 2008

Question for you php Gurus about security... - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Question for you php Gurus about security...
« previous next »
Pages: [1] Print

Author Topic: Question for you php Gurus about security...  (Read 895 times)
Bill Gates is my home boy
*****
Gender: Female
Posts: 634
3957 credits
Members referred : 2



« on: Jan 07, 2007, 10:24:53 PM »

Is it a security risk to turn  register_globals ON and why?

www.yourmessageconsultant.com Visit through proxy, providing online content and printed marketing materials.
www.helpforwebbeginners.com Visit through proxy, Tutorials and how to's for new  webmasters.
www.CraftyTips.com Visit through proxy, a unique Arts & Crafts Directory
www.nocans.com Visit through proxy - Pet Food Recipe Site
www.petsiteguides.com Visit through proxy - A New Pet Directory

Last blog : The Twenty Million Dollar Blog Entry
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8249
42481 credits
Members referred : 3



« Reply #1 on: Jan 07, 2007, 10:30:30 PM »

Not really. It is just old fashion programming.

I can't think of a security problem due to registered globals.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6439
39458 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Jan 07, 2007, 11:51:43 PM »

there are risks if the scripts is bad coded,

some unvalidated $var can be replaced with some url like www.domain.com/?var=bad_value Visit through proxy

I learned never use register_globals!!!


Last blog : Just a better Internet portal provided by Google
Bill Gates is my home boy
*****
Gender: Female
Posts: 634
3957 credits
Members referred : 2



« Reply #3 on: Jan 09, 2007, 08:37:54 PM »

Interesting, mixed results from you two.

Would you use a script that required globals to be turned on?

www.yourmessageconsultant.com Visit through proxy, providing online content and printed marketing materials.
www.helpforwebbeginners.com Visit through proxy, Tutorials and how to's for new  webmasters.
www.CraftyTips.com Visit through proxy, a unique Arts & Crafts Directory
www.nocans.com Visit through proxy - Pet Food Recipe Site
www.petsiteguides.com Visit through proxy - A New Pet Directory

Last blog : The Twenty Million Dollar Blog Entry
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8249
42481 credits
Members referred : 3



« Reply #4 on: Jan 09, 2007, 08:45:59 PM »

Interesting, mixed results from you two.

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.

In which script are you reffering to?

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Bill Gates is my home boy
*****
Gender: Female
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 Visit through proxy.

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.

www.yourmessageconsultant.com Visit through proxy, providing online content and printed marketing materials.
www.helpforwebbeginners.com Visit through proxy, Tutorials and how to's for new  webmasters.
www.CraftyTips.com Visit through proxy, a unique Arts & Crafts Directory
www.nocans.com Visit through proxy - Pet Food Recipe Site
www.petsiteguides.com Visit through proxy - A New Pet Directory

Last blog : The Twenty Million Dollar Blog Entry
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6439
39458 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: Jan 09, 2007, 11:37:48 PM »

As you may already know, I have been supporting the efforts being made for a new directory script phpLynx Visit through proxy.

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)


Last blog : Just a better Internet portal provided by Google
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
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 Smiley (hope I wont get hacked for this Smiley )

BTW check this tutorial if you can't set registered globals on : http://www.webdigity.com/index.php?action=tutorial;code=39 Visit through proxy

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6439
39458 credits
Members referred : 374


It's time to use PHP5!


« Reply #8 on: Jan 10, 2007, 12:01:53 AM »

Nick not only GET vars...


Last blog : Just a better Internet portal provided by Google
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8249
42481 credits
Members referred : 3



« Reply #9 on: Jan 10, 2007, 12:02:58 AM »

Nick not only GET vars...

Right, $_GET and $_POST Wink

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Bill Gates is my home boy
*****
Gender: Female
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?

www.yourmessageconsultant.com Visit through proxy, providing online content and printed marketing materials.
www.helpforwebbeginners.com Visit through proxy, Tutorials and how to's for new  webmasters.
www.CraftyTips.com Visit through proxy, a unique Arts & Crafts Directory
www.nocans.com Visit through proxy - Pet Food Recipe Site
www.petsiteguides.com Visit through proxy - A New Pet Directory

Last blog : The Twenty Million Dollar Blog Entry
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8249
42481 credits
Members referred : 3



« Reply #11 on: Jan 10, 2007, 12:08:02 AM »

I don't think you will have any problem in either case.

Just check the version of PhP that runs to your system. If it is 4.4.4 or higher you are fine for sure Smiley

You can check this with :

Code:
<?php
    phpinfo
();
?>


Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6439
39458 credits
Members referred : 374


It's time to use PHP5!


« Reply #12 on: Jan 10, 2007, 12:11:01 AM »



Right, $_GET and $_POST Wink

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:
http://www.php.net/manual/en/security.globals.php Visit through proxy


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=5510
Tags : php security Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Question for you php Gurus about security...
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 21, 2008, 03:50:41 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.728
Total Topics: 7.649
Total Members: 4.391
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: davous

35 Guests, 5 Users online :

21 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.