LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-19-2015, 09:47 AM   #1
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110
Blog Entries: 4

Rep: Reputation: 0
login as root loophole


When I try to execute a command using sudo; example-
Code:
sudo apt-get install,
the terminal asks for the password for authentication. Once the authentication is over, it is then that the command is executed.

However when I write
Code:
sudo su
and hit enter, it directly puts me in root mode without asking for authentication.

If it not a loophole in
Code:
sudo su
command? Why does it not ask for the password?
 
Old 04-19-2015, 09:49 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Check the config for sudo in /etc/sudoers (use the visudo command, not a normal text editor), it may be that someone has configured sudo to behave that way (which is a very bad idea).
 
Old 04-19-2015, 09:52 AM   #3
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 687
Blog Entries: 1

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
That is the way sudo is setup on your system, for a short period of time no need for a PW. See man sudoers, option passwd_timeout
 
Old 04-20-2015, 09:44 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,474

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by jmccue View Post
That is the way sudo is setup on your system, for a short period of time no need for a PW. See man sudoers, option passwd_timeout
Are you sure it's not timestamp_timeout ?
 
Old 04-21-2015, 08:08 PM   #5
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 687
Blog Entries: 1

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by TenTenths View Post
Are you sure it's not timestamp_timeout ?
Your right

John
 
Old 04-21-2015, 08:22 PM   #6
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,345

Rep: Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588
I have Xubuntu until I close the xterminal that I used sudo in, will retain the password untill closed. I don't know how long it remains that way as I usually close the xterminal as soon as I'm done running sudo commands. If I open a second xterminal and the first terminal is still open after running sudo on the first terminal, the second xterminal will ask for the password initially also.

Last edited by colorpurple21859; 04-21-2015 at 08:23 PM.
 
Old 04-21-2015, 09:43 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
I don't use Ubuntu often but my experience with a terminal is the same as described by colorpurple 2159. Open a terminal and enter any command requiring sudo and a password is needed. Using the same terminal for another command requiring sudo whether to open a text editor, file manager, web browser or any other action does not ask for a password. Close the terminal, open a new one and the first sudo option will again demand a password.
 
Old 04-22-2015, 07:34 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,642
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
Actually, sudo su is a gaping security-hole(!!) on a great many systems, including nearly all of the Macintoshes that you see being used at any-and-every coffee shop.

(So much for Macs being "immune to exploits" ...)

Most-unfortunately, I typically find that this command works on most Linux and Unix systems that I encounter. If I am able to use sudo at all, I find that I can usually issue sudo su, and thereby gain full root privileges using nothing more than my own(!!) password ... even if (as usually is the case with OS/X) "the actual root user is disabled."

"Heh..." ( ... ) "reckon it don' matter much whether-or-not I actually am root, if I find that I can do everything he does, using nothing-more than my password!"

Yep. Apple, of all companies on this planet, should know better. But apparently they don't. (And, equally apparently, the vast majority of "Linux distro" authors don't seem to, either.) Guess this must qualify as a "dirty little secret."

Last edited by sundialsvcs; 04-22-2015 at 07:36 PM.
 
Old 04-22-2015, 08:30 PM   #9
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,345

Rep: Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588
I haven't tried it lately but I have changed roots password with sudo su in Ubuntu.
 
Old 04-23-2015, 04:18 PM   #10
omniterm
LQ Newbie
 
Registered: Jun 2014
Posts: 1

Rep: Reputation: Disabled
The big issue here is that "root" is dangerous. For security many modern distros lock out the root account during install and the first user account that is created is an Admin account. User account with sudo access. The big problem hear is that many users, myself included use weak/no passwords for there user(Admin) account. Since "root" was locked out for security purposes sudo is configured to ask for the user's password. This allows users to run commands that require root access using sudo(Switch User and DO command) or run su(Switch User) This is actually less secure due to most users having weak/no password for their user account. Then there is the "Lazy" feature that allows sudo to remember your authentication and allows you to run sudo without requiring a password for a configurable amount of time. This feature only works for the current login session Each terminal window you open will be a new session and thus require your password the first time you run sudo or su. One of the reasons I don't like ubuntu or any modern distro that locks out root for security. on my Fedora 21 install I have a strong password for "root" and weak password for my account. none of my users have access to sudo and any attempt to run sudo will fail with a warning that you are not a member of sudo and thus will be reported to root. If I run su as a user then I am asked for the roots password not my weak password.
 
Old 04-23-2015, 04:35 PM   #11
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by omniterm View Post
The big issue here is that "root" is dangerous.
Root is not dangerous. Root is a fundamental and useful basic design concept in Unix-like operating systems.

Lack of knowledge about basic concepts, including root, coupled with a willingness to blindly try things anyway is dangerous - in any sphere!

Willingness of some distro developers to reinforce, rather than fix this lack of knowledge, disabling root accounts and misusing and abusing sudo in an effort to create some new and ill-defined category of user called "Admin" only makes matters worse.

Root is a design constraint, learn why and how it works.

Sudo is a useful and safe tool when used properly, learn how to use it properly.
 
Old 05-19-2015, 02:45 AM   #12
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
Quote:
Originally Posted by astrogeek View Post
Quote:
Originally Posted by omniterm View Post
The big issue here is that "root" is dangerous.
Root is not dangerous. Root is a fundamental and useful basic design concept in Unix-like operating systems.

Lack of knowledge about basic concepts, including root, coupled with a willingness to blindly try things anyway is dangerous - in any sphere!

Willingness of some distro developers to reinforce, rather than fix this lack of knowledge, disabling root accounts and misusing and abusing sudo in an effort to create some new and ill-defined category of user called "Admin" only makes matters worse.

Root is a design constraint, learn why and how it works.

Sudo is a useful and safe tool when used properly, learn how to use it properly.
The title of this whole thread is misleading. Sudo, su , and the root account are NOT dangerous. What is dangerous is the way these are being used to make system administration more convenient and less secure. This is no loop hole, just poorly done administration of Linux systems to simplify Linux for people who do not care to learn how to actually use Linux properly.

For anyone still confused: you don't actually need sudo. Learn a bit about system security.
 
Old 05-19-2015, 06:39 AM   #13
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by mralk3 View Post

For anyone still confused: you don't actually need sudo.
That statement may or may not be true, depending on the environment. While on single user desktop systems one certainly does not have a need for sudo other than convenience, this might not be true in environments where different users need to have access to different administrative tasks without having full root access.
 
Old 05-19-2015, 12:15 PM   #14
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
Quote:
Originally Posted by TobiSGD View Post
That statement may or may not be true, depending on the environment. While on single user desktop systems one certainly does not have a need for sudo other than convenience, this might not be true in environments where different users need to have access to different administrative tasks without having full root access.
True. I was assuming based on the context of previous replies that we are talking about single user desktop or laptop systems. I have in the passed configured a server to use sudo to allow a limited set of commands to a administrative database user, a user to manage Apache, or a user that strictly handles software updates / installation.

In general though for laptops or desktops sudo isn't imperative to operation. Most definitely sudo SHOULD NOT be set up to allow root access without a password. The one exception to passwordless sudo root access is on a Live image like a live cd or live usb disk. The only reason a live image should allow this is if the file system is mounted read only, and most of these types of images are booted read-only. This prevents permanent system compromises since writing to disk is impossible.
 
Old 05-19-2015, 07:26 PM   #15
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Quote:
Originally Posted by colorpurple21859 View Post
I have Xubuntu until I close the xterminal that I used sudo in, will retain the password untill closed. I don't know how long it remains that way as I usually close the xterminal as soon as I'm done running sudo commands. If I open a second xterminal and the first terminal is still open after running sudo on the first terminal, the second xterminal will ask for the password initially also.
This is correct behaviour as opening a new terminal starts a new shell with a new sudo timeout, there is little or no interaction between the two terminal sessions under normal circumstances, for instance set a variable in the first terminal and then open a second and the variable will not be defined, depending on how you open the second terminal.
 
  


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
LXer: Oracle's Java patch leaves a loophole LXer Syndicated Linux News 0 01-20-2013 11:30 AM
Can't boot Wary Puppy Linux anymore, login: root (automatic login) theADOLESCENT Linux - Newbie 9 09-16-2012 06:13 PM
LXer: RIAA: Google/Verizon deal needs yet another gaping loophole LXer Syndicated Linux News 0 08-19-2010 02:50 PM
LXer: 'honest' open source licence aims to close GPL loophole LXer Syndicated Linux News 0 08-14-2006 11:54 AM
Gnome: Cannot login as default user, sends back to login, works as root Danny-T Linux - Newbie 2 05-27-2006 03:44 AM

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

All times are GMT -5. The time now is 01:48 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