Quote:
How things are in 1.x is historical rather than designed for security.
Incorrect! How things are in 1.0.x is historical only in the sense that it was based on legacy code written with a 1999 mindset. Both in terms of security AND functionality. Server security is really a seperate issue than PHP Security. Where the security was compromised was usually at the user level end because they either didn't have the tools the knowledge to set up their webspace and set the permissions in a secure way. Basically what I'm saying applies to users on shared and rented servers.
If you own your own server and have access to all the security tools of that server it is easy to lock down Joomla from attack as far as permissions go without hurting functionality. If every user was on his own server that he had full control of the only security issue would be specific PHP exploits that trick PHP into doing something you don't want it to do!
Quote:
1.x can be made fairly secure but only if:
* Every php file has the right magic incantations at the top.
.
This is true for any PHP program and not specific to Joomla!
Quote:
* php files aren't owned by the Apache process.
FALSE! Apache can securely own the files in fact it works better when it does! This is only an issue non shared servers since you need to seperate YOUR instance of apache from the other users! This is what the FTP Layer of 1.5 does!
Quote:
* All files except cache and a small number of others is 644.
True! but what we are actually saying is that any catchall chmod number is going to miss something! You have to be very specific for each folder involved when setting the proper chmod to use! and it will change depending on owner/group/world set up on each server! You could easily set up Apache and FTP into a group if you had a dedicated server and chmod 664 which would do the same under 1.0.X that 1.5 will give you with it's FTP layer!
Quote:
* Things like making administrator password protected are done.
Any extra hoop you make a hacker jump through will deter or delay any entry and give you a way to detect that attempt in progress!
Quote:
* Usernames and passwords are chosen carefully.
This is true for all password protection schemes it is not Joomla Specific.
Quote:
1.5 is designed so that more of J! can be outside web root and thus those parts can't be directly exploited.
Well no...as I was trying to convey was there is no need to put things outside the web root at all. Not if you have a system set up with proper permissions for each folder. It was problematical to get there under 1.0.X simply because you had two different accounts trying to write to files and folders but 1.5 simply added a feature that allows you to set both to use the same account!
So now you can set the owner to be the only account with power to write (and if you wanted for many files even remove public read) becuase both J! (apache) and FTP are now acting as a single user!
Quote:
Having writable directories outside web root means that any files written there can't be exploited because they can't be directly accessed from a browser.
Half correct....where it is is irrelevant! a write only folder in the root is just as unreadable as a write only folder above the root! The only difference is that apache can't access a file above the root on it's own! It will require some programming (and lots of it) to find and deal with any file it might find there and also police how that file is used!
This "Above the root" is more of a historical concept of securing. The issue isn't where it is the REAL issue is who has the right to do something in it? One user? (Owner) Two or more users (group)? or everyone?
You can just as easily make a folder inside the root that is readable by the public and only writeable by the owner and add your file policing code to the upload system. By limiting uploads to jpg and gif there is no way a php can get on the system! and even if they rename a php file to gif since they can not rename the file (which requires write privs) PHP will never parse it as a PHP!
Quote:
I got a bit lost about why having Joomla! write files as the FTP user AKA the owner is a GOOD THING apart from the obvious that one doesn't have to keep changing the owner back from the Apache user.
I touched on this above....
The most secure way of setting security is to limit what can be done to a single account!
the only security setting for a single account is OWNER! that means chmod 6##. the first number will be assigned to both FTP account and (your instance of) apache which means only YOU (via FTP) and YOUR install of Joomla will have the proper security account to do anything that could hurt your system. The other can be locked down tight so that the only way to write to a file or folder is as the owner! Now since one chmod number defines both accounts that need ownership you can shut off all the stuff the public does not need to see via permissions...that means you should technically be able to chmod 600 a good chunk of the filesystem and keep a writeable (by owner) folder readable to everyone else as you would do for the images folder!
The issue is that currently the first number in chmod sets permissions for the FTP account and you need to set another chmod number so that Joomla can do things in folders it is not the owner!
there are many ways around the problem under 1.0.x, but it depends on the server you are using...
If you are the only one on the server:
1 - Set Apache to owner of the entire web root. Since your instance of apache will be the only one on that server you will be relatively secure with only the usual PHP exploit as a potential hole (which is going to be there no matter what you do!)
2 - Leave FTP the owner but add the WWW group (varies from server to server) and set chmod 66X so that there are now two users who you can set permissions for while leaving everyone else locked down
3 - use suexec which acts similarly to the FTP layer in that Apache acts as a specific user for that instance and again allows you to lock down the everyone account!
If you are on a shared server it becomes much more difficult as many ISPs will not be willing to go that extra mile to give you a custom apache, PHP and user account settings needed for the fine tuning of good security! But it is possible....
1 - You should have access (via FTP, Shell or CPANEL) to the following:
- httpd or virtualdomain.conf
- php.ini
- suexec
2 - set suexec so that your instance of apache uses your FTP account to do file system business
3 - set PHP for proper security as advised by the devs in regards to J! security
4 - as on the dedicated server set chmod appropriatly so that only one account can do something dangerous!
Quote:
What else have I not understood?
I think your concentrating too much on the location of the files which is irrelevant. What is important is what you set in chmod and how you CAN set it for best security and lockdown.
You must fine tune read and write permissions for each folder and to do that you have to find a way to rip the permissions you need for Joomla to work from the EVERYONE (3rd number) of chmod and put them in either of the first two numbers of that setting!
The way to do that is to either assign it to owner or group. But before you can do that you also have to make sure that no other apache instance on that system (that is not in your control) can mess with your space!
this is problematical for users in a shared rented enviornment but quite easy for those of us with a dedicated or owned server.
In a shared eviornment you probably have not been given all the tools needed to accomplish this yourself...J! 1.5 attempts to put some of this control back into your hands by allowing you to define apache as the owner without making every instance of apache as owner of YOUR FILES!
If you own your own server you can easily make the setting changes to completly lock down J! filesystem from attack...
Simply make Apache owner or group or configure it to use the owner account (as J! 1.5 does for everyone!)
And here is a little tutorial on chmod and what it means....
command syntax
chmod ###
significance of each number
chmode OGE O=Owner G=Group E=Everyone else
each number O,G and E represent a binary code for what can be done....
rwe stands for Read Write Execute
000 0 - No access at all
001 1 - Execute access only
010 2 - Write Access only
011 3 - Write and Execute
100 4 - Read Only
101 5 - Read and Execute
110 6 - Read and Write
111 7 - Read Write and Execute
the suggested chmod 644 means the owner can read and write, Group and Everyone can only read!
This works well for things like images folder where you don't need to write a ton of policing code to show images. everyone can read these files but no one can write to them!
If J! (apache) is not the owner of this folder it can't write to this folder either...Many users set writeable to everyone which is a catch all and allows everyone to write leaving a major hole in security. By making Apache the owner somehow you can shut off write access to everyone and you are safe!
I've gotten a bit long here so I'll stop and try to answer any questions you may have after this.