Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've been asked to create a PHP environment on a web-server I administer that is currently only running Python applications. The authors of these applications don't necessarily have a programming background, so I'd like to limit what they can possibly do wrong.

I'm using Ubuntu 9.04, and know that I should have register_globals disabled, but what else can/should I restrict?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Here is a list of things that I was about to type up. There are other things you can do, like Suhosin, but the first link is a good start to this.

share|improve this answer
1  
In Ubuntu, apt-get install php-suhosin will get you that. –  staticsan Aug 31 '09 at 23:13
    
It is still working for me.. –  Josh Brower Aug 30 '11 at 13:37

As you can't really trust your app developers to write secure code, you'll have to limit the attack vectors non-secure php code could provide. Using user input without proper sanitizing as SQL or as an argument to open() are classic examples of things that go wrong.

My brief list:

  • put the php environment inside a chroot jail, to limit the risks to the host.
  • make sure the php apps don't access the same databases which are used otherwise.
  • rate-limit (and monitor) outgoing mail. If there's a way to send email with user-specified content and address, some spammer will sooner or later find and exploit it.

I'm sure there are plenty of other things I either don't know about or I can't remember any more.

There are also plenty of stuff you as an administrator can't prepare for. For example, it's very hard to control cross-site scripting risks and to make sure mechanics inside the apps don't encourage any malicious use cases, such as using the app as a drop box for bad stuff like rootkits.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.