Cyber Services / All lessons / Diploma in Cyber Security / Permissions, Rights & Privilege Escalation

Permissions, Rights & Privilege Escalation

Module 13 of 30 · 5 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Controlling Access and Preventing Unauthorized Power

At the core of a secure operating system lies one guiding philosophy: the Principle of Least Privilege. This states that any user, program, or process should only have the absolute minimum permissions necessary to perform its intended function. This module dissects the mechanisms that enforce this principle—File Permissions and User Rights—and explores the critical attack vector they are designed to prevent: Privilege Escalation.

File Permissions: Controlling Access to Objects

File permissions are the most granular level of access control. They define **what** actions can be performed on an object (a file or a directory) and **who** is allowed to perform them. Both Windows (with NTFS ACLs) and Linux use this model, though the classic Linux implementation is a perfect illustration of the concept.

The Three Core Permissions Explained

Read (r):

  • On a file: Allows opening and viewing the contents of the file.
  • On a directory: Allows listing the names of the files and subdirectories within it (using `ls`).

Write (w):

  • On a file: Allows modifying, overwriting, or deleting the file.
  • On a directory: Allows creating new files, deleting existing files, or renaming files within that directory. This is a crucial distinction.

Execute (x):

  • On a file: Allows running the file as a program or script.
  • On a directory: Allows entering the directory and accessing its contents (using `cd`). You cannot access files within a directory without execute permission on the directory itself, even if you have read permission on the files.

The Three User Classes (Linux Model)

These permissions are assigned to three distinct identities for every file and directory:

  • User (Owner): The single user who owns the file. By default, this is the user who created it. The owner has the most control.
  • Group: A specific group of users who share a common set of permissions for the file. This is how you grant access to a team.
  • Other: Every other user on the system who is not the owner and is not in the group. This is the "world" permission.

Real-World Example (Linux `ls -l` output):

-rwxr-x--- 1 Mubasher developers 4096 Aug 3 10:30 deploy.sh

Breakdown of `rwxr-x---`:
`rwx` (User/Owner 'Mubasher'): Can Read, Write, and Execute the script.
`r-x` (Group 'developers'): Members can Read and Execute the script, but cannot modify it.
`---` (Other): All other users have no permissions at all. They cannot read, write, or execute it.

User Rights: The Power to Act on the System

If file permissions control access to objects, User Rights (or Privileges) control a user's ability to perform system-wide actions. This is the difference between being allowed to *read* a configuration file versus being allowed to *shut down* the entire system.

Standard User (Least Privilege)

This account operates with minimal privileges. A standard user can run applications and manage files within their own home directory. They cannot install software system-wide, modify OS files, change critical settings, or affect other users. This should be the default account for all day-to-day computer use.

Administrator / Root (Highest Privilege)

The "superuser" account. In Windows, this is any user in the 'Administrators' group. In Linux, it is the `root` user. This account has complete, unrestricted power over the entire system. It can bypass all file permissions, install/remove any software, and access, modify, or delete any file. Its power is absolute and therefore must be used sparingly and with extreme caution.

The Attack: Preventing Privilege Escalation

Privilege Escalation is the primary goal for an attacker who has gained initial access to a system (e.g., by tricking a user into running a malicious attachment). It is the process of exploiting a vulnerability, bug, or misconfiguration to elevate their access from that of a standard user account to that of an administrative or root account. Once an attacker has root, it is "game over."

Common Privilege Escalation Vectors

  • Kernel Exploits: A vulnerability in the core operating system kernel is exploited to run code with kernel-level (i.e., root) privileges.
  • Vulnerable SUID Executables: Exploiting a legitimate program that is configured to run with the permissions of its owner (root) rather than the user running it.
  • Misconfigured Services: Finding a system service running with excessive privileges that can be manipulated to execute arbitrary commands.
  • Password Hunting: Searching the filesystem as a standard user for plaintext passwords or weak hashes in configuration files or scripts.

Key Defenses Against Escalation

Our entire security model of permissions and rights is designed to make escalation as difficult as possible. The key defenses are:

  • Enforce Least Privilege: This is the most important defense. If a user's account is compromised, but they are a standard user, the attacker's "blast radius" is severely limited. They are trapped within that user's permissions and cannot easily harm the OS.
  • Timely Patch Management: Promptly apply security patches from the OS vendor. Most vertical privilege escalation attacks exploit known vulnerabilities in the OS kernel or system services for which a patch is already available.
  • Use Controlled Elevation (UAC / `sudo`): Never log in directly as Administrator/root for daily tasks. In Windows, User Account Control (UAC) forces a consent prompt. In Linux, the `sudo` command allows an authorized user to run a *specific command* as root, providing a clear audit trail and limiting exposure.
  • Harden System Configurations: Ensure file permissions in critical directories like `/etc` are correct. Do not run services with more privileges than they need. Audit for SUID programs that are not essential.
  • Intrusion Detection/Prevention Systems (IDS/IPS): Monitor system calls and logs for suspicious activity, such as a process attempting to access memory it shouldn't, which can be an indicator of an exploitation attempt.
Modules (30) ← Diploma in Cyber Security