hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Disabling fopen("/etc/passwd","r");
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

Disabling fopen("/etc/passwd","r");

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-18-2007, 01:55 PM
b3nz b3nz is offline
WHT Addict
 
Join Date: Jun 2007
Posts: 118

Disabling fopen("/etc/passwd","r");


Hello,

I were seeing c99.php source code to know how it gets /etc/passwd file. it simply uses fopen() for this goal but I think fopen() is needed and I don't like it to be disabled in disabled_functions. I wonder how can I disable just fopen("/etc/passwd","r"); without doing any restriction to fopen function at all

any idea will be appreciated

Best Regards.

Reply With Quote


Sponsored Links
  #2  
Old 07-18-2007, 02:01 PM
Scott.Mc Scott.Mc is offline
Engineer
 
Join Date: Jan 2005
Location: Scotland, UK
Posts: 2,380
Theres no easy method to do this, infact to stop it opening that file specfically you would need to edit the php source.

That will will always be readable by all users on the system, theres nothing really bad about reading it.

The most effective way is going to be to use openbase_dir.

__________________
Server Management - AdminGeekZ.com
Infrastructure Management, Web Application Performance, mySQL DBA. Keep your servers online.
United Kingdom: *0800 8620073* // United States: *585 563 1729* // Australia: *02 9037 2448* // International: *+44.1412800134*
Scott Mcintyre

Reply With Quote
  #3  
Old 07-18-2007, 02:12 PM
SparkSupport SparkSupport is offline
Web Hosting Master
 
Join Date: May 2006
Posts: 646
Make sure that you have the entry open_basedir = "/home:/tmp:/usr" in your php.ini. See if it helps

__________________
SparkSupporT
http://sparksupport.com
sales@sparksupport.com
1- 408-335-0493

Reply With Quote
Sponsored Links
  #4  
Old 07-18-2007, 02:14 PM
b3nz b3nz is offline
WHT Addict
 
Join Date: Jun 2007
Posts: 118
open_basedir is enabled and has been set to /home:/tmp, I think open_basedir has no restriction to do with fopen().

you're right, there's nothing bad about reading passwd because the passwords will be saved as shadow in most servers but it could reveal user's home directory and etc . anyway, Thank you for your help

Reply With Quote
  #5  
Old 07-18-2007, 02:16 PM
b3nz b3nz is offline
WHT Addict
 
Join Date: Jun 2007
Posts: 118
Dear sparksupport, I've already set open_basedir to /home:/tmp

Reply With Quote
  #6  
Old 07-18-2007, 02:16 PM
Scott.Mc Scott.Mc is offline
Engineer
 
Join Date: Jan 2005
Location: Scotland, UK
Posts: 2,380
Quote:
Originally Posted by b3nz View Post
open_basedir is enabled and has been set to /home:/tmp, I think open_basedir has no restriction to do with fopen().

you're right, there's nothing bad about reading passwd because the passwords will be saved as shadow in most servers but it could reveal user's home directory and etc . anyway, Thank you for your help
If you define openbase_dir within the users virtualhost then yes it will have an effect because they will be unable to read anything outside of the path you specify.

__________________
Server Management - AdminGeekZ.com
Infrastructure Management, Web Application Performance, mySQL DBA. Keep your servers online.
United Kingdom: *0800 8620073* // United States: *585 563 1729* // Australia: *02 9037 2448* // International: *+44.1412800134*
Scott Mcintyre

Reply With Quote
  #7  
Old 07-18-2007, 02:23 PM
b3nz b3nz is offline
WHT Addict
 
Join Date: Jun 2007
Posts: 118
So why passwd is still readable for c99 ? That's why I got confused

Reply With Quote
  #8  
Old 07-18-2007, 02:25 PM
Scott.Mc Scott.Mc is offline
Engineer
 
Join Date: Jan 2005
Location: Scotland, UK
Posts: 2,380
Show me the openbase_dir entry for that virtualhost.

__________________
Server Management - AdminGeekZ.com
Infrastructure Management, Web Application Performance, mySQL DBA. Keep your servers online.
United Kingdom: *0800 8620073* // United States: *585 563 1729* // Australia: *02 9037 2448* // International: *+44.1412800134*
Scott Mcintyre

Reply With Quote
  #9  
Old 07-18-2007, 02:32 PM
b3nz b3nz is offline
WHT Addict
 
Join Date: Jun 2007
Posts: 118
That virtualhost got the same rules that has been set in php.ini

This result created by c99 itself :

Server security information:Open base dir: /home:/tmp

Get /etc/passwd

it means open_basedir is currently working on this site but passwd could be read by fopen()

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Mozilla Updates CA Certificate Policy for Software Products Web Hosting News 2013-02-19 12:32:22
Ruby on Rails Vulnerabilities Discovered, Users Urged to Update Immediately Web Hosting News 2013-01-10 11:05:11
cPanel Security Updates Address Perl Module Vulnerabilities Web Hosting News 2012-12-06 12:55:54
Thousands of Sites Mislabeled Phishers After OpenDNS Blocks Google Hosted Scripts Web Hosting News 2012-01-06 15:37:40
Hackers Breach San Francisco Transit Police Website to Expose Data Web Hosting News 2011-08-18 15:09:29


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?