Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
/tmp gets a sticky bit, so noexec will not work alone and you may need an extra option like nosuid. Probably you may to find out if you can use chroot or even better schroot.
A lot of scripts can be executed with out the script being set as executable. In this case you may want to lock down interpreters so outsiders can not run scripts.
Rite, I assume by this that you mean stop a compiler being used by other users? I thought about that many a times but I'm not sure how to achieve this result without "breaking" things?
@Electro: How would that work? I mean nousuid and noexec are two different things..right?
nosuid would probably prevent files like passwd and other files with permissions of 4755 from not being executed at all in /tmp.
noexec would or rather "should" prevent any executables from being executed at all. So for example if while I'm in /tmp I try and do something like ./dos_linux.sh it shouldn't run or should give me a permission denied like stefaandk said.
@Stefaandk: Whats the permissions on this attack script which you discovered?
noexec would or rather "should" prevent any executables from being executed at all. So for example if while I'm in /tmp I try and do something like ./dos_linux.sh it shouldn't run or should give me a permission denied like stefaandk said.
right, but although noexec would prevent you from doing a:
Ahh okay but isnt that pretty much the same as executing the script? Instead of directly executing the script I'm using a shell to execute it. Is that any different? Obviously it is..but what's the difference?
Ahh okay but isnt that pretty much the same as executing the script? Instead of directly executing the script I'm using a shell to execute it. Is that any different? Obviously it is..but what's the difference?
yeah, the difference is that what is getting *executed* is the shell, which isn't on the noexec partition... the shell script is simply the instructions which are given to the shell - there's no need for the script to be executable (you don't even need it to have a shebang)...
Great ...that clears things up quite a bit. Just a couple of things though:
1.If I ran this copy of /bin/sh from /tmp(No reason to do this..just asking) the noexec would stop it from executing.Right?
Code:
/tmp/sh test.txt
2.By binaries being restricted this would then mean soemthing like:
If I have a binary in /tmp which is noexec'd and say /bin/sh and I call both from within a script in /tmp; the /bin/sh would execute but the other binary on /tmp itself would not execute.
1.If I ran this copy of /bin/sh from /tmp(No reason to do this..just asking) the noexec would stop it from executing.Right?
Code:
/tmp/sh test.txt
yes, you would get a "Permission denied"...
Quote:
2.By binaries being restricted this would then mean soemthing like:
If I have a binary in /tmp which is noexec'd and say /bin/sh and I call both from within a script in /tmp; the /bin/sh would execute but the other binary on /tmp itself would not execute.
Correct??
yes, you would get a "Permission denied" for the binary in /tmp...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.