Pilgrimage
Pilgrimage
Platform: HackTheBox | Difficulty: Easy | OS: Debian Author: D3v0o0Nu11 | Date: 2026-02-10 | Status: Solved
Summary
Walkthrough of the HackTheBox machine Pilgrimage (Debian, attack surface: OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0) (22), nginx 1.18.0 (80)). Foothold via CVE-2022-44268, lfi, ssti; privilege escalation to root. Both flags captured and redacted.
Recon
Port scan
bash read-only • copy allowednmap -p- -sVC 10.10.11.219 --min-rate 1000
| Port | Service | Version | Notes |
|---|---|---|---|
| 22 | ssh | OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0) | |
| 80 | http | nginx 1.18.0 |
Enumeration highlights
- Detected OS: Debian.
- Open services: http (80), ssh (22).
- Scan used:
nmap -p- -sVC 10.10.11.219 --min-rate 1000.
Foothold
Vulnerability / Misconfiguration
┌──(D3v0o0Nu11㉿htb)-[~]
└─$ nmap -p- -sVC 10.10.11.219 --min-rate 1000
Starting Nmap 7.93 ( https://nmap.org ) at 2023-09-27 23:37 PDT
Nmap scan report for pilgrimage.htb (10.10.11.219)
Host is up (0.051s latency).
Not shown: 65533 closed tcp ports (conn-refused)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0)
| ssh-hostkey:
| 3072 20be60d295f628c1b7e9e81706f168f3 (RSA)
| 256 0eb6a6a8c99b4173746e70180d5fe0af (ECDSA)
|_ 256 d14e293c708669b4d72cc80b486e9804 (ED25519)
80/tcp open http nginx 1.18.0
| http-git:
| 10.10.11.219:80/.git/
| Git repository found!
| Repository description: Unnamed repository; edit this file 'description' to name the...
|_ Last commit message: Pilgrimage image shrinking service initial commit. # Please ...
| http-cookie-flags:
| /:
| PHPSESSID:
|_ httponly flag not set
|_http-title: Pilgrimage - Shrink Your Images
|_http-server-header: nginx/1.18.0
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 19.57 seconds
-
Based from the nmap results, the machine runs a web application and opens ssh login.
-
Noticed based from the nmap result, /.git/ is found. We can dump that using git-dumper later.
-
Using git-dumper.
┌──(D3v0o0Nu11㉿htb)-[~/Downloads/machine/machine_pilgrimage]
└─$ ls
assets dashboard.php index.php login.php logout.php magick register.php vendor
-
After uploaded an image file, it shows us where it stores our image file.
-
Well, analyzing index.php source code, shall found an interesting tool used by the webapp (ImageMagick).
-
Searching in metasploit for Image Magick shall resuulting to these:
-
Got bunch of results, searching on the internet shall found these:
CVE's POC --> https://github.com/voidz0r/CVE-2022-44268
-
Quite promising, let's try use that CVE in metasploit --> CVE-2022-44268
-
It seems we need to exploit this manually.
-
I did not want to use the CVE's POC we found before because it runs cargo.
-
Searching for another POC, found this POC where it uses python script -->
https://github.com/Sybil-Scan/imagemagick-lfi-poc. -
Let's just follow the steps listed there.
-
Running
identify -verbose 651533fa137a0.pngand scrolling down, shall found this hexes: -
Great we found the foothold. Anyway we leaked a username -->
emily. -
However because we're not in a webshell or a shell, we can't read .txt file, so there must be a creds somewhere we can use to login as emily.
-
But how come?? Here's the situation. We can read /home/emily/user.txt, and we just found out that the vuln is LFI not SSTI. That's why the approach must be hardcoded creds somewhere or reuse password scenario.
-
Remembering it's a webapp and we got the source code by dumping the
.gitvulnerability. Hence it's much easier for us to found where database might be located. -
Reviewing login.php source code, found our potential interest.
-
Running the same method as before by grabbing the hexes and decode them in Cyberchef, found this:
-
Great! After tried ssh login with
emily:abigchonkyboi123, we logged in!
Proof
User flag: REDACTED
Privilege Escalation
User -> Root/Admin
NOTES: Remembering there's a blacklist char, naming "gambar.png" shall safe.
- Nice!
Root flag: REDACTED
Flags
| Flag | Value |
|---|---|
| user | REDACTED |
| root | REDACTED |
Lessons Learned
- ImageMagick LFI.
- git-dumper.
- binwalk RCE.