All-Things-Docker-and-Kubernetes

Linux Privilege Escalation

This refers to unauthorized elevation of user or process privileges on a Linux system, wherein the main objective is to gain higher-level access than originally granted.

Common Techniques

Steps to Secure

Here are commands for some of the steps mentioned to secure a Linux system against privilege escalation:

Sudoers file

Below is a common sudoers file:

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See sudoers(5) for more information on syntax.

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%wheel   ALL=(ALL:ALL) ALL

# Allow a user to run specific commands without a password
john   ALL=(ALL) NOPASSWD: /bin/ls, /usr/bin/cat

# Deny a user from running specific commands
jane   ALL=(ALL) !/bin/rm

# Alias definitions
# Example alias definition:
# Alias_Spec = User_List, Command_List
# Run '/usr/bin/apt-get update' as 'john'
Cmnd_Alias UPDATE = /usr/bin/apt-get update
john   ALL=(ALL) UPDATE

To understand, here is the description of each fields:

In the sudoers file above, %wheel means members of the group wheel can gain root privileges.

# Allow members of group sudo to execute any command
%wheel   ALL=(ALL:ALL) ALL 


Back to first page