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

To an extent, I understand the purpose of limiting permissions to just what is needed, but I don't have a complete grasp of the possible dangers of having them open. I'm most concerned with web servers.

Assume the absolute worst-case scenario of 777 permissions across the entire system. I can see that if there were a security breach, it would automatically be an escalation vulnerability. What else? This aside from the obvious which is other users on the system would have too much access.

Note: I'm not suggesting using loose permissions. I want to understand the dangers so I can better apply settings.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Note: I'm not a security researcher, so this could all be wildly inaccurate.

For a web server, especially a forum / blog / CMS that people can self-register on, loose permissions assist the following attack:

  1. Malicious user uploads script file / crafts URL that includes external script file
  2. System executes contents of script
  3. Malicious user 0wns system

Restricting file permissions can help with

  • prevention (scripts aren't executed)
  • mitigation (may help limit extent of damage)
  • auditing and cleanup (knowing which user/group should own what files allows you to identify what was compromised if things are out of place)
share|improve this answer

This site may show you an overall of issues etc http://packetstormsecurity.org/

So taking your example of a global 777 permission on your system, things that could happen are:

  1. rm -rf / or /etc/passwd or shadow
  2. users copying other users data and/or changing stuff within their domain
  3. users using your server for malicious end (such as ddos other sites)
  4. changing the data of passwd or shadow

I guess this much points out a lot already, it is just a DON'T DON'T ...

Ofc these were just examples there are a lot more things and 777 is not the only thing you should worry about there are plenty ways to gain access to your system.

Old applications that have known security issues for example.

share|improve this answer
    
Users with shell access to the system would then have access to run those commands, but I'm looking more at attack vectors from the web; that is, not a user who's directly logging on (or at least, not legitimately logging on). –  Zurahn Aug 9 '10 at 0:18

The worst case scenario of using 777 for file permissions on a folder or file is that if somehow a user is able to install a file (or modify an existing file) and use it to actually execute malicious code, they have gained the ability to possibly access the credentials you use for other services on your system, such as your database. All heck breaks loose then...

See this blog entry on File Permissions on web servers for more information (or just search on Google - quite a bit of evidence of what dangers exist when using loose file permissions is available).

Often the Apache server is 'owned' by the dhapache or nobody user accounts. These accounts have a limited amount of access to files on the server, for a very good reason. By setting your personal files and folders owned by your user account to be World-Writable, you are literally making them World Writable. Now the dhapache and nobody users that run your server, serving pages, executing php interpreters, etc.. will have full access to your user account files.

This provides an avenue for someone to gain access to your files by hijacking basically any process on your server, this also includes any other users on your machine. So you should think carefully about modifying permissions on your machine. I've never come across anything that needed more than 767, so when you see 777 ask why its necessary.

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.