Current location: Hot Scripts Forums » Programming Languages » PHP » PHP security issue


PHP security issue

Reply
  #1 (permalink)  
Old 03-28-06, 04:19 AM
nitro4file nitro4file is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
PHP security issue

Hi Everyone,

have something that got throught my mind and wanted to have you opinions, it's about security as title tells

1.can someone uses require() or inlcude(), to get a remote file,

example require("http://programingtalk/vb/lib/config.inc.php"); ??

2. Should all post/get made with php carry addslashes() ?

3. and last what are the basic precausion one should take in regards to security issue while writing a script which connect to sql or just a script.

Thanks for your reply in advance

Cheers
Nitro
Reply With Quote
  #2 (permalink)  
Old 03-28-06, 06:21 AM
koncept
Guest
 
Posts: n/a
i would definately do addslashes() i dont knwo about the rest
Reply With Quote
  #3 (permalink)  
Old 03-28-06, 07:04 AM
Barnz1986 Barnz1986 is offline
Aspiring Coder
 
Join Date: Jan 2006
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by nitro4file
Hi Everyone,

have something that got throught my mind and wanted to have you opinions, it's about security as title tells

1.can someone uses require() or inlcude(), to get a remote file,

example require("http://programingtalk/vb/lib/config.inc.php"); ??

2. Should all post/get made with php carry addslashes() ?

3. and last what are the basic precausion one should take in regards to security issue while writing a script which connect to sql or just a script.

Thanks for your reply in advance

Cheers
Nitro
About the require() and include(), Yes they can be included in other websites remotely, But the PHP is still exectued on your web server.

So basically they wont see the PHP in the file, and wont have access to any of your variables within the file, they will still just get the HTML output.
Reply With Quote
  #4 (permalink)  
Old 03-28-06, 01:36 PM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
If the file was a .inc or so, then they can...

Look at it this way, If you can see the page source in your browser window, then so will everyone else, whether or not they include or require it remotely..
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Reply With Quote
  #5 (permalink)  
Old 03-28-06, 02:18 PM
SwitchBlade SwitchBlade is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
1) If it is on another web server then it will be the equivelant of using file_get_contents() on a file on another server.

2) I generally dont put addSlashes() on anything I just turned on magic quotes via the php.ini
__________________
I program in HTML, JavaScript, CSS, PHP, MySQL, and Visual Basic
I Coded This Board System From Scratch
Reply With Quote
  #6 (permalink)  
Old 03-28-06, 02:31 PM
koncept
Guest
 
Posts: n/a
can you tell me more about magic quotes? what if you do not have access to php.ini is there a way to turn them on or are you left with add slashes?
Reply With Quote
  #7 (permalink)  
Old 03-28-06, 06:58 PM
Christian's Avatar
Christian Christian is offline
Community VIP
 
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
Quote:
Originally Posted by koncept
can you tell me more about magic quotes? what if you do not have access to php.ini is there a way to turn them on or are you left with add slashes?
I would just use the addslashes(), magic quotes can be a pain in the butt....But if you still want to enable magic quotes, I think you can use a .htacces file if you don't have access to your php.ini(not really sure how tho).
__________________
:: ImperialBB :: New version in the works! :: http://www.imperialbb.com ::

:: Have a question about the board? The Rules? An Infraction/Warning? :: Contact Form ::
Reply With Quote
  #8 (permalink)  
Old 03-28-06, 07:13 PM
koncept
Guest
 
Posts: n/a
thank you, thats good to know.
Reply With Quote
  #9 (permalink)  
Old 03-28-06, 07:49 PM
wiremind wiremind is offline
Newbie Coder
 
Join Date: May 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by koncept
can you tell me more about magic quotes? what if you do not have access to php.ini is there a way to turn them on or are you left with add slashes?
You cant turn magic quotes on without php.ini You are also better off using mysql_real_escape_string . addslashes only escapes according to what PHP defines, not what your database driver defines.
__________________
Online Dating Software
Reply With Quote
  #10 (permalink)  
Old 03-30-06, 05:29 AM
nitro4file nitro4file is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Hi All,

so i can require a or include a remote file, that mean if i request a remote file e.g db.inc.php on any server and run my own local apache server with Mysql i can easily see through my logs which username the has try to access my DB and at the same time see encript password, that then means with some work i get the password and username(without efforts) of a remote host and can get in there data!!

That scary! would the possible security breach be solve with a CHMOD? if yes which one? meaning noone can run the said config file except the server itself, but then when a user connect doesn't it has some kind of confusion ??

Thanks to everyone for your reply and interest on the subject

Cheers
Nitro
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Content Management: High Security mary Script Requests 1 01-07-06 09:26 AM
FYI: Shout goes out over PHP security bugs nugensoftware PHP 0 11-01-05 11:43 PM
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
MAJOR php security threat. nickvd PHP 0 12-17-04 05:42 PM
PHP scripts security khibinite PHP 2 10-23-03 06:13 AM


All times are GMT -5. The time now is 07:06 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.