Solved

Linux: /tmp noexec - useful or not?

Posted on 2013-01-26
3
579 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Squid Connection Pools 3 68
CentOS 7 Installation 7 73
networking details on centos 6.6 4 63
wipe a usb using python 5 48
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

772 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