Welcome to Notes Time πŸ‘‹

Notes Time is your trusted platform for free study notes, tutorials, and guides designed to make learning simple, clear, and effective.

Whether you’re exploring Full Stack Web Development, mastering Cyber Security, or diving into Digital Marketing β€” we’ve got you covered with easy-to-understand content and practical examples.

Learn smarter, grow faster, and upskill with Notes Time β€” your digital study companion for tech and career success.

Subscribe to our newsletter and get our newest updates right on your inbox.

Privilege Escalation via Weak File Permissions & Group Membership Abuse

By Himanshu Shekhar Β· 12 Feb 2026

Privilege Escalation via Weak File Permissions & Group Membership Abuse

Privilege Escalation via Weak File Permissions & Group Membership Abuse (Conceptual Overview)

File permissions and group memberships are the foundation of Linux discretionary access control. When permissions are too permissive or users are added to dangerous groups, privilege escalation is often trivial. This is not exploitationβ€”it is simply using the system as configured.

⚠️ Strictly Educational & Defensive: This section explains why weak permissions and dangerous groups are high-risk. No exploitation steps are provided. Focus is on auditing and hardening.

πŸ“ What Are Weak File Permissions?

❌ World-Writable Files

Files where others have write access (permission bit 2).

-rw-rw-rw-   (666)
-rwxrwxrwx   (777)

Any user can modify these files. If they are system binaries, scripts, or configuration files β†’ privilege escalation.

❌ World-Writable Directories

Directories where others can create, delete, or rename files.

drwxrwxrwx   (777)

Allows file replacement, symlink attacks, and privilege escalation via PATH hijacking.


πŸ‘₯ What Are Dangerous Group Memberships?

Group Purpose Risk Defensive Action
docker Run Docker containers Root equivalent Remove all non-admin users
disk Access raw disk devices Read/write any file Never add users to disk group
adm Read system log files Logs may contain secrets Audit log access; restrict membership
shadow Read /etc/shadow Password hash access Only root and shadow group should read
sudo / wheel Administrative group Full sudo access Restrict to authorized admins only
video Access framebuffer devices Screen capture risk Remove non-GUI users
audio Access audio devices Microphone capture risk Remove non-GUI users
🚨 Critical: Membership in docker, disk, or shadow groups should be treated as equivalent to root access. Immediate remediation required.

🧠 How Privilege Escalation Happens (High-Level)

πŸ“ Weak File Permissions
  1. A system file or script has world-writable permissions (e.g., 666, 777)
  2. A low-privilege user modifies the file with malicious content
  3. The file is executed by root or a privileged process (cron, service, admin)
  4. The malicious code runs with elevated privileges
πŸ‘₯ Dangerous Group Membership

🐳 docker group:

docker run -v /:/host -it ubuntu chroot /host bash

Mounts host filesystem β†’ full root

πŸ’Ύ disk group:

debugfs /dev/sda1

Read/write any file, bypassing permissions

πŸ“‹ adm group:

grep "password" /var/log/*

Logs may contain credentials


🌍 Real-World Examples (Defensive View)

πŸ“‹ Example 1: World-Writable /etc/shadow

Misconfiguration: System administrator runs chmod 777 /etc/shadow by accident.

Discovery: Security audit finds /etc/shadow is world-readable and world-writable.

Risk: Any local user can read password hashes OR replace root hash with known password.

Remediation: chmod 640 /etc/shadow; chown root:shadow /etc/shadow

πŸ“‹ Example 2: Developer in Disk Group

Misconfiguration: Developer added to disk group 2 years ago to troubleshoot disk issues.

Account compromise: Developer laptop infected with malware. SSH keys stolen.

Impact: Attacker logs into production server as developer, uses debugfs to read /etc/shadow, cracks root password.

Defense: Quarterly group membership audits. Remove users from disk group. Use sudo for specific disk commands.

πŸ“‹ Example 3: Writable Cron Script

Misconfiguration: Backup script /etc/cron.daily/backup.sh is world-writable (664).

Vulnerability: Any local user can edit the script. Cron runs it as root daily.

Result: Attacker adds chmod 4777 /bin/bash to script. Next day, SUID bash shell available.

Defense: chmod 700 /etc/cron.daily/*; chown root:root /etc/cron.daily/*


πŸ” Detecting Weak Permissions & Dangerous Groups

πŸ“ Permission Audit Commands
  • βœ” find / -type f -perm -0002 -ls 2>/dev/null | grep -v "^/proc" – World-writable files
  • βœ” find / -type d -perm -0002 -ls 2>/dev/null | grep -v "^/proc" – World-writable dirs
  • βœ” find /etc -type f -perm -o+w 2>/dev/null – World-writable config files
  • βœ” find / -type f -perm -4000 -ls 2>/dev/null – SUID binaries
πŸ‘₯ Group Audit Commands
  • βœ” getent group docker – Users in docker group
  • βœ” getent group disk – Users in disk group
  • βœ” getent group adm – Users in adm group
  • βœ” getent group shadow – Users in shadow group
  • βœ” getent group sudo; getent group wheel – Admin users

πŸ›‘οΈ Preventing Weak Permission Escalation

βœ… Permission Hardening Checklist
πŸ“ System Files
  • /etc/passwd – 644
  • /etc/shadow – 640
  • /etc/sudoers – 440
  • /etc/crontab – 600
πŸ“‚ Directories
  • /etc/cron.d – 700
  • /etc/cron.daily – 700
  • /etc/cron.hourly – 700
  • /etc/ssh – 700
πŸ”‘ SSH Keys
  • ~/.ssh/ – 700
  • ~/.ssh/id_rsa – 600
  • ~/.ssh/authorized_keys – 600
βœ… Group Membership Hardening
  • βœ” Docker group: No non-admin users. Use sudo for docker commands.
  • βœ” Disk group: No users except system accounts.
  • βœ” Adm group: Only users who require log access. Consider centralized logging.
  • βœ” Sudo/wheel: Quarterly review; remove inactive admins.
  • βœ” Automated audits: Script weekly checks of dangerous group memberships.
βœ… Golden Rule: No system binary, configuration file, or log file should be writable by non-root users. No standard user should be a member of privileged groups (docker, disk, shadow, adm).

🧾 Key Takeaways

  • βœ” World-writable files are a privilege escalation vector – always fix them
  • βœ” Docker group is root-equivalent – never grant to non-admin users
  • βœ” Disk group allows reading any file – no users should be in this group
  • βœ” Adm group exposes logs that may contain credentials
  • βœ” Automated auditing is required – permissions drift over time
  • βœ” Configuration management (Ansible/Puppet) prevents permission regressions

πŸ“ Weak Permissions & Group Abuse – Command Awareness (Defensive Auditing)

Commands used by system administrators and security teams to audit permissions and group memberships. Shown for defensive hardening and verification only.

⚠️ Awareness only. These commands audit securityβ€”they do not exploit anything.

πŸ” File & Directory Permission Auditing
  • Find all world-writable files (excluding /proc)
    find / -type f -perm -0002 2>/dev/null | grep -v "^/proc"
  • Find all world-writable directories
    find / -type d -perm -0002 2>/dev/null | grep -v "^/proc"
  • Find world-writable files in /etc
    find /etc -type f -perm -o+w 2>/dev/null
    CRITICAL: Any output here is a severe risk
  • Check permissions on critical system files
    ls -la /etc/passwd /etc/shadow /etc/sudoers /etc/crontab
  • Find files with no owner or group
    find / -nouser -o -nogroup 2>/dev/null
    Orphaned files may indicate leftover accounts

πŸ”Ί SUID/SGID Binary Audit
  • Find all SUID binaries
    find / -perm -4000 -type f 2>/dev/null
  • Find all SGID binaries
    find / -perm -2000 -type f 2>/dev/null
  • Find SUID binaries owned by root
    find / -user root -perm -4000 -type f 2>/dev/null
  • Check against GTFOBins risk list
    https://gtfobins.github.io/

πŸ‘₯ Dangerous Group Membership Audit
  • Check docker group
    getent group docker
    Any non-admin user = CRITICAL
  • Check disk group
    getent group disk
    Any non-system user = CRITICAL
  • Check adm group
    getent group adm
    Review necessity; logs may contain secrets
  • Check shadow group
    getent group shadow
    Only root and shadow daemon should be members
  • Check sudo/wheel group
    getent group sudo; getent group wheel
    Quarterly review; remove inactive admins
  • Check video/audio groups
    getent group video; getent group audio
    Remove non-GUI/server users

πŸ›‘οΈ Remediation Commands (Defensive)
  • Fix world-writable file
    sudo chmod o-w /path/to/file
  • Fix world-writable directory
    sudo chmod o-w /path/to/directory
  • Remove user from dangerous group
    sudo gpasswd -d username docker
    sudo gpasswd -d username disk
    sudo gpasswd -d username adm
  • Fix ownership on orphaned files
    sudo chown root:root /path/to/file

πŸ›‘οΈ Defender Takeaways
  • βœ” Audit weekly: World-writable system files, dangerous group memberships
  • βœ” Automate: Cron job to check critical file permissions and alert on changes
  • βœ” Harden: Remove all unnecessary SUID binaries and world-writable files
  • βœ” Group reviews: Quarterly audit of docker, disk, adm, sudo group members
  • βœ” Configuration management: Enforce permissions with Ansible/Puppet
βœ… Weak permissions are 100% preventable. Regular audits and configuration management eliminate this entire class of privilege escalation risk.
πŸ“š

πŸ“š Related Blogs

Privilege Escalation via Writable /etc/passwd & Shadow Abuse

By Himanshu Shekhar Β· 12 Feb 2026

Privilege Escalation via Writable /etc/passwd & Sh...

Privilege Escalation via Docker / Container Escapes

By Himanshu Shekhar Β· 12 Feb 2026

Privilege Escalation via Docker / Container Escape...

Privilege Escalation via Linux Capabilities

By Himanshu Shekhar Β· 10 Feb 2026

Privilege Escalation via Linux Capabilities (Conce...

Privilege Escalation via SUID (Conceptual Guide)

By Himanshu Shekhar Β· 10 Feb 2026

Privilege Escalation via SUID (Conceptual Overview...

DC-1 VulnHub: Drupal 7 Exploitation and SUID Privilege Escalation

By Himanshu Shekhar Β· 10 Feb 2026

DC-1 VulnHub Walkthr...

Privilege Escalation via Misconfigured NFS

By Himanshu Shekhar Β· 10 Feb 2026

Privilege Escalation via Misconfigured NFS (Concep...

Privilege Escalation via PATH Variable Manipulation

By Himanshu Shekhar Β· 10 Feb 2026

Privilege Escalation via PATH Variable Manipulatio...

Privilege Escalation via Cron Jobs

By Himanshu Shekhar Β· 10 Feb 2026

Privilege Escalation via Cron Jobs...

TryHackMe BLOG Room – Full Walkthrough

By Himanshu Shekhar Β· 10 Feb 2026

πŸ§ͺ TryHackMe – BLOG Room (Full Lab Walkthrough)...

Active Directory Domain Services – Setup Windows Server Conceptual

By Himanshu Shekhar Β· 10 Feb 2026

πŸ› οΈ Step-by-Step: Set...

Privilege Escalation via Kernel Vulnerabilities

By Himanshu Shekhar Β· 10 Feb 2026

Privilege Escalation via Kernel Vulnerabilities...

Privilege Escalation via Sudo Misconfiguration

By Himanshu Shekhar Β· 10 Feb 2026

Privilege Escalation via Sudo (Conceptual Overv...

+