DoxPit

Description

The owner of famous underground forum doxpit has been allegedly kidnapped, now that turmoil ensues it is the right time to strike and take down this appalling operation.

URL: https://app.hackthebox.com/challenges/DoxPitarrow-up-right

Source

Server

config/supervisord.conf

[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
pidfile=/run/supervisord.pid

[program:next]
command=npm start
directory=/app/front-end
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:av]
command=python3 run.py
directory=/app/av
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

Frontend Application

front-end/package.json

front-end/app/serverActions.tsx

AV Application

av/application/blueprints/routes.py

av/application/util/scanner.py

av/application/util/general.py

Solution

In the source code we are given 2 applications instead of 1. The first is just some pastebin like website which does absolutely nothing and is as is.

DoxPit.png

The second application runs on port 3000 internally and there's no way to reach it, unless we can achieve SSRF via frontend?

Searching for Next.jsarrow-up-right version (14.1.0) we find nextjs-CVE-2024-34351arrow-up-right

We need endpoint like doRedirect which we have:

And we need to trigger this endpoint:

Clicking the title triggers requests, but it's not visible on UI. Setup a server to handle SSRF requests.

azu/nextjs-CVE-2024-34351/attacker-server/main.tsarrow-up-rightDigging for SSRF in NextJS appsarrow-up-right

DoxPit-1.png

Register:

Note: The auth system is based on GET request which is a huge gaping security hole 💀

Access home endpoint:

The /home endpoint uses mix of render_template and render_template_string

render_template_string is known to be vulnerable to SSTI injections.

The filter prevents us from performing SSTI tho

The injection point is directory name itself.

The injection was quite hard so I started experimenting.

https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection/jinja2-ssti#filter-bypassesarrow-up-right

DoxPit-2.png

Payload:

Change the server to send our payload:

DoxPit-3.png

ls -alh /

DoxPit-4.png

cat /flag*

DoxPit-5.png
circle-check

Last updated