π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
# 1. Write permissions on log files
ls -la /var/log/ | grep $(whoami)
# 2. Vulnerable logrotate version
logrotate --version
# Vulnerable: 3.8.6, 3.11.0, 3.15.0, 3.18.0
# 3. Logrotate runs as root (via cron)
ps aux | grep logrotate
cat /etc/cron.daily/logrotateConfiguration Analysis
# Check logrotate configuration
cat /etc/logrotate.conf
# Important settings
grep "create\|compress" /etc/logrotate.conf | grep -v "#"
# Check specific log configurations
ls /etc/logrotate.d/
cat /etc/logrotate.d/*π 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.
Last updated