What is Linux privilege escalation?

What is Linux privilege escalation?

Privilege escalation is the process of elevating your permission level, by switching from one user to another one and gain more privileges. For example, a normal user on Linux can become root or get the same permissions as root. This can be authorized usage, with the use of the su or sudo command.

What is sudo privilege file?

The main configuration for the sudo command is located in the /etc/sudoers file. Within this file are individual variables or configurations that define how commands can be accessed by certain users or groups. Additional configurations can be stored in the /etc/sudoers.d directory.

How do you do sudo privileges?

To use this tool, you need to issue the command sudo -s and then enter your sudo password. Now enter the command visudo and the tool will open the /etc/sudoers file for editing). Save and close the file and have the user log out and log back in. They should now have a full range of sudo privileges.

How do I stop sudo all the time?

Two things you can do are: 1) Run sudo -s to stay root when you plan on entering multiple commands and don’t want to keep prefixing them with sudo. 2) You can configure your sudoers file to allow you to run sudo without having to enter your password.

How to use sudo for privilege escalation in Linux?

There is one more shortcut which you can use when you have access to vim, you can use the following command to trigger the root shell using vim. sudo vi -c ‘!bash’. There are many Linux executable other than text editors which you can use for privilege escalation.

Why do I need root privileges to run Sudo?

Take a look at the following image. When you run any command along with sudo, it needs root privileges for execution, Linux checks that particular username within the sudoers file. And it concluded, that the particular username is in the list of sudoers file or not, if not then you cannot run the command or program using the sudo command.

How to check root permission for privilege escalation?

While solving CTF challenges, for privilege escalation we always check root permissions for any user to execute any file or command by executing sudo -l command. You can read our previous article where we had applied this trick for privilege escalation. Let’s Start with Theoretical Concept!!

How to use Vim for privilege escalation in Linux?

In command mode, use :!bash command this will open a root shell. There is one more shortcut which you can use when you have access to vim, you can use the following command to trigger the root shell using vim. There are many Linux executable other than text editors which you can use for privilege escalation.