hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Apache Nobody Security Hole
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

Apache Nobody Security Hole

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-30-2003, 01:23 AM
Alex042 Alex042 is offline
Web Hosting Master
 
Join Date: Oct 2002
Location: MO, USA
Posts: 1,104
Exclamation

Apache Nobody Security Hole


I think I may have briefly touched on this issue before, but have now found what I was looking for in a brief investigation. One of the things that pushed this investigation was this issue: http://www.webhostingtalk.com/showth...ght=mysql+sock that just affected one of the servers I'm hosted on. Evidentially Apache had removed the required mysql file or more precisely 'nobody' removed the file so no php/mysql page would load and my sites were dead in the water. Fortunately the answer was here on WHT to fix the this issue and my host had given me the necessary rights so I was able to fix the immediate issue and my host followed up on that to secure it.

After some brief testing and some quick code writing following this incident, what I've found is that with 1 line of code, a php script running as nobody can assume whatever rights nobody has so if nobody has rights to remove a file then so can the person running the php script. I was able to create this 1 liner in a matter of seconds. Hosts need to be aware, if not already, that this may be an issue. One possible solution we're testing is chowning some files to root so nobody doesn't have access to change them.

It gets really frustrating when my sites go down because of issues like this so hopefully this fix will be somewhat permanent and we don't have to go through it again.

We already have SUEXEC installed which seems to work ok but I hate to have to recommend PHPEXEC when it seems to have some incompatibilities.


Last edited by Alex042; 07-30-2003 at 01:39 AM.
Reply With Quote


Sponsored Links
  #2  
Old 07-30-2003, 01:39 AM
sigma sigma is offline
Community Guide
 
Join Date: Apr 2001
Location: Pittsburgh, PA
Posts: 1,303
Re: Apache Nobody Security Hole

Quote:
Originally posted by Alex042
I think I may have briefly touched on this issue before, but have now found what I was looking for in a brief investigation. One of the things that pushed this investigation was this issue: http://www.webhostingtalk.com/showth...ght=mysql+sock that just affected one of the servers I'm hosted on. Evidentially Apache had removed the required mysql file or more precisely 'nobody' removed the file so no php/mysql page would load and my sites were dead in the water. Fortunately the answer was here on WHT to fix the this issue and my host had given me the necessary rights so I was able to fix the immediate issue and my host followed up on that to secure it.

After some brief testing and some quick code writing following this incident, what I've found is that with 1 line of code, a php script running as nobody can assume whatever rights nobody has so if nobody has rights to remove a file then so can the person running the php script. I was able to create this 1 liner in a matter of seconds. Hosts need to be aware, if not already, that this may be an issue. One possible solution we're testing is chowning some files to root so nobody doesn't have access to change them.
Lots of hosts pretend that user-written scripts can't access anything on the server that Apache can. Hosts don't like to talk about it. Clients don't understand it. It's the elephant in the living room.

Having said that, why do you think user nobody was able to remove /tmp/mysql.sock? If /tmp is chmod 1777 and mysql.sock was a symlink made by root, that wouldn't be possible. Certainly it's a bad idea to have *anything* critical to the system be owned by nobody.

Kevin

Reply With Quote
  #3  
Old 07-30-2003, 01:41 AM
i am a i am a is offline
Web Hosting Guru
 
Join Date: Nov 2000
Location: Vancouver, BC
Posts: 283
agreed, it's a known problem (php as nobody) but it can be mitigated with some careful thinking of who owns what.

but yes, definitely no excuse to run the tmp directory without a sticky bit, or to launch mysql as "nobody"

Reply With Quote
Sponsored Links
  #4  
Old 07-30-2003, 01:44 AM
Alex042 Alex042 is offline
Web Hosting Master
 
Join Date: Oct 2002
Location: MO, USA
Posts: 1,104
Quote:
Having said that, why do you think user nobody was able to remove /tmp/mysql.sock? If /tmp is chmod 1777 and mysql.sock was a symlink made by root, that wouldn't be possible. Certainly it's a bad idea to have *anything* critical to the system be owned by nobody.
I'm not sure why it was owned by nobody but in the reply from my host after it was replaced, he stated that the logs showed it was owned by nobody and that nobody had removed it.

Reply With Quote
  #5  
Old 07-30-2003, 06:04 AM
mpope mpope is offline
Web Hosting Master
 
Join Date: May 2001
Posts: 697
yep, this is a problem with php and nobody owning it... I mean the whole point of the user "nobody" is to allow anyone access to a certain set of scripts which should be non-vital anyway (this could probably be debated )

Anyway... mysql.sock shouldn't be owned by nobody... that's pretty much just completely negligent...

Reply With Quote
  #6  
Old 07-30-2003, 02:27 PM
magnafix magnafix is offline
Web Hosting Master
 
Join Date: Apr 2001
Location: Montana USA
Posts: 673
<troll>
mod_php should not be run on a shared system.
</troll>



Seriously though, this is not so much a problem of PHP, but of offering server-side scripting on a shared system, at all... unless you can do chrooted CGI. Numerous threads have debated this topic on WHT over the past year or two.

__________________
John Masterson
Former Hosting Company Owner


Last edited by magnafix; 07-30-2003 at 02:35 PM.
Reply With Quote
  #7  
Old 07-30-2003, 05:53 PM
chirpy chirpy is offline
Web Hosting Guru
 
Join Date: Jun 2002
Posts: 271
<quote>unless you can do chrooted CGI</quote>

Which can give you a false sense of security, it's in no way infallible.

The only realsitic solution in a shared environment is to use SuExec, PHPExec and setup correct *nix file and directory permissions.

__________________
Jonathan Michaelson (cPanel Forum Moderator and developer of csf)

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Recovery and Antivirus/AntiSpam Services http://www.configserver.com


Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Apache Continues to Dominate Web Server Market in Netcraft May Survey Web Hosting News 2013-05-06 14:29:02
Researchers Urge System Admins to Check for New Apache Web Server Backdoor Malware Web Hosting News 2013-05-01 11:35:53
The Apache Software Foundation Launches Hadoop v1.0 Web Hosting News 2012-01-05 18:29:16
Oracle is the Latest Vendor to Apply Patch for Apache Killer Flaw Web Hosting News 2011-09-19 14:43:58
Patch Released for Apache Software DDoS Vulnerability Web Hosting News 2011-08-26 15:03:10


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?