4

For this question, please assume I have followed every possible security measure to secure my Linux server. Only I have access to the web server via one open SSH port. If there are security issues then that's a separate issue.

I'm using a cloud server - which I believe is server virtualisation.

Now, I take my brilliantly secured server and I set a file/folder to 777 that's NOT publicly accessible (e.g. a cache folder for a server-side framework).

777 I believe allows 'world' access, but because I'm the only person that can access the server then does it matter that I set the folder to 777 world access?

I'm guessing if the file was in the public area of a web server then this wouldn't be a good idea, but I can't see an issue if it's in the non-public area. In fact, surely I could 777 every non-public file and rely on the fact that only I have access anyway? Of course I'm not going to so this, but my point is surely that file permissions are superseded by the fact nobody else can access the server anyway.

Also, does it make a difference that I'm using server virtualisation? Is this less secure? Can other people who are sharing the same server as me see my files because I'm using 777 permission?

Basically I often get file permission problems when the server-side framework's code needs to write to folders (e.g. cache). 777 fixes it every time, but I want to ensure that I'm making the best decision and not just taking the easy way out.

7

Under the premise that the system is so well-secured that there is only one person which can connect to it via network, then file permissions do not really matter anymore. The operating system can only enforce them against local users anyway. When an attacker can not log into the system or influence some public service running on the machine to do their biddings, they won't be able to access files, even when they are world-readable.

But this premise is illusory.

When you run a webserver on the box or some other service which can be accessed by other people, this services becomes an attack surface. An unknown vulnerability in the webserver (or in a buggy web application running on the webserver) could allow an attacker to take full control of the webservers process. The attacker can then access any file the webserver can access. That's why you usually run a webserver under its own user and use file permissions to make sure that this user can only read and write the files it has to for operating that webserver. When the worst case happens and an attacker indeed takes over the webserver, any damage is contained to the files and directories directly relate to it. But when file permissions allow the webserver to read, write and execute any file on the machine, an attacker can literally replace the whole operating system and lock you out.

When you use virtualization, the host-system can access anything which happens in your virtual machine anyway. File permissions won't be enforced, because the attack would bypasses the operating system which runs in the VM and directly access the virtual hard drive file in the filesystem of the host machine.

  • Thanks. I'll set up file permissions correctly. It all makes sense now. – user2143356 Apr 8 '14 at 18:14
1

First of all, it should be noted that virtualization is not a security measure in any way. This is an infrastructure / application technology, and it won't protect you from being compromised.

Generally speaking, using chmod 777 to address application issues (log writing, cache etc.) is not a viable solution. You might want to understand what is going wrong and fix it properly using appropriate file / directory permissions.

Also, you should not consider that because something is not public, it can't be accessed. An attacker will not follow your rules and security principles, and many attacks actually rely on bypassing security privileges, accessing unauthorized resources etc.

I would strongly encourage you to read more documentation such as:

amongst many others...

  • Thanks a lot for a detailed answer. I've edited my question as I don't think it was clear enough. Does this change your answer? – user2143356 Apr 8 '14 at 17:16
  • Oh, forgot to mention. I'm going to set up file permissions the correct way (seems easier and less to worry about in long run), but I'm still keen to know the answer to this question as I can't see how 777 can be an issue anyway (based on my setup). – user2143356 Apr 8 '14 at 17:19
0

A good analogy to your question would be airport security. There are only a limited number of entry points which a person can use to enter a secure area. But is the secure area really secure? Consider this:

My point is: you cannot any assumptions about security. Put up as many layers as you can to raise the hurdles that an intruder has to go through.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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