The internal wkhtmltopdf parser catches the redirect and fetches the contents of /etc/passwd from its own local filesystem.
\immediate\write18cat /root/root.txt > /tmp/root.txt \bye
As noted in the official HTB discussion , beginners often overcomplicate this by trying to get a shell, but the goal is purely a file leak. pdfy htb writeup upd
The PDFy challenge exposes a web application designed to take a user-supplied URL, browse to that page, take a screenshot or render its content, and output the result as a downloadable PDF document. Web Difficulty: Easy
Comprehensive Writeup: Hack The Box PDFy Challenge Welcome to this step-by-step breakdown of , one of the most popular web exploitation challenges on Hack The Box . This challenge acts as an excellent training ground for cybersecurity enthusiasts and penetration testers looking to sharpen their skills in identifying and exploiting server-side vulnerabilities, specifically those involving file generation and Remote Code Execution (RCE). The internal wkhtmltopdf parser catches the redirect and
cat /root/root.txt
Now, submit the address of your malicious script to the PDFy input field via the web UI or an API POST request: Web Difficulty: Easy Comprehensive Writeup: Hack The Box
(Note: If you use a reverse proxy or tunneling tool, use standard TCP forwarding configurations instead of standard HTTP modes to ensure headers pass smoothly without intermediary confirmation pages.) Step 3: Execute the Payload Injection Navigate back to the target .
If you are stuck, try running similar PDF conversion tools (like wkhtmltopdf ) locally to see how they handle redirects.
wkhtmltopdf is a popular open-source tool that uses the Qt WebKit rendering engine to convert HTML pages into PDFs. A quick search for wkhtmltopdf 0.12.5 vulnerability leads directly to (and also the related CVE-2022-25765). The vulnerability stems from the fact that wkhtmltopdf does not properly handle <iframe> tags. An attacker can inject an <iframe> tag with a src attribute pointing to an arbitrary location. The tool will faithfully follow that link and include the rendered content in the final PDF. Our goal is to use this to make the server fetch a local file instead of a remote website.
This updated write‑up covers the core vulnerability (an SSRF in wkhtmltopdf ), two practical attack strategies, and a step‑by‑step walkthrough to capture the flag.