Page 1 of 1

secure webserver and CMS layout

Posted: Tue Jan 23, 2018 5:03 am
by phade

since Spectre and Meltdown everybody should have understood, thats its important to have a kernel and user space that cannot influence each other and that, as consequence, every CMS and blog software should also carefully separate its files, directories and permissions.

The FAQ for s9y states under
"In usual environments, your FTP user should be within the same group like your webserver user, so that you are able to modify files with the right umask. However, some providers might not think about that and thus deny you access to your own files."

Well, "usual" cannot be more wrong. Its far more secure to have a webserver running under a different user and group than the ftpuser.

Core files, like the blog's programm data, should only belong to the ftpuser, should only be writable by the ftpuser and readable by the webservers user. Only a few files and directories really need to be writable by the webserver itself (like temporary data).

Even if there might be a bug in whatever software package or plugin (might not even be a bug in s9y, but in another software packages residing on the same webserver) or whatever user password got lost, contents or files could only be changed under some places and the core files of s9y could not me modified at all.

In consequence its important the change the directory structure of s9y, rewrite the update mechanisms (by using ftp, sftp or scp to "localhost"), even WordPress understood this years ago.

BTW: its also a security problem, if the config file resides inside the document root.
Good provider have at least one directory accessible for the customer only via (s)ftp that could be read by the webserver locally and is outside the documentroot, so it cannot be accessed at all directly via the web. s9y should at least have the posibilty to store its config file there. Good systems seperate their files even more.

Re: secure webserver and CMS layout

Posted: Thu Jan 25, 2018 3:05 pm
by titanofold
I had made the same observation as I was getting Serendipity set up for the first time a couple days ago.

Roundcubemail has a dedicated folder (public_html) that's intended to be the document root.

Re: secure webserver and CMS layout

Posted: Thu Feb 22, 2018 10:56 am
by onli
Though I generally agree, it's not that easy.

Think about it feature-wise. What is needed is a way to upgrade plugins. For that you need to have a webserver that is able to overwrite plugin files. The moment you have that all other security measures in that direction are unimportant, it just does not matter whether an attacker that gets access via the webserver can write to core files or plugin files. Is there a solution for that?

We also have a plugin for updating the core, for that to work s9y needs to be able to overwrite its own files. I'd argue that making upgrades easier is more secure than making upgrades hard by the more complicated security config, overall.

I agree that the architecture could be changed to have a directory level before the rest of the application, and make that the space for the config file. On the other hand, supporting the upgrade scheme for that is likely to be error-prone, and it has to work in every apache webserver configuration. Note that by default the files are access-protected right now.

But if there are clever solutions for those issues, get in touch, participate in the development, I'll happily merge PRs and help discuss changes beforehand.

Re: secure webserver and CMS layout

Posted: Mon Mar 12, 2018 1:04 pm
by garvinhicking
One thing to keep in mind too is that most PHP applications need to write temporary data; with an exploit, as soon as a single file can be written on a webserver (even temporary data with a temporary directory) you can inject malicious code into those files, no matter where they are, and usually then load/execute that code. So even if you restrict all but one directory from being writable, you can still be attacked, but you lose all features that onli described; so adjusting the webserver not being able to write to certain files is rather more security by obscurity but wouldn't really prevent an attacker from executing his injected code...

Having said that, if we can actually improve things and I am misreading it, I'm very much open to specific suggestions, too! :-)