icon Learn how to get the most out of Surmunity - read our forum tips here! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » PHPsuexec » how do I disable phpsuexec?

PHPsuexec Information and tips

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old April 20th, 2006, 8:26 AM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in May 2005
8 posts
Gave thanks: 0
Thanked 0 times
how do I disable phpsuexec?

Hi,

I recently noticed that my surpass host has changed - now my php scripts run as me, rather than as user "apache". I presume this is a consequence of "phpsuexec" that I read about in these forums.

The impression I get is that phpsuexec is supposed to make things more secure.

However, my concern now is how do I use filesystem permissions to restrict permissions to my files? In the past, I just gave files perms 644 or 755, and since the php scripts run as "apache", they can only read and not write to those files.

With phpsuexec, how do I stop php scripts from potentially writing to my files? How do make sure a vulnerability in a php application won't blow out my mail folders in $HOME/mail ?

How do I disable phpsuexec?

Thanks.

Francis.
fhltang is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 20th, 2006, 4:13 PM   #2 (permalink)
I'm Dope as Crack
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in Asheboro, NC
Hosted on Pass 7
13,032 posts
Gave thanks: 7
Thanked 29 times
You can't disable it.

phpsuexec gives 644 and 755 permissions to files and folders automatically.
__________________
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 20th, 2006, 7:27 PM   #3 (permalink)
Registered User
Fresh Surpasser
 
Joined in May 2005
8 posts
Gave thanks: 0
Thanked 0 times
Unhappy

We'll I guess "can't" answers half my question.

The other question is, how do I protect my files? Perms 644/755 won't save me from a vulnerability in a php script anymore.

Worse still, not even 660 perms on my mail folders will prevent an incorrectly written php script possibly sending my mail folders over HTTP.

In the pre-phpsuexec days, at least I knew that 660 perms on my mail folders meant that php scripts can't read my mail folders, unless of course a sysadmin erroneously put apache into the "mail" group.

Am I the only one concerned about this?
fhltang is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 20th, 2006, 10:59 PM   #4 (permalink)
I'm Dope as Crack
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in Asheboro, NC
Hosted on Pass 7
13,032 posts
Gave thanks: 7
Thanked 29 times
Why is this permission suddenly bad? What made it good before phpsuexec? If you need something set lower than 644/755, than just log into the file manager and change the permissions lower. They will go lower, just not higher.

And the way to make sure your application won't do something crazy is to make sure the application won't do something crazy...permissions can be set to anything, but if your application isn't coded correctly than it can still screw up your stuff....with or without phpsuexec.
__________________
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 20th, 2006, 11:22 PM   #5 (permalink)
H
after g, before i
Super #1
 
H's Avatar
 
Joined in Jul 2004
Hosted on Gojira
7,870 posts
Gave thanks: 44
Thanked 127 times
The ownership permissions by the script means that it has the ability to write, delete or move files more easily. Code has a lot more freedom over the filesystem of your account, which makes it easier to exploit them.

For the same reason you don't need 0777 to upload files for your image galley, you don't need 0777 to upload a malicious file or to execute it.
H is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 20th, 2006, 11:24 PM   #6 (permalink)
I'm Dope as Crack
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in Asheboro, NC
Hosted on Pass 7
13,032 posts
Gave thanks: 7
Thanked 29 times
So then the answer is still "change the permission in file manager" and/or code correctly, right?
__________________
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 20th, 2006, 11:27 PM   #7 (permalink)
H
after g, before i
Super #1
 
H's Avatar
 
Joined in Jul 2004
Hosted on Gojira
7,870 posts
Gave thanks: 44
Thanked 127 times
What would changing the permissions in File Manager do? As far as I can see, you are still the owner of the folder or file.

Coding correctly is great, but everyone makes mistakes sometimes. There's oversight all the time. And if you use thirdparty scripts, you don't have much control over that.
H is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 20th, 2006, 11:36 PM   #8 (permalink)
I'm Dope as Crack
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in Asheboro, NC
Hosted on Pass 7
13,032 posts
Gave thanks: 7
Thanked 29 times
From the way I understand it, one of the only differences is that it labels something as you by your name, rather than your id. So why is it different? What prevents someone from doing the same thing without phpsuexec?

And depending on the permissions will depend on what the page does. I've given pages much lower permissions and have had them do nothing but throw permission errors at me.
__________________
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 21st, 2006, 12:20 AM   #9 (permalink)
H
after g, before i
Super #1
 
H's Avatar
 
Joined in Jul 2004
Hosted on Gojira
7,870 posts
Gave thanks: 44
Thanked 127 times
Without phpsuexec, PHP runs as nobody. With it, it runs as your username.

Under nobody, a PHP script can't move a file to folder with permissions 0755. Under your username and the folder as your username, it can.

So under phpsuexec, it cares about what first digit it where it otherwise would depend on one of the other two. Because it's running as the owner, it uses the owner permissions.

It could be 0700 and still do whatever it wanted through the PHP script.

And even if you did lower the permissions, the script would be able to change them rather easily through the chmod() function.

There's obviously benefits to running as phpsuexec, but it also lowers security in different areas.
H is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

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