开发者

Loose directory/file permissions: pitfalls, security issues?

开发者 https://www.devze.com 2023-02-15 15:06 出处:网络
My question is rather theoretical than practical but i think you can answer it :) What are the main (security) issues when a public folder/file has permissions like 777?

My question is rather theoretical than practical but i think you can answer it :)

What are the main (security) issues when a public folder/file has permissions like 777? How can anyone take advantage of a poorly configured file permission? Can anyone use this weakness via http for example?

Is it a bad practice t开发者_开发知识库o make a folder writable both httpd and ftp?

Thanks in advance, fabrik


The short answer is: don't do that.

The long answer is: it depends.

It all depends on how this file is used, and even how the system itself is used. If it is a file that no one wants to read then it doesn't really matter if anyone can write to it. On the other hand if it is a file that is executed by the server (PHP, Perl script etc.) or is sent to the client (a template, HTML, JavaScript) then the attacker can put there an arbitrary malicious code to be executed by the server or the client respectively. Of course the attacker has to get some access as some user of that system to be able to write to that file. The world-writable file is only writable to the users of the system, so theoretically if the system is your own machine or VPS where there is only one user - you - then an attacker would have to get access to your account to be able to write to that file, but if he gets access to your account then the file being world-writable is irrelevant. Unless he gains access to some low-privileged process running as some other user then you.

As you can see, it all depends on how the file is used, what are other users and processes on the system, and many other things. The rule of thumb is to never give anyone more privilege than he needs to get the job done.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号