Solved

Linux: /tmp noexec - useful or not?

Posted on 2013-01-26
3
596 Views
Last Modified: 2013-02-15
Hi,

Is there any benefit by mounting /tmp with noexec?
I've heard that even with that, there are workarounds to execute scripts in /tmp.

Is that true? If so, how is this possible?

Thank you
0
Comment
Question by:g0all
3 Comments
 
LVL 20

Assisted Solution

by:edster9999
edster9999 earned 250 total points
ID: 38822107
Its worth doing.
You should also set nodev and nosuid if possible.

Why would you do this ? Most vlaid users, whether they are a real user (like a person with an account on the machine) or a user that allows a process to run (like the user your webserver runs as) would have the ability to drop files into this folder and change things in there.  They can then cause it to be run either by themselves or by someone with more rights than them.
Adding these locks stop the commands being run so easily.  You have to use another step to get them to run.
Think of this as locking your house door.  You are saying you have heard there are other ways to get into a house so should you lock your doors.
Yes - of course you should, it may slow down or stop a script-kid from gaining root access to your server :)

How can people still run things ? Well there are at least a couple of different ways.
One of them involves not running it, but passing it as a parameter into another program (for example the bash shell).  Another way involves an older exploit using /lib/ld-linux.so to execute the code - but this has been patched on most Linuxes now.
No matter how much you patch - there will always still be holes that can be exploited. The best thing to do is patch and lock as many as are known.

Good luck
0
 
LVL 4

Expert Comment

by:ReN501
ID: 38829337
put simply , do it , /tmp is one of the very few folders or partitions ( default ) that has global read/write/execute access , by not allowing execute access this will prevent alot script kiddie attempts to run scripts etc, especially if your running a web server.
0
 
LVL 62

Accepted Solution

by:
gheist earned 250 total points
ID: 38853130
Yes - script interpreter like BASH or PERL will run any file passed as parameter to them, even if otherwise execve (you know that #!/bin/init 0 in front of file) would not work...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
auto mounter on hp-ux 2 38
SMB share across internet 15 85
PHP error function not working on AWS 10 129
UM7 Stop Sending packets with GPS Sensor 1 21
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question