QUOTE(sifu @ Oct 24 2005, 04:43 AM)

From my limited experience, I have seen that many common php applications require that some directories be made 777 to allow for a level of interactivity with site users.
Generally, PHP scripts will require setting a directory with 0777 permissions because *you* will create the directory, so it will be owned by you, but the PHP script needs to create or modify files in that directory (which could be something as innocent as a configuration file). If you own a directory, the only way you can allow a PHP script permission to create and modify files in a directory that the user 'nobody' does not own is for you to set the directory permissions to 0777.
QUOTE(sifu @ Oct 24 2005, 04:43 AM)

Or, in other words, what methods do people employ to upload things into those directories that we don't want them to, such as nasty scripts? I am asking from the point of view of how do I stop it ?
Allowing anonymous, untrusted users to upload anything to your account is a huge security risk. If you must allow them, restrict the extensions of files that they can upload (such as .jpg and .gif for pictures). If they can upload .html and .php files, you're just asking for your site to be hacked.
If your site accepts form data submitted from anonymous, untrusted users, make sure your code properly filters and escapes all fields that are submitted, so arbitrary commands and data cannot be injected into your script.
If you can, you should set up a separate directory for anonymous uploads that is not under your public_html directory where you can review what has been uploaded before allowing it onto your site.
If you're careless with your FTP account names and passwords, malicious code can be uploaded to your site via FTP as well.
Make sure you've installed the latest releases of popular scripts such as phpBB or phpNuke, so you have the latest security updates. Hackers frequently target insecure installations of various forum scripts, exploiting known security holes.
You should understand that the primary security risk of setting file and directory permissions to 0777 is that anyone with an account on the same server you're on theoretically can access those files and directories. However, TCH does a good job of screening customers, and if one of them does decide to do something malicious, they are quickly tracked down and their account is terminated.
Having a script on your account that allows anonymous, untrusted users to upload content to a directory that has 0777 permissions opens up that directory to not just other TCH customers on your server, but to anyone on the internet. Personally, I consider this an unacceptable risk and I won't run any scripts on my site that allow anonymous, untrusted users to upload content to my site.
Of the scripts you list, I do run a Coppermine photo gallery. I did not want any Coppermine directories or files to have 0777 permissions, so I
modified Coppermine to run as a CGI - meaning it runs under my user ID instead of as 'nobody', and I no longer need to have any directory with 0777 permissions. I don't allow anonymous users upload anything at all.
This is by no means a complete list - security is more of a continuing process than an end result.