- Module Overview
- Environment Enumeration
- Services & Internals Enumeration
- Credential Hunting
- PATH Abuse
- Wildcard Abuse
- Escaping Restricted Shells
- Special Permissions
- Sudo Rights Abuse
- Privileged Groups
- Capabilities
- Vulnerable Services
- Cron Job Abuse
- LXD Container Escape
- Docker Container Escape
- Logrotate Exploitation
- Miscellaneous Techniques
- Shared Libraries
- Shared Object Hijacking
- Python Library Hijacking
- Sudo CVE Exploits
- Polkit/Pwnkit
- Dirty Pipe
- Netfilter Kernel Exploits
- Linux Hardening
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Module Overview
🎯 Overview
This module covers comprehensive Linux privilege escalation techniques, methodologies, and tools. Linux privilege escalation is a critical skill for penetration testers, as it allows gaining elevated access on compromised Linux systems through various attack vectors.⚠️ Note: Module includes advanced kernel exploitation techniques that should be used with extreme caution and proper understanding of system stability risks.
📚 Module Structure
🚀 Getting Started
Prerequisites
- Basic Linux Knowledge: Command line familiarity
- Initial Access: Shell on target Linux system
- Methodology Understanding: Systematic approach to enumeration
- Tool Familiarity: Common privilege escalation tools
Attack Flow
📋 Module Content
✅ Completed Sections
📊 Complete Coverage: 24 privilege escalation techniques from basic enumeration to advanced kernel exploitation
🔍 Environment Enumeration
- System Information Gathering - OS version, kernel, hardware details
- User and Group Analysis - Account enumeration and permission mapping
- Network Configuration - Interface analysis and internal network discovery
- File System Analysis - Mounted drives, hidden files, temporary directories
- Security Controls Detection - Firewall, SELinux, AppArmor identification
- Initial Reconnaissance Checklist - Systematic enumeration workflow
🔧 Services & Internals Enumeration
- Running Services Analysis - Process enumeration and service identification
- User Activity Investigation - Login history, current users, command history
- Scheduled Tasks Discovery - Cron jobs, systemd timers, automation scripts
- Installed Software Assessment - Package analysis and GTFObins cross-reference
- Configuration File Discovery - System configs, application settings, credentials
- Process Investigation - System calls, memory analysis, /proc filesystem
🔍 Credential Hunting
- File System Credential Search - Configuration files, scripts, backups with stored secrets
- SSH Key Discovery - Private keys, known_hosts analysis, lateral movement opportunities
- Database Credential Extraction - WordPress, MySQL, PostgreSQL, application databases
- History File Investigation - Bash history, command logs, user activity traces
- Advanced Discovery Techniques - Memory analysis, environment variables, process inspection
🛤️ PATH Abuse
- PATH Variable Manipulation - Directory precedence exploitation and command hijacking
- Writable Directory Detection - PATH enumeration and write permission analysis
- Script Hijacking Techniques - Sudo scripts, cron jobs, and relative command exploitation
- Binary Substitution Attacks - Malicious script creation and execution interception
🌟 Wildcard Abuse
- Shell Wildcard Exploitation - Argument injection through filename expansion
- tar Command Abuse - checkpoint-action exploitation for command execution
- Cron Job Targeting - Automated wildcard script exploitation
- Command Injection Payloads - Sudo privilege escalation and SUID binary creation
🚪 Escaping Restricted Shells
- SSH Bypass Techniques - Remote shell restriction circumvention
- Command Substitution Escapes - Backtick and $() exploitation
- Environment Variable Abuse - SHELL and PATH variable manipulation
- Built-in Command Exploitation - Vi, less, man page escape sequences
🔐 Special Permissions
- SUID/SGID Binary Discovery - Finding and enumerating special permission files
- GTFOBins Exploitation - Leveraging known privilege escalation binaries
- Common Binary Abuse - Text editors, interpreters, file utilities exploitation
- Custom Binary Analysis - Reverse engineering and shared library hijacking
⚡ Sudo Rights Abuse
- Sudo Permission Enumeration - Identifying misconfigured sudo privileges
- GTFOBins Sudo Exploitation - Text editors, interpreters, system tools abuse
- Advanced Sudo Techniques - Command injection, wildcard abuse, environment manipulation
👑 Privileged Groups
- Container Group Exploitation - LXD/LXC and Docker group privilege escalation
- System Group Abuse - Disk, ADM, shadow group privilege vectors
- Direct Root Access - Container mounting and raw device manipulation
🎭 Capabilities
- Capability Enumeration - Finding binaries with dangerous capability assignments
- File Permission Bypass - cap_dac_override exploitation for system file modification
- UID/GID Manipulation - cap_setuid/cap_setgid abuse for privilege escalation
⚙️ Vulnerable Services
- Service Version Enumeration - Identifying outdated software with known vulnerabilities
- Screen 4.5.0 Exploitation - CVE-2017-5618 ld.so.preload overwrite attack
- Common Service CVEs - Apache, Nginx, MySQL, SSH, Sudo vulnerability identification
⏰ Cron Job Abuse
- Cron Job Discovery - Finding scheduled tasks and writable script identification
- Process Monitoring - pspy usage for cron job pattern detection
- Script Modification Attacks - Command injection and reverse shell payloads
🐳 LXD Container Escape
- LXD Group Exploitation - Container manager privilege escalation techniques
- Privileged Container Creation - Host filesystem mounting and root access
- Container Image Management - Importing and utilizing existing container images
🐋 Docker Container Escape
- Docker Group Exploitation - Container runtime privilege escalation techniques
- Host Filesystem Mounting - Volume mounting for direct host access
- Privileged Container Execution - Bypassing container isolation mechanisms
📜 Logrotate Exploitation
- Logrotate Vulnerability Assessment - Version identification and prerequisite verification
- Logrotten Exploit Execution - Race condition exploitation for privilege escalation
- Configuration Mode Analysis - Create vs compress mode detection and exploitation
🔧 Miscellaneous Techniques
- Passive Traffic Capture - Network sniffing for credential extraction using tcpdump
- Weak NFS Privileges - no_root_squash exploitation for SUID binary upload
- Tmux Session Hijacking - Privileged session attachment through weak socket permissions
📚 Shared Libraries
- LD_PRELOAD Exploitation - Environment variable abuse for shared library injection
- Malicious Library Creation - Custom shared object compilation and deployment
- Sudo Environment Bypass - Transforming safe commands into privilege escalation vectors
🎯 Shared Object Hijacking
- RUNPATH Directory Exploitation - Writable library path hijacking in SUID binaries
- Custom Library Injection - Missing function implementation for privilege escalation
- Binary Dependency Analysis - ldd and readelf usage for vulnerability identification
🐍 Python Library Hijacking
- Python Module Import Exploitation - sys.path manipulation and module precedence abuse
- PYTHONPATH Environment Abuse - Environment variable manipulation for import redirection
- Writable Module Directory Hijacking - Higher-priority path exploitation for code injection
🚨 Sudo CVE Exploits
- CVE-2021-3156 Baron Samedit - Heap buffer overflow exploitation for immediate root access
- CVE-2019-14287 Policy Bypass - Negative user ID exploitation for privilege escalation
- Version-Specific Exploitation - OS and sudo version correlation for successful exploitation
🔐 Polkit/Pwnkit
- CVE-2021-4034 Pwnkit Exploitation - Memory corruption in pkexec for universal privilege escalation
- Polkit Authorization Bypass - PolicyKit service vulnerability affecting most Linux distributions
- Zero-Prerequisite Escalation - Any local user exploitation without special permissions
💧 Dirty Pipe
- CVE-2022-0847 Kernel Exploitation - Pipe mechanism abuse for arbitrary file writes as root
- Kernel Version Targeting - Vulnerability affecting Linux kernels 5.8-5.17
- File Modification Attacks - /etc/passwd modification and SUID binary hijacking techniques
🌐 Netfilter Kernel Exploits (Advanced)
- Multiple Kernel CVEs - CVE-2021-22555, CVE-2022-25636, CVE-2023-32233 exploitation
- Wide Kernel Range Coverage - Targeting kernels from 2.6 to 6.3.1 versions
- High-Risk Exploitation - Kernel-level attacks with system stability considerations
🛡️ Linux Hardening
- Defensive Security Measures - Comprehensive hardening practices and configuration management
- Update Management - Kernel and package update strategies for vulnerability mitigation
- Security Auditing - Lynis scanner usage and custom hardening validation scripts
🎯 Module Complete
This comprehensive Linux Privilege Escalation module covers 24 complete techniques ranging from basic enumeration to advanced kernel exploitation, providing thorough coverage of all major privilege escalation vectors in Linux environments. Skill progression: Basic enumeration → Configuration attacks → Service exploitation → Container escapes → Kernel exploits → Defensive hardening🛠️ Tools and Techniques
Manual Enumeration
- System Commands: uname, id, whoami, sudo -l
- File System: find, ls, cat, grep
- Network: ifconfig, netstat, route, arp
- Process: ps, top, systemctl, service
Automated Tools
- LinPEAS: Comprehensive Linux enumeration
- LinEnum: Classic privilege escalation enumeration
- linux-smart-enumeration: Intelligent selective enumeration
- PEASS-ng: Advanced privilege escalation suite
Exploitation Frameworks
- Metasploit: Post-exploitation modules
- GTFOBins: Living off the land binaries
- ExploitDB: Public exploit database
- Custom Scripts: Tailored enumeration and exploitation
- Kernel Exploits: CVE-specific exploits (⚠️ High risk - use with caution)
🎯 Learning Objectives
By completing this module, you will be able to:- Perform systematic environment enumeration on Linux systems
- Identify privilege escalation vectors through various attack surfaces
- Exploit common misconfigurations to gain elevated privileges
- Utilize automated tools effectively while understanding manual techniques
- Maintain persistence after successful privilege escalation
- Document findings professionally for penetration test reports
🛡️ Defensive Considerations
Common Misconfigurations
- Excessive sudo permissions
- Writable files in PATH
- SUID binaries on sensitive executables
- Unpatched kernel vulnerabilities
- Service running as root unnecessarily
Hardening Recommendations
- Regular system updates and patching (especially kernel updates)
- Principle of least privilege enforcement
- File permission auditing
- Service account isolation
- Monitoring and logging implementation
- Special attention to kernel exploits - Advanced techniques require careful testing
📖 Prerequisites Knowledge
Linux Fundamentals
- Command line navigation
- File system structure
- User and group concepts
- Process management
- Network configuration basics
Security Concepts
- Unix permissions model
- SUID/SGID concepts
- Service architecture
- Kernel space vs user space
- Authentication and authorization
🏆 Success Metrics
Skill Development Goals
- Manual Enumeration Proficiency: Perform thorough recon without tools
- Attack Vector Recognition: Identify privilege escalation opportunities
- Tool Integration: Combine manual and automated techniques effectively
- Stealth Operations: Conduct enumeration without detection
- Documentation Skills: Create comprehensive findings reports
Practical Milestones
- Successfully escalate privileges on various Linux distributions
- Identify and exploit SUID/SGID vulnerabilities
- Abuse service misconfigurations for privilege escalation
- Utilize kernel exploits safely and effectively (with caution for advanced techniques)
- Establish persistent elevated access
- Master 24 different privilege escalation techniques including advanced kernel exploits and defensive hardening
This Linux Privilege Escalation module provides comprehensive coverage of techniques, tools, and methodologies for gaining elevated privileges on Linux systems, essential for penetration testers and security professionals.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Environment Enumeration
🎯 Overview
Environment enumeration is the foundation of successful Linux privilege escalation. After gaining initial access to a Linux host, systematic enumeration helps identify potential attack vectors, misconfigurations, and valuable information that can lead to privilege escalation.“Enumeration is the key to privilege escalation. Understanding what pieces of information to look for and being able to perform enumeration manually is crucial for success.”
🚀 Initial Situational Awareness
Fundamental Orientation Commands
Before diving deep into enumeration, establish basic situational awareness:- Documentation: Screenshots provide evidence of successful RCE
- System Identification: Clearly identify the affected system
- Quick Wins:
sudo -lcan sometimes provide immediate escalation paths
🔍 Operating System Enumeration
System Version Detection
Check OS Distribution and Version:- Distribution Type: Ubuntu, CentOS, Debian, SUSE, etc.
- Version Currency: Is the system maintained or end-of-life?
- LTS Status: Long Term Support versions typically more secure
- Release Lifecycle: Check if version has known vulnerabilities
Alternative OS Detection Methods
⚙️ System Environment Analysis
PATH Variable Examination
Check Current PATH:- PATH Hijacking: Writable directories in PATH can be exploited
- Custom Paths: Non-standard paths may contain vulnerable binaries
- Order Matters: Earlier directories take precedence
Environment Variables
Enumerate All Environment Variables:- Database passwords
- API keys
- Service credentials
- Custom application secrets
🔧 Kernel and Hardware Information
Kernel Version Analysis
Get Kernel Information:- Kernel Version: 5.4.0-122-generic
- Build Date: Wed Jun 22 15:00:31 UTC 2022
- Architecture: x86_64
- Distribution: Ubuntu
CPU and Hardware Details
CPU Information:🐚 Available Shells and Interpreters
Login Shell Enumeration
Available Shells:- Shell Vulnerabilities: Older bash versions vulnerable to Shellshock
- Restricted Shells: rbash may limit command execution
- Session Management: tmux/screen available for persistence
- Interpreter Versions: Check for vulnerable versions
🛡️ Security Controls Detection
Identify Active Security Mechanisms
Common Security Tools to Check:- Attack Vector Selection: Avoid triggering active defenses
- Stealth Considerations: Understand monitoring capabilities
- Privilege Requirements: Some enumeration requires elevated privileges
💾 Storage and File System Analysis
Block Device Enumeration
List Block Devices:- Additional Drives: Unmounted drives may contain sensitive data
- LVM Configuration: Logical volume management
- Loop Devices: Snap packages and containers
- USB/External: Removable media
Mounted File Systems
Current Mounts:- Credentials in fstab: Embedded passwords for network shares
- Unusual Mounts: NFS, SMB shares with interesting permissions
- Temporary Mounts: Recently mounted drives
Unmounted File Systems
Check for Unmounted Devices:- Backup Drives: May contain sensitive historical data
- Development Partitions: Source code and credentials
- Hidden Partitions: Deliberately concealed data
🌐 Network Configuration Analysis
Network Interface Information
Interface Configuration:Network Reconnaissance
ARP Table Analysis:- Internal Networks: Identify additional network segments
- Domain Environment: DNS servers may indicate Active Directory
- Communication Patterns: ARP table shows recent host interactions
- Service Discovery: Listening services and their processes
👥 User and Group Enumeration
User Account Analysis
All System Users:| Algorithm | Hash Format |
|---|---|
| Salted MD5 | $1$... |
| SHA-256 | $5$... |
| SHA-512 | $6$... |
| BCrypt | $2a$... |
| Scrypt | $7$... |
| Argon2 | $argon2i$... |
Group Membership Analysis
All Groups:🏠 Home Directory Investigation
User Home Directories
List Home Directories:🔍 Hidden Files and Directories
Comprehensive Hidden File Search
All Hidden Files:.bashrc,.bash_profile,.profile.vimrc,.nanorc.ssh/config,.ssh/known_hosts.mysql_history,.lesshst.wget-hsts,.gitconfig
📁 Temporary Files and Directories
Temporary File Analysis
Standard Temporary Directories:/tmp: Files deleted after 10 days or on reboot/var/tmp: Files retained up to 30 days/dev/shm: In-memory filesystem, lost on reboot
📋 Systematic Enumeration Checklist
Phase 1: Basic Orientation
- Run
whoami,id,hostname - Check
sudo -lfor immediate privilege escalation - Document network position with
ifconfig - Screenshot basic system info
Phase 2: System Information
- OS version and distribution (
/etc/os-release) - Kernel version (
uname -a) - Available shells (
/etc/shells) - CPU and memory information (
lscpu,free -h)
Phase 3: Environment Analysis
- PATH variable enumeration (
echo $PATH) - Environment variables (
env) - Security controls detection
- Network configuration (
route,arp -a)
Phase 4: User and Permission Analysis
- User enumeration (
/etc/passwd) - Group analysis (
/etc/group) - Home directory investigation
- SSH key discovery
Phase 5: File System Analysis
- Mounted file systems (
df -h,mount) - Hidden files and directories
- Temporary file analysis
- Block device enumeration (
lsblk)
Phase 6: Documentation and Analysis
- Compile sensitive findings
- Test discovered credentials
- Plan privilege escalation approach
- Document attack vectors
💡 Key Findings to Look For
High-Impact Discoveries
Immediate Privilege Escalation:sudo -lshowing passwordless commands- SUID binaries with known exploits
- Writable files in PATH
- Kernel version with public exploits
- Passwords in configuration files
- SSH private keys
- Database credentials
- API keys and tokens
- Vulnerable services running as root
- Misconfigured file permissions
- Unpatched software versions
- Interesting cron jobs
- Multiple network interfaces
- SSH keys for other systems
- Database connections
- Internal service discovery
⚠️ Common Pitfalls and Considerations
Enumeration Best Practices
Stealth Considerations:- Some commands may generate logs
- Avoid running as root unless necessary
- Be mindful of file access times
- Consider detection mechanisms
- Kernel exploits can crash systems
- Be careful with production environments
- Test in controlled settings first
- Have backup access methods
- Balance comprehensive enumeration with time constraints
- Prioritize high-impact areas first
- Use automation tools as supplements
- Develop efficient manual workflows
🛠️ Automation and Tools
Manual vs. Automated Enumeration
When to Use Manual Enumeration:- Learning and understanding system internals
- Customized searches based on findings
- Stealth requirements
- Limited tool availability
- LinPEAS: Comprehensive Linux enumeration
- LinEnum: Classic enumeration script
- linux-smart-enumeration: Selective enumeration
- PEASS-ng: Advanced privilege escalation
- Perform initial manual enumeration
- Run automated tools for comprehensive coverage
- Cross-reference findings
- Focus manual investigation on promising vectors
📚 Next Steps
After completing environment enumeration, proceed to:- Permissions-based Privilege Escalation: File permissions, SUID/SGID
- Service-based Privilege Escalation: Running services and processes
- Configuration-based Attacks: Misconfigurations and weak settings
- Kernel Exploitation: Operating system vulnerabilities
- Application-specific Attacks: Vulnerable installed software
Environment enumeration provides the foundation for all subsequent privilege escalation attempts. Thorough initial reconnaissance significantly increases the likelihood of successful privilege escalation and helps identify the most efficient attack paths.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Services & Internals Enumeration
🎯 Overview
Deep enumeration of running services, internal processes, user activities, and system internals to identify privilege escalation vectors and attack opportunities.🌐 Network Internals
Network Interfaces & Connectivity
👥 User Activity Analysis
Login History & Current Users
- Active admin users
- Login patterns and timing
- Remote connections (SSH sessions)
- Shared accounts
Command History Investigation
⏰ Scheduled Tasks & Automation
Cron Job Enumeration
- Scripts running as root
- Writable paths in cron jobs
- File permission issues
- Backup scripts with credentials
📦 Installed Software & Packages
Package Analysis
GTFObins Cross-Reference
🔍 Process & Service Analysis
Running Processes
Process Investigation
📁 Configuration & Script Discovery
Configuration Files
Script Discovery
🔍 System Internals
/proc Filesystem Analysis
File System Details
🛠️ Available Tools Assessment
Development Tools
Useful Binaries for Privesc
📊 Quick Enumeration Script
🎯 Key Targets to Identify
High-Value Information
- Active admin sessions - Target for credential stealing
- Vulnerable services - Running as root with known CVEs
- Scheduled tasks - Cron jobs with misconfigurations
- Config files - Containing passwords or sensitive data
- Development tools - Compilers for exploit compilation
- Network tools - For lateral movement and pivoting
Attack Vector Prioritization
- SUID/SGID binaries with GTFObins entries
- Root processes with configuration vulnerabilities
- Writable cron jobs or scripts executed by root
- Readable config files with embedded credentials
- Development environments with compilation capabilities
Services and internals enumeration reveals the operational heartbeat of the system - identifying running processes, user activities, and system configurations that can be leveraged for privilege escalation.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Credential Hunting
🎯 Overview
Systematic search for stored credentials across the Linux file system. Credentials may be found in configuration files, scripts, history files, backups, databases, and various application-specific locations.📁 Common Credential Locations
Configuration Files
WordPress Database Credentials
🔑 SSH Key Discovery
SSH Key Locations
SSH Key Analysis
📝 History & Log Files
Command History Files
Log File Investigation
🗃️ Backup & Archive Files
Backup File Discovery
💾 Database & Application Files
Database Credential Hunting
Web Application Files
📧 Mail & Spool Directories
Mail System Investigation
🔍 Comprehensive Credential Search
File Content Search
Specific Application Hunting
🔐 Advanced Credential Discovery
Environment Variables & Memory
Hidden & Dot Files
🚀 Quick Credential Hunt Script
🎯 High-Value Target Files
Priority File Types
Common Credential Patterns
🔑 Password Validation
Test Discovered Credentials
⚠️ Credential Security
What to Look For
- Plaintext passwords in config files
- Connection strings with embedded credentials
- SSH private keys without passphrases
- Database credentials for privilege escalation
- Service account passwords for lateral movement
Common Mistakes
- WordPress
wp-config.phpwith default credentials - Backup files containing production passwords
- Development configs deployed to production
- SSH keys in world-readable locations
- Passwords in bash history or scripts
Credential hunting transforms file system enumeration into actionable intelligence - discovering stored secrets that enable privilege escalation and lateral movement throughout the target environment.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
PATH Abuse
🎯 Overview
PATH environment variable manipulation to achieve privilege escalation by hijacking command execution through directory precedence and writable path exploitation.📍 PATH Variable Basics
Understanding PATH
- System searches directories left to right
- First match gets executed
- Absolute paths bypass PATH lookup
- Relative commands use PATH resolution
🎯 PATH Hijacking Attack Vectors
Current Directory Injection
Writable Directory Exploitation
🔧 Common Attack Scenarios
Scenario 1: Sudo Script with Relative Commands
Scenario 2: Cronjob Path Manipulation
🎭 Script and Binary Hijacking
Common Target Commands
Malicious Script Templates
🔍 Enumeration Techniques
PATH Analysis
Writable Directory Detection
Vulnerable Script Detection
🚀 Exploitation Examples
Basic PATH Hijacking
Cronjob PATH Exploitation
🔍 Detection & Enumeration
Quick PATH Audit
⚠️ Defensive Considerations
Secure PATH Practices
Common Vulnerabilities
- Current directory (.) in PATH - Most dangerous
- Writable directories in PATH - Exploitation opportunity
- Scripts using relative commands - Hijacking targets
- User-modifiable PATH - Attack vector
🔑 Key Attack Points
High-Impact Scenarios
- Sudo scripts with relative commands + writable PATH directory
- Cron jobs executing scripts with relative paths
- SUID binaries calling other programs without absolute paths
- User scripts with PATH manipulation capabilities
Quick Wins
- Check
sudo -lfor scripts - Look for writable directories in PATH
- Find scripts with relative command calls
- Test PATH modification permissions
PATH abuse exploits the fundamental way Linux systems locate executables - by manipulating the search order, attackers can hijack command execution and escalate privileges through legitimate system mechanisms.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Wildcard Abuse
🎯 Overview
Wildcard characters (*, ?, []) interpreted by shell can be abused to inject command arguments in scripts and cron jobs for privilege escalation.
🌟 Wildcard Characters
| Character | Function |
|---|---|
* | Matches any number of characters |
? | Matches single character |
[] | Matches characters in brackets |
~ | User home directory |
- | Range in brackets |
🎯 tar Command Abuse (Most Common)
Vulnerable Cron Job Example
Exploitation Steps
* expands to all filenames, making tar execute:
🔧 Other Vulnerable Commands
rsync Abuse
chown Abuse
🔍 Detection & Enumeration
Find Vulnerable Scripts
Quick Check Script
🚀 Common Payloads
Add Sudo Privileges
Create SUID Binary
Reverse Shell
🔑 Key Points
- Wildcards expand to filenames - creating fake arguments
- tar is most common target -
--checkpoint-action=exec - Works with cron jobs - automatic execution as different user
- File creation required - need write access to target directory
- Timing matters - wait for scheduled execution
Wildcard abuse turns shell expansion features against the system - transforming filename globbing into arbitrary command execution for privilege escalation.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Escaping Restricted Shells
🎯 Overview
Techniques to break out of restricted shells (rbash, rksh, rzsh) that limit command execution, directory changes, and environment modification.🔒 Restricted Shell Types
| Shell | Description |
|---|---|
| rbash | Restricted Bourne shell - limits cd, PATH modification |
| rksh | Restricted Korn shell - blocks shell functions, command execution |
| rzsh | Restricted Z shell - prevents aliases, script execution |
🚪 Escape Techniques
SSH Bypass Methods
Command Injection
Environment Variable Manipulation
Built-in Command Abuse
Shell Function Exploitation
🔧 Advanced Bypass Techniques
Character Escaping
Alternative Interpreters
File-based Escapes
🔍 Enumeration & Detection
Identify Restricted Shell
Quick Escape Test Script
🚀 Practical Examples
HTB Academy Example
Common Escape Sequence
🔑 Quick Reference
Most Effective Methods
- SSH bypass:
ssh user@host -t "bash --noprofile" - Command substitution:
ls $(bash) - Environment escape:
$0or$SHELL - Vi/editor escape:
:!/bin/bash - Python spawn:
python -c "import pty; pty.spawn('/bin/bash')"
Emergency Escapes
Restricted shell escapes exploit the fundamental tension between security restrictions and functional requirements - finding gaps in command limitations to restore full shell capabilities.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Special Permissions
🎯 Overview
SUID and SGID special permissions allow programs to execute with elevated privileges, providing potential privilege escalation vectors through vulnerable or misconfigured binaries.🔍 Permission Types
SUID (Set User ID)
- Symbol:
sin user execute position - Function: Execute program with owner’s privileges
- Risk: If owner is root, program runs as root
SGID (Set Group ID)
- Symbol:
sin group execute position - Function: Execute program with group’s privileges
- Risk: Inherit group permissions during execution
🔍 Enumeration Commands
Find SUID Binaries
Find SGID Binaries
Common SUID/SGID Locations
🎯 GTFOBins Exploitation
High-Risk SUID Binaries
Quick GTFOBins Check
🚀 Common Exploitation Examples
nano/vim SUID Exploitation
find SUID Exploitation
python SUID Exploitation
less/more SUID Exploitation
🔧 Advanced Techniques
Custom SUID Binary Analysis
Shared Library Hijacking
📋 Enumeration Script
🔑 Quick Exploitation Reference
Immediate Privilege Escalation
Emergency Escalation Commands
🛡️ Defensive Considerations
Dangerous SUID Configurations
- Text editors (nano, vim) with SUID
- Interpreters (python, perl) with SUID
- File utilities (find, cp, mv) with SUID
- Custom applications in user directories
Hardening Recommendations
Special permissions create powerful attack vectors - SUID and SGID bits can transform ordinary binaries into privilege escalation tools when combined with GTFOBins techniques.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Sudo Rights Abuse
🎯 Overview
Sudo privilege misconfigurations allow users to execute commands as root or other users, often providing direct privilege escalation vectors through GTFOBins exploitation.🔍 Sudo Enumeration
Check Sudo Privileges
Sudo Configuration Files
🎯 Common Vulnerable Sudo Entries
High-Risk Commands
🚀 GTFOBins Exploitation
Text Editor Abuse
System Command Abuse
Interpreter Abuse
🔧 Advanced Sudo Abuse
tcpdump Postrotate Exploitation
Command Injection in Arguments
Wildcard Abuse in Sudo
🔍 Enumeration & Discovery
Sudo Audit Script
Specific Command Analysis
🔑 Quick Reference
Immediate Escalation Commands
Emergency Sudo Checks
⚠️ Dangerous Sudo Configurations
Red Flags
- NOPASSWD entries - No authentication required
- Wildcard permissions -
*in command paths - Text editors - Direct root shell access
- Interpreters - Full system access
- ALL permissions -
(ALL) ALLentries
Privilege Escalation Vectors
- Direct shell access - vim, nano, less
- Command execution - find, awk, sed with -exec
- File manipulation - cp, mv to overwrite system files
- Library hijacking - LD_PRELOAD with sudo
- Environment variables - Exploiting env_keep settings
Sudo misconfigurations are among the most common privilege escalation vectors - a single poorly configured sudo entry can provide immediate root access through GTFOBins exploitation.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Privileged Groups
🎯 Overview
Certain Linux groups provide elevated privileges that can be exploited for privilege escalation through container access, disk manipulation, or administrative file access.🐳 High-Risk Groups
LXD Group
Impact: Container root = host rootDocker Group
Impact: Host filesystem access via containersDisk Group
Impact: Raw device accessADM Group
Impact: Log file access🚀 Quick Exploitation
LXD Privilege Escalation
Docker Escalation
Other Dangerous Groups
🔍 Group Enumeration
Check All User Groups
Privileged Group Detection Script
🔑 Quick Reference
Immediate Checks
Emergency Escalation
Privileged group membership often provides immediate privilege escalation paths - container access, disk manipulation, and administrative file access can lead directly to root privileges.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Capabilities
🎯 Overview
Linux capabilities provide fine-grained privileges to processes. Misconfigured capabilities on binaries can be exploited for privilege escalation without requiring SUID bits.🔍 Enumeration
Find Binaries with Capabilities
🔑 Dangerous Capabilities
High-Risk Capabilities
| Capability | Impact |
|---|---|
cap_setuid | Change effective UID to any user (including root) |
cap_setgid | Change effective GID to any group |
cap_sys_admin | Broad administrative privileges |
cap_dac_override | Bypass file read/write/execute permissions |
Other Notable Capabilities
🚀 Exploitation Examples
cap_dac_override (File Permission Bypass)
cap_setuid (UID Manipulation)
cap_sys_admin (Administrative Access)
🔧 Advanced Exploitation
Non-interactive File Editing
Python/Interpreter Capabilities
🔍 Detection Script
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
Capabilities provide fine-grained privilege control but misconfigured capability assignments can offer direct privilege escalation paths without traditional SUID requirements.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Vulnerable Services
🎯 Overview
Installed services with known vulnerabilities can provide privilege escalation vectors. Version identification and exploit matching are key to discovering these opportunities.📺 Screen Privilege Escalation (CVE-2017-5618)
Vulnerability Details
- Affected: GNU Screen version 4.5.0
- Impact: Local privilege escalation to root
- Method: ld.so.preload file overwrite vulnerability
Version Check
Exploitation
🔍 Service Enumeration
Version Identification
Package Version Check
🚨 Common Vulnerable Services
Screen 4.5.0
- CVE: CVE-2017-5618
- Exploit: ld.so.preload overwrite
- Impact: Root shell
Apache/Nginx
MySQL/MariaDB
SSH
🔧 Exploitation Framework
Service Exploit Workflow
Quick Vulnerability Check
🎯 Exploitation Targets
High-Impact Services
- Screen 4.5.0 - Direct root exploit
- Apache < 2.4.30 - Various module vulnerabilities
- MySQL/MariaDB - UDF exploitation if root
- Sudo < 1.9.5 - Multiple CVEs available
- OpenSSH - Various authentication bypasses
Service-Specific Exploits
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
Vulnerable services provide direct privilege escalation opportunities - outdated software versions combined with known exploits often result in immediate root access.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Cron Job Abuse
🎯 Overview
Misconfigured cron jobs running as root with writable scripts provide privilege escalation opportunities through script modification and command injection.🔍 Cron Job Enumeration
Find Cron Jobs
Find Writable Scripts
🕵️ Process Monitoring with pspy
Install and Run pspy
Identify Cron Patterns
🎯 Exploitation Techniques
Script Modification
Timing Analysis
🚀 Common Payloads
Reverse Shell
Privilege Escalation
File Extraction
🔧 Advanced Techniques
Stealth Modifications
Conditional Payloads
📋 Detection Script
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
Timing Patterns
Cron job abuse exploits automated administrative tasks - writable scripts executed as root provide direct privilege escalation through command injection and script modification.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
LXD Container Escape
🎯 Overview
LXD (Linux Daemon) container manager can be exploited for privilege escalation when user is member oflxd group through privileged container creation and host filesystem mounting.
🔍 Prerequisites
Check LXD Group Membership
🚀 Exploitation Methods
Method 1: Existing Container Image
Method 2: Import Custom Image
Method 3: Build Alpine Image (if needed)
🔧 LXD Initialization
First-time Setup
🎯 Post-Exploitation
Host System Access
🔍 Detection & Enumeration
Quick LXD Check Script
LXD Service Check
🔑 Quick Reference
Immediate Checks
Emergency Escalation
One-liner Escalation
⚠️ Defensive Considerations
LXD Security Issues
- Group membership automatically grants container privileges
- Privileged containers bypass security isolation
- Host filesystem access via device mounting
- No password required for lxd group members
Hardening Recommendations
LXD group membership provides a direct path to root privileges through privileged container creation - the isolation boundary disappears when containers can mount the host filesystem with root access.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Docker Container Escape
🎯 Overview
Docker group membership provides equivalent root access to host filesystem through container mounting and privileged container execution.🔍 Prerequisites
Check Docker Group Membership
Docker Service Status
🚀 Exploitation Methods
Method 1: Mount Host Filesystem
Method 2: Privileged Container
Method 3: Direct Host Shell
🔧 Docker Image Management
Available Images
Pull and Use Images
🎯 Post-Exploitation
Host System Access
Escape Verification
🔍 Detection & Enumeration
Quick Docker Check Script
Docker Socket Check
🔑 Quick Reference
Immediate Checks
Emergency Escalation
One-liner Escalation
🔧 Advanced Techniques
Container Breakout
Persistence Methods
⚠️ Defensive Considerations
Docker Security Issues
- Group membership = root equivalent access
- Host filesystem mounting bypasses all isolation
- Privileged containers disable security features
- No authentication required for group members
Hardening Recommendations
Docker group membership eliminates container isolation - privileged containers with host mounts provide immediate root access to the underlying host system.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Logrotate Exploitation
🎯 Overview
Logrotate vulnerability (CVE-2011-1548, CVE-2011-1154) in specific versions allows privilege escalation through log file manipulation and race condition exploitation.🔍 Prerequisites
Required Conditions
Configuration Analysis
🚀 Exploitation with Logrotten
Download and Compile Exploit
Create Payload
Execute Exploit
HTB Academy Lab Example
🔧 Configuration Mode Detection
Determine Logrotate Mode
Mode-Specific Exploitation
🕐 Timing and Execution
Cron Schedule Analysis
Manual Triggering (if possible)
🔍 Detection & Enumeration
Logrotate Vulnerability Check
Log File Analysis
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
⚠️ Exploit Limitations
Requirements Summary
- Vulnerable logrotate version (specific versions only)
- Write permissions on target log files
- Logrotate execution as privileged user
- Timing dependency on cron schedule
Success Factors
- Daily cron execution - Most common schedule
- Large log files - More likely to trigger rotation
- Active logging - Files that actually get rotated
- Correct configuration mode - create vs compress
Logrotate exploitation leverages race conditions in log management - when logrotate runs as root with writable log files, the logrotten exploit can hijack the rotation process for privilege escalation.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Miscellaneous Techniques
🎯 Overview
Additional Linux privilege escalation techniques including traffic capture, NFS exploitation, and tmux session hijacking for comprehensive privilege escalation coverage.📡 Passive Traffic Capture
Network Sniffing for Credentials
Tools for Credential Extraction
🗂️ Weak NFS Privileges
NFS Export Enumeration
Check NFS Configuration
NFS Privilege Escalation
📺 Tmux Session Hijacking
Find Tmux Sessions
Session Hijacking
Create Hijackable Session (for persistence)
🔍 Detection & Enumeration
Miscellaneous Techniques Check
NFS Specific Enumeration
🚀 Quick Exploitation Reference
Immediate Opportunities
Emergency Techniques
🔑 Key Points
Traffic Capture Value
- Cleartext protocols - HTTP, FTP, Telnet, SMTP
- Authentication hashes - NTLM, Kerberos for cracking
- SNMP community strings - Network device access
- Database connections - Application credentials
NFS Exploitation Impact
- SUID binary upload - Direct root privilege escalation
- Configuration modification - System file access
- Data exfiltration - Sensitive file access
Tmux Session Benefits
- Inherited privileges - Session creator’s permissions
- Persistent access - Session survives disconnection
- Command history - Previous commands and data
- Active processes - Running privileged tasks
Miscellaneous techniques cover edge cases and specialized scenarios - traffic capture, NFS misconfigurations, and session hijacking provide additional privilege escalation vectors in specific environments.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Shared Libraries
🎯 Overview
LD_PRELOAD environment variable allows loading custom shared libraries before program execution, enabling privilege escalation when combined with sudo configurations that preserve environment variables.🔍 Prerequisites
Check for LD_PRELOAD in Sudo
Library Dependencies Analysis
🚀 LD_PRELOAD Exploitation
Create Malicious Library
Compile Shared Library
Execute Privilege Escalation
🔧 Alternative Payloads
Reverse Shell Library
SUID Binary Creation
🔍 Detection & Enumeration
LD_PRELOAD Vulnerability Check
Environment Variable Analysis
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
HTB Academy Example
⚠️ Exploitation Requirements
Must Have
- Sudo access to any command (even non-GTFOBin)
- env_keep+=LD_PRELOAD in sudoers configuration
- GCC compiler available on target system
- Write permissions in accessible directory
Common Scenarios
- Non-exploitable sudo commands with LD_PRELOAD kept
- Service restart permissions (apache, nginx, etc.)
- Safe commands made dangerous by LD_PRELOAD
- Custom applications with sudo permissions
LD_PRELOAD exploitation transforms safe sudo commands into privilege escalation vectors - environment variable preservation combined with shared library injection bypasses command restrictions for immediate root access.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Shared Object Hijacking
🎯 Overview
Shared object hijacking exploits custom library dependencies in SUID binaries through writable RUNPATH directories, allowing malicious library injection for privilege escalation.🔍 Prerequisites & Detection
Find SUID Binaries with Custom Libraries
Check RUNPATH Configuration
Verify Directory Permissions
🚀 Exploitation Process
Step 1: Identify Missing Function
Step 2: Create Malicious Library
Step 3: Compile and Deploy
Step 4: Execute and Escalate
🔧 Advanced Techniques
Function Discovery Methods
Multiple Function Implementation
🔍 Detection & Enumeration
Shared Object Hijacking Check
Quick Analysis Commands
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
HTB Academy Workflow
Shared object hijacking exploits custom library loading mechanisms - writable RUNPATH directories combined with SUID binaries create privilege escalation opportunities through malicious library injection.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Python Library Hijacking
🎯 Overview
Python library hijacking exploits Python’s module import system through writable modules, path manipulation, or PYTHONPATH environment variable abuse to achieve privilege escalation.🔍 Attack Vectors
1. Wrong Write Permissions
- Writable Python modules in system directories
- SUID Python scripts importing vulnerable modules
- Direct code injection into existing modules
2. Library Path Manipulation
- Higher priority paths in sys.path that are writable
- Module name collision with legitimate modules
- Path precedence exploitation
3. PYTHONPATH Environment Variable
- sudo SETENV permissions for Python
- Environment variable manipulation to redirect imports
- Custom module directories via PYTHONPATH
🔍 Enumeration & Detection
Check Python Paths
Find SUID Python Scripts
Check Sudo Permissions
🚀 Exploitation Methods
Method 1: Writable Module Hijacking
Method 2: Path Precedence Exploitation
Method 3: PYTHONPATH Environment Variable
🔧 Advanced Techniques
Multi-Function Module Creation
Reverse Shell Integration
🔍 Detection Script
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
HTB Academy Lab Example
🔧 Common Python Modules to Target
Frequently Imported Modules
Module Discovery in Scripts
Python library hijacking exploits the module import system - writable library paths, path precedence, and environment variable manipulation can redirect imports to malicious code for privilege escalation.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Sudo CVE Exploits
🎯 Overview
Known sudo vulnerabilities provide direct privilege escalation through heap buffer overflow (Baron Samedit) and policy bypass exploits affecting specific sudo versions.🔥 CVE-2021-3156 (Baron Samedit)
Vulnerability Details
- Impact: Heap-based buffer overflow → root shell
- Affected Versions:
- 1.8.31 (Ubuntu 20.04)
- 1.8.27 (Debian 10)
- 1.9.2 (Fedora 33)
- Existed: Over 10 years undetected
Version Check
Exploitation
🔓 CVE-2019-14287 (Sudo Policy Bypass)
Vulnerability Details
- Impact: User ID bypass → privilege escalation
- Affected: All versions below 1.8.28
- Method: Negative user ID (-1) processed as UID 0 (root)
Prerequisites
Exploitation
HTB Academy Lab Example (CVE-2019-14287)
🔍 Version Enumeration
Sudo Version Check
OS Version Correlation
🚀 Quick Exploitation
CVE-2021-3156 Quick Check
CVE-2019-14287 Quick Check
🔧 Exploitation Scripts
Baron Samedit Automation
Policy Bypass Test
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
Alternative Exploits
⚠️ Exploit Considerations
CVE-2021-3156 Notes
- Compilation required on target or similar system
- OS-specific targets - must match exact version
- Heap manipulation - may cause crashes if wrong target
- Success varies based on system configuration
CVE-2019-14287 Notes
- Simple exploitation - one command
- Requires sudo access to any command
- Limited impact - only vulnerable versions
- Well-patched in modern systems
Sudo CVE exploits provide direct privilege escalation for specific vulnerable versions - Baron Samedit and Policy Bypass represent critical sudo vulnerabilities requiring immediate patching.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Polkit/Pwnkit
🎯 Overview
Polkit (PolicyKit) authorization service vulnerability CVE-2021-4034 “Pwnkit” allows local privilege escalation through pkexec memory corruption, affecting most Linux distributions.🚨 CVE-2021-4034 (Pwnkit)
Vulnerability Details
- Impact: Memory corruption in pkexec → immediate root shell
- Affected: Most Linux distributions with polkit
- Hidden: Over 10 years undetected (published Nov 2021)
- Requirement: None - any local user can exploit
Version Check
🚀 Exploitation
Download and Compile Pwnkit
Alternative Exploits
🔧 Manual Exploitation
Understanding the Vulnerability
DIY Exploit (Advanced)
🔍 Detection & Enumeration
Polkit Vulnerability Check
System Information
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
HTB Academy Example
⚠️ Exploit Characteristics
Pwnkit Advantages
- Universal impact - Works on most Linux distributions
- No prerequisites - Any local user can exploit
- Reliable exploitation - High success rate
- Silent execution - Minimal system logs
Limitations
- Compilation required - Need gcc on target or transfer binary
- Patched systems - Fixed in updated polkit versions
- Detection possible - Modern EDR may detect exploitation
🛡️ Defensive Measures
Patch Status Check
Mitigation Options
Pwnkit (CVE-2021-4034) represents one of the most significant Linux privilege escalation vulnerabilities - any local user can exploit polkit’s pkexec for immediate root access on unpatched systems.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Dirty Pipe
🎯 Overview
Dirty Pipe kernel vulnerability allows unauthorized writing to root-owned files through pipe mechanism exploitation, similar to Dirty Cow but affecting newer kernels (5.8-5.17).🚨 CVE-2022-0847 Details
Vulnerability Info
- Impact: Write to arbitrary files as root with only read access
- Affected Kernels: 5.8 to 5.17 (including Android)
- Mechanism: Pipe-based unidirectional communication exploitation
- Similar to: Dirty Cow (CVE-2016-5195) but different attack vector
Kernel Version Check
🚀 Exploitation
Download and Compile Exploits
Method 1: /etc/passwd Modification
Method 2: SUID Binary Hijacking
🔧 Alternative Exploits
Other Dirty Pipe PoCs
Manual File Modification
🔍 Detection & Enumeration
Dirty Pipe Vulnerability Check
Quick Kernel Check
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
HTB Academy Example
⚠️ Exploit Considerations
Dirty Pipe Characteristics
- Kernel-level vulnerability - Direct kernel exploitation
- High reliability - Works on most affected systems
- File corruption risk - Can damage system files
- Cleanup required - exploit-2 creates /tmp/sh
Limitations
- Specific kernel range - Only 5.8-5.17
- Compilation needed - Requires gcc on target
- Modern systems patched - Fixed in newer kernels
- Detection possible - Kernel module monitoring
Dirty Pipe (CVE-2022-0847) exploits kernel pipe mechanisms for arbitrary file writes - any user can modify root-owned files, leading to immediate privilege escalation on vulnerable kernel versions.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Netfilter Kernel Exploits
🎯 Overview
Netfilter Linux kernel module vulnerabilities provide privilege escalation through kernel-level exploitation targeting specific vulnerable kernel versions (2.6-6.3.1).🚨 Major Netfilter CVEs
CVE-2021-22555 (Heap Out-of-Bounds)
- Affected: Linux kernels 2.6 - 5.11
- Impact: Local privilege escalation via heap corruption
- Exploit: Memory corruption in netfilter subsystem
CVE-2022-25636 (Heap Out-of-Bounds Write)
- Affected: Linux kernels 5.4 - 5.6.10
- Impact: Root privileges via heap out-of-bounds write
- Risk: Can corrupt kernel, reboot required
CVE-2023-32233 (Use-After-Free)
- Affected: Linux kernels up to 6.3.1
- Impact: Anonymous sets Use-After-Free in nf_tables
- Method: Manipulating cleared anonymous sets
🔍 Kernel Version Detection
Check Vulnerable Versions
🚀 Exploitation Methods
CVE-2021-22555 Exploitation
CVE-2022-25636 Exploitation
CVE-2023-32233 Exploitation
🔍 Detection & Enumeration
Netfilter Vulnerability Check
Netfilter Service Check
🔑 Quick Reference
Immediate Checks
Emergency Exploitation
⚠️ Critical Warnings
Kernel Exploit Risks
- System instability - Can crash the system
- Kernel corruption - May require reboot
- Production danger - Never run on production systems
- Testing recommended - Test in controlled environments
Exploitation Considerations
- CVE-2022-25636 - Highest risk of kernel corruption
- CVE-2021-22555 - Most stable, widest kernel range
- CVE-2023-32233 - Newest, targets recent kernels
- Dependencies - Some require specific libraries (libmnl, libnftnl)
🛡️ Defensive Measures
Kernel Updates
Netfilter Hardening
Netfilter kernel exploits target the network filtering subsystem - these kernel-level vulnerabilities provide direct root access but carry significant system stability risks and should be used with extreme caution.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Linux Hardening
🎯 Overview
Comprehensive Linux hardening eliminates most privilege escalation opportunities through systematic security configuration, regular updates, and proper access controls.🔄 Updates and Patching
Critical Update Practices
Kernel Security Updates
🔧 Configuration Management
File System Hardening
Service Configuration
Credential Security
👥 User Management
Account Hardening
Group Management
🔍 Security Controls
Enable Security Features
Logging and Monitoring
🔬 Security Auditing
Lynis Security Scanner
Custom Hardening Check
🔑 Hardening Checklist
Critical Actions
- Update kernel - Eliminate kernel exploits
- Remove unnecessary SUID - Audit and remove dangerous SUID bits
- Fix sudo configurations - Use absolute paths, remove wildcards
- Clean dangerous groups - Remove users from lxd, docker, disk
- Secure cron jobs - Absolute paths, proper permissions
- Clear credentials - Remove plaintext passwords from files
- Enable logging - Audit privilege escalation attempts
Advanced Hardening
- SELinux/AppArmor - Mandatory access controls
- Regular audits - Lynis, custom scripts, compliance checks
- Service minimization - Remove unnecessary packages/services
- Network segmentation - Limit lateral movement
- Monitoring - Real-time privilege escalation detection
📊 Compliance Frameworks
Standards to Consider
- DISA STIGs - Security Technical Implementation Guides
- CIS Benchmarks - Center for Internet Security
- ISO 27001 - Information security management
- PCI-DSS - Payment card industry standards
- HIPAA - Healthcare information protection
🔧 Automation Tools
Configuration Management
Monitoring Integration
Proper Linux hardening eliminates the vast majority of privilege escalation vectors - systematic application of security controls, regular updates, and continuous monitoring create robust defenses against privilege escalation attacks.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter: