Privilege Escalation
Privilege Escalation
level access within a security system. It typically starts with attackers exploiting
vulnerabilities to access a system with limited privileges.
The attackers then elevate their access rights to gain control over more sensitive
systems or data. Common reasons for successful privilege escalation include
insufficient security controls, non-adherence to the principle of least privilege, and
exploitable software vulnerabilities. This can lead to either external threat actors or
insiders gaining undue access.
Any privilege escalation incident must be dealt with as a severe security incident
and, depending on the organization’s compliance obligations, might have to be
reported to authorities.
On Linux, this is typically done via the sudo (Super User DO) command that
enables condition-based privilege elevation for user accounts. To use sudo
privilege elevation, you simply precede the command with sudo, which will then
execute the command as a super-user.
An example of using sudo to execute ifconfig as a super-user is below:
A big difference between Windows and Linux is that Windows was originally
planned as a single-user system with administrator privileges. In contrast, Linux
was designed as a multi-user operating system. With many users accessing the
same system, you can see why managing directory and file access is critical.
One of the most important files on the Linux system is the passwd file, located at
/etc/passwd. This file lists all the users known to the system which could also be
included in directory services.
If we look inside the passwd file using the “cat” command, we find something like
the following:
Each field is separated using the colon “:” character in which the fields represent
the following passwd file format:
Username
Group ID (GID)
Home Directory
Shell – absolute path to the command shell used (if /sbin/nologon then logon isn’t
permitted, and the connection gets closed)
Any user with a user ID above 1000 (this can slightly vary on certain Linux/Unix
operating systems) isn’t a default user and has been added to the system. “UID 0”
is reserved for the root account, however it can also be used for other users, giving
them super-user privileges. “Effective ID 0” and “1-99” are for predefined
accounts and “100-999” are for system administration. If you find + or – in the
field, this likely represents an account being used with a directory service, for
example LDAP.
In older Linux systems the password of the user was stored in the /etc/passwd file,
however this was deemed insecure and was replaced using the /etc/shadow file.
That’s why the password placeholder containing an “x” indicates the password is
stored in the /etc/shadow file.
The passwd file is typically readable by all users. For example, if you run the
command “ls -la /etc/passwd” you will get output like the following:
The permissions in the “ls -la” output for the /etc/passwd file show the following
format:
The first character “-“ is reserved as a special permission that can vary. Another
special permission that can be used here is known as SUID, GUID or the Sticky
Bit. We will cover the special permission a little bit later.
1.Owner
2.Group
3.All Users
1.Read = 4
2.Write = 2
3.Execute = 1
1.File Type
6.Owner
7.Group
https://delinea.com/blog/linux-privilege-escalation