The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > Security
.
google unix.com



Security Discuss UNIX and Linux computer and network security, cybersecurity, cyberattacks, IT security, CISSP, OWASP and more.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sudo, or not sudo: that is the question iBot UNIX and Linux RSS News 1 02-07-2008 01:40 PM
Sudo question Zarnick Linux 2 01-22-2008 08:25 AM
Sudo question Katkota UNIX for Dummies Questions & Answers 10 01-18-2008 05:35 AM
SUDO question - please help sajjad02 UNIX for Advanced & Expert Users 5 04-27-2005 11:22 AM
sudo question TRUEST UNIX for Dummies Questions & Answers 1 01-17-2004 12:53 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-12-2008
melias melias is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 43
sudo question

Hi,

Is it possible to stop users from copying a login shell, say bash, to another name and then executing it via sudo to gain root priviliges?

Normal users have read access to login shells, so they can copy them without any limitations. How can I stop this?

Thanks
  #2 (permalink)  
Old 04-16-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Sudo doesn't work that way (unless you've configured it wrongly).
When you specify a command in the sudoers file (via visudo), you specify the full path to it. If a user renames a shell to be the same as an existing command in their sudo command set, the path will still be wrong so it won't work.

If you use wildcards in the sudo config, you need to be careful that you don't allow the execution of user created binaries. Do this by only allowing wildcards within filesystems the users have only read access to. In general, keep wildcards to a minimum as they open a lot of hard to forsee options to your users.
  #3 (permalink)  
Old 04-17-2008
melias melias is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 43
Thanks for the reply, but I'm still uncertain.

The issue I want to stop is as follows:

A user makes a copy of /usr/bin/bash and renames it to /home/user/not_bash.

Since the copy has been done under the user's account, and not via sudo, there's no checking to see whether the command is allowed or not. Bash executable has read access for everyone, so making a copy of it is not restricted.

Now, what's to stop the user from executing the following:

sudo /home/user/not_bash (or any other name)

to elevate themselves to root?

I do not want to specify every individual command the user is allowed to run via sudo as I would need to list the majority of o/s commands as I want users to be able to perform most system commands, just not be able to elevate to the root account (or any other user's, for that matter).
  #4 (permalink)  
Old 04-17-2008
deaconf19 deaconf19 is offline
Registered User
  
 

Join Date: Sep 2007
Location: EX-PAT in Taipei, Taiwan
Posts: 152
have you read the sudo man pages?

Sudo Manual

sudo determines who is an authorized user by consulting the file /etc/sudoers

if you have user_A assigned the profile of shutdown and user_A copies the bash file over to user_B in a different location it will not work because user_B is logged in and authenticated already as user_b and the sudo file will check this when they try to login to the shutdown profile.
  #5 (permalink)  
Old 04-17-2008
melias melias is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 43
I understand how sudo works.

How does sudo stop my above example from occurring?
The user copies the bash executable to another name. This copy occurs with normal acess rights, because /usr/bin/bash has read access for everyone.
No sudo authentication has occurred.
The user either copies, or moves, bash executabe to another name, say /home/user/this_is_not_bash.
Still no sudo authentication.

Now, the same user runs "sudo /home/user/this_is_not_bash"
Sudo checks sudoers file, and there is no restriction on running /home/user/this_is_not_bash (or any other name the user decides on)

The user has now been elevated to root.

Bash executable has NOT been copied to another users profile, it is being used to elevate (or switch) to another users account.

How do I stop this from occurring?
  #6 (permalink)  
Old 04-17-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Hang on, are you saying you have granted sudo rights to users that lets them run anything they want from their home directory? Forget bash, you've got far bigger security risks by doing that - see my earlier post on this thread.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:19 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0