Privilege Escalation

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
21 hours 25 minutes
Difficulty
Intermediate
CEU/CPE
21
Video Transcription
00:00
>> Hey, Cybrarians. Welcome back to
00:00
the Linux Plus course here at Cybrary.
00:00
I'm your instructor, Rob Goelz.
00:00
In today's lesson, we're going to
00:00
talk about privilege escalation.
00:00
Upon completion of today's lesson,
00:00
you're going to be able to understand
00:00
the ways you can perform privilege escalation,
00:00
and explain the purpose of privilege escalation groups,
00:00
and how to add users to these groups.
00:00
Although the root user has complete system access,
00:00
it's not recommended to use it
00:00
for system administration work.
00:00
Sharing a root password can be dangerous,
00:00
especially if you're sending around
00:00
between people using plain texts.
00:00
It can easily fall into the wrong hands in
00:00
this type of situation and then
00:00
everyone else would access.
00:00
It's also really difficult to
00:00
audit work done as a root account if everyone's root,
00:00
who knows what's doing what.
00:00
When the account is sure, that's a
00:00
>> very real possibility.
00:00
>> Instead, the general best practice is to
00:00
use a standard user account and then use
00:00
privileged escalation to run
00:00
programs with root privileges temporarily.
00:00
There are three commands that can be
00:00
used to perform privilege escalation.
00:00
They are SU, sudo and sudoedit.
00:00
Now SU, which actually stands for substitute user,
00:00
allows a standard user to run commands as another user.
00:00
Common use case for
00:00
this is to become the root is where you
00:00
could use SU- to become root.
00:00
But you still have to know
00:00
the root password to become root this way.
00:00
Now, another example is
00:00
something that's a little safer is sudo,
00:00
which actually stands for substitute user do.
00:00
This is safer option than SU because it doesn't
00:00
require any user to know the root password.
00:00
A standard user can run a command as
00:00
root by simply providing their password.
00:00
We'll do sudo, the command
00:00
and it'll prompt them for their password.
00:00
If they're in a privilege escalation group,
00:00
they can run sudo and they can
00:00
run that command as if there were root temporarily.
00:00
But as I said, the user account must be in
00:00
a privileged group and we'll talk
00:00
about that in the next slide.
00:00
Now the final privilege escalation
00:00
command you should know about is sudoedit.
00:00
This is really nice if you just need to edit a file,
00:00
but you need privileges to do it,
00:00
you can use sudoedit to temporarily
00:00
become root and edit that file.
00:00
It works the exact same way as sudo.
00:00
You provide the file and you've run sudoedit,
00:00
and then the file or the path of the file,
00:00
it'll prompt you for your own password
00:00
and provide you're in that privileged group,
00:00
you escalate privileges,
00:00
and become root temporarily,
00:00
and you can get in and modify that file.
00:00
Now, users have to be added to
00:00
a privileged group to receive sudo privileges.
00:00
Users can be added to these groups with usermod.
00:00
So usermod ag,
00:00
-a-g, you're going to append the group.
00:00
We saw that before when we were talking about usermod.
00:00
We could add users to sudo or wheel.
00:00
Now wheel is the privileged group
00:00
that is set for Red Hat-based distress.
00:00
If you're going to get sudo privileges in Red Hat,
00:00
nine times out of 10,
00:00
you're going to need to be added to
00:00
the wheel group in order to do that.
00:00
If you're working in Debian-based distros
00:00
like Ubuntu or Linux Mint,
00:00
that privileged group is actually just called sudo.
00:00
You would add a user to that group to have them
00:00
be allowed to do privilege escalation,
00:00
to have them be allowed to use sudo.
00:00
Then additionally, these groups
00:00
sometimes need that they actually be enabled.
00:00
The sudoers file that controls
00:00
which user groups have access or which
00:00
user groups are enabled to be able
00:00
to do sudo is it etc/sudo.
00:00
This is called the sudoers file.
00:00
But it's really not recommend to edit this file
00:00
directly because if you mess up the syntax,
00:00
break things pretty bad.
00:00
The better way to do this, use the VI sudo command,
00:00
that's going to open it into the fault text editor
00:00
that's on the system.
00:00
In Red Hat, that's going to be Vim or VI and Ubuntu.
00:00
Nine times out of 10, that's going to be nano.
00:00
Then you can go in there and make the
00:00
modifications you want to make.
00:00
The system will check the file and
00:00
exit to make sure that the syntax isn't screwed up.
00:00
It won't let you save it if
00:00
there's some problem with the syntax.
00:00
Really, you just have to go in there and
00:00
uncomment the lines for wheel or
00:00
sudo to make sure that those privileged groups
00:00
are enabled and then you can add users to them.
00:00
With that, we've reached the end of this lesson.
00:00
In this lesson, we covered how
00:00
to perform privilege escalation.
00:00
We talked about the purpose of
00:00
privilege escalation groups and
00:00
how to add users to these groups.
00:00
Again, using usermod.
00:00
Thanks so much for being here.
00:00
I look forward to seeing you in the next lesson.
Up Next