File Permissions and Privilege Escalation
File Permissions and Privilege Escalation
ESCALATION
UNDERSTANDING LINUX PERMISSIONS AND ESCALATION
TECHNIQUES
WHAT ARE FILE PERMISSIONS ?
File permissions in Linux are a set of rules that determine who can
access a file or directory and what actions they can perform on it.
These permissions are essential for controlling how users interact
with files and directories in a Linux system.
• Command: ls –l
• Command output:
CHANGING PERMISSIONS WITH CHMOD
Command: chmod [options] permissions file
Permission Notation:
• Symbolic: u+rwx, g-r, o=x
• Octal: 755, 644
CHANGING OWNERSHIP WITH CHOWN
• Command: chown [options] user:group file
INTRODUCTION TO PRIVILEGE ESCALATION
WHAT IS PRIVILEGE ESCALATION?
Privilege escalation is the process of gaining higher-level access or permissions on a system than
what was originally intended or granted. This is often done to bypass security restrictions and gain
control over a system or access sensitive data.
TYPES OF PRIVILEGE ESCALATION?
Privilege escalation is broadly categorized into two types: Vertical and Horizontal.
• Vertical Privilege Escalation (User to Root): Vertical privilege escalation occurs when a user
gains higher-level privileges than they are supposed to have.
• Horizontal Privilege Escalation (User to Another User): Horizontal privilege escalation occurs
when a user gains access to another user’s account at the same privilege level.
PRIVILEGE ESCALATION VIA SUDO
WHAT IS SUDO?
Sudo allows for execution of commands as another user (usually root)
SOME MISCONFIGURATIONS:
• Overly permissive sudoers file
• Allowing dangerous files
EXAMPLE
sudo –l
PRIVILEGE ESCALATION VIA SU
WHAT IS SU?
SU is used to switch accounts to another account (root or another user account)
COMMANDS
• su - username (Switch to username).
• su - (Switch to root).
SUID/ SGID BINARIES
SUID (Set User ID): When an executable file has the SUID bit set, it runs with the
permissions of the file owner instead of the user executing it.
SGID (Set Group ID): When an executable file has the SGID bit set, it runs with the
permissions of the file’s group instead of the group of the user executing it.
COMMON PRIVILEGE ESCALATION TECHNIQUES
• Weak File Permissions
• Kernel Exploits
• Service misconfigurations
• SUID/SGID misconfigurations
Privilege Escalation:
Best Practices: