LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-13-2008, 05:52 AM   #1
montyleesam
LQ Newbie
 
Registered: Nov 2006
Posts: 21

Rep: Reputation: 15
how to prevent executing script in /tmp ?


Hello all.

As you know, many attackers using /tmp for uploading exploit code.
and execute like below.

/usr/bin/perl /tmp/exploit.cgi or
/bin/sh /tmp/exploit.sh

so, even though I setup noexec at /tmp in /etc/fstab, attacker can avoid this config.

So is there any solution or method to prevent or monitoring using /tmp?



Thanks in advance.
 
Old 06-13-2008, 06:29 AM   #2
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
You could write selinux policy to prevent script execution in /tmp
 
Old 06-13-2008, 06:42 AM   #3
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Why doesn't noexec work? If you're that worried, run a minimal chrooted system.
 
Old 06-13-2008, 07:16 AM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by Randux View Post
Why doesn't noexec work?
Because you don't need to execute the script. You can execute the interpreter (which will be on a non-noexec partition) and tell it which file to load the commands from, as shown in the OP's examples.
 
Old 06-13-2008, 05:49 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by datopdog View Post
You could write selinux policy to prevent script execution in /tmp
Could you post the steps to do that please?
 
Old 06-15-2008, 08:15 AM   #6
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Quote:
Originally Posted by win32sux View Post
Because you don't need to execute the script. You can execute the interpreter (which will be on a non-noexec partition) and tell it which file to load the commands from, as shown in the OP's examples.
That sounds bad!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
safety script prevent accidental rm -rf GATTACA Programming 4 10-29-2007 02:36 AM
How to prevent apache from executing certain files imi@tux Linux - Server 3 09-21-2007 12:26 AM
Bash script - executing a script through subdirectories bubkus_jones Programming 5 04-24-2006 05:05 PM
executing a script!! vishamr2000 Linux - Security 5 07-29-2005 02:34 AM
Prevent konqueror from executing shell scripts Dave Farrance Mandriva 1 05-30-2004 08:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration