LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 05-26-2004, 10:21 PM   #1
ridertech
Member
 
Registered: Dec 2003
Location: Seattle, Washington
Distribution: Debian 'Sarge'
Posts: 85

Rep: Reputation: 15
Eliminating SUID & SGID?


I'd like to elminate the files using SUID/SGID, but I'm not sure which of the following is (or is not) safe to unset...

### SGID ###
/usr/bin/wall
/usr/bin/chage
/usr/bin/expiry
/usr/bin/write
/usr/bin/dotlockfile
/usr/src
/usr/local
/usr/local/share
/usr/local/bin
/usr/local/games
/usr/local/man
/usr/local/lib
/usr/local/include
/usr/local/sbin
/usr/local/src
/var/cache/man
/var/local
/var/log/exim
/var/log/news
/var/mail
/home
/etc/ppp/peers
/etc/chatscripts

### SUID ###
/usr/bin/newgrp
/usr/bin/chfn
/usr/bin/chsh
/usr/bin/gpasswd
/usr/bin/passwd
/usr/bin/at
/usr/bin/crontab
/usr/sbin/exim
/usr/sbin/pppd
/usr/lib/pt_chown
/sbin/unix_chkpwd
/bin/login
/bin/su
/bin/mount
/bin/umount
/bin/ping
 
Old 05-26-2004, 11:01 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
That's something of an odd setup -- /home, /usr/src, /usr/local, and /var/local should probably not have the setgid bit on them. So too with most of the *directories* that you say are setgid. write and wall definitely have to be setgid tty so they can write to all the terminal devices, but most of the rest look spurious.

As for your setuid files -- it appears most of them need to be as they are. passwd must be setuid for instance since only root has permission to write to the password file. I don't see any file in that group that doesn't look out of place.
 
Old 05-26-2004, 11:12 PM   #3
ridertech
Member
 
Registered: Dec 2003
Location: Seattle, Washington
Distribution: Debian 'Sarge'
Posts: 85

Original Poster
Rep: Reputation: 15
Thanks for the heads up!

Those directories having SGID are very odd... I used a "minimal" install of Debian Woody with the bf24 option. Scary that this is the default.
 
Old 05-29-2004, 07:25 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I think the important thing is to also know *what* group or user they're setgid/setuid to, and what the reason is. Setuid root for some apps is necessary to get read rights or open a privileged port (below 1024). If it's an app without respect for good programming practices (drop privs RSN, run as lesser priv'ed user), ACL's (PAM aware apps) or workaround (allow specific switch tru sudo) and no real necessity, then by all means test unsetting the bit. To get indepth info on an apps maintenance status you gotta research some. Look at the changelogs and search Google/Linuxsecurity.com/Securityfocus.com/Bugtraq for (past) vulnerabilities and exploits makes for a nice start. Granted, it's laborious, but this will definately give you better insight in trouble with some apps.


Unset if you don't want users to:
### SGID ###
/usr/bin/wall # talk
/usr/bin/chage # view their own passwd aging
/usr/bin/expiry # dunno. This a passwd thing?
/usr/bin/write # write messages to other users terminals
/usr/bin/dotlockfile # dunno


### SUID ###
/usr/bin/newgrp # switch/change their current sessions group rights
/usr/bin/chfn # change finger info
/usr/bin/chsh # change shells
/usr/bin/gpasswd # passwd group nfo
/usr/bin/passwd # password user nfo
/usr/bin/at # run At jobs (also see /etc/at.{deny,allow})
/usr/bin/crontab # edit their crontab (also see /etc/cron.{deny,allow})
/usr/sbin/exim # <- this could be a necessary pain. Hope it drops root privs.
/usr/sbin/pppd # <- this could be a necessary pain. Hope it drops root privs or restrict with sudo.
/usr/lib/pt_chown # <- Glibc necessity unless you run dev{pts}fs
/sbin/unix_chkpwd # dunno?
/bin/login # setuid not needed AFAIK
/bin/su # change user (set up specific tasks tru sudo instead)
/bin/mount # mount/unmount stuff (also see mount flags)
/bin/umount # mount/unmount stuff (also see mount flags)
/bin/ping # ping hosts (firewall)
 
Old 07-08-2004, 05:58 PM   #5
plan9
Member
 
Registered: May 2004
Location: USA
Distribution: Slackware-Current
Posts: 74

Rep: Reputation: 15
thanks- this thread has been helpful to me.
 
  


Reply



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
what is "sticky bit mode" , "SUID" , "SGID" augustus123 Linux - General 10 08-03-2012 04:40 AM
suid/sgid question plan9 Linux - Security 1 07-08-2004 07:15 AM
Question: the concept of suid and sgid feetyouwell Linux - Software 4 02-03-2004 04:12 PM
shell variables &suid&sgid alaios Linux - General 6 05-23-2003 04:03 PM
SGID and SUID on Directories mikeyt_333 Linux - General 1 03-26-2002 02:41 PM

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

All times are GMT -5. The time now is 02:39 PM.

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