Extract — TryHackMe Writeup
Nmap revealed SSH (22) and Apache (80). The web application hosted on port 80 featured a document preview functionality vulnerable to SSRF.
Discovered an SSRF vulnerability in the preview functionality. Crafted a custom Golang scanner to find internal ports, discovering services on port 80 and 10000. Used Gopher payload generation to proxy traffic.
Created a Golang proxy script to interact with the internal service on port 10000 via Gopher SSRF. Identified a Next.js application and bypassed its middleware authentication using CVE-2025-29927.
Leveraged leaked credentials to access the /management interface on port 80. Bypassed the 2FA mechanism by modifying and URL-encoding a serialized PHP object in the auth_token cookie.
Introduction
Extract is an engaging TryHackMe machine focusing on web application vulnerabilities. The attack path starts with a Server-Side Request Forgery (SSRF) flaw in a document preview feature. We escalate this SSRF by utilizing the gopher:// protocol to scan for and interact with internal services. After proxying our traffic to a hidden Next.js application, we bypass its authentication middleware using CVE-2025-29927 to recover credentials. Finally, we access a restricted management interface and bypass Two-Factor Authentication (2FA) by tampering with a serialized PHP object token.
Reconnaissance
::Nmap Scan
We begin by scanning the target to identify open ports and running services.
We can see two open ports: SSH (22) and an Apache web server (80). Let's see what is hosted on the web server.
Enumeration
::Analyzing the Web Application
Visiting http://10.112.147.90:80, we find a web application named "TryBookMe" for viewing documents.

When we choose one of the available documents, the application generates a preview. By inspecting the network tab in the browser, we observe that the application sends a request to the /preview.php endpoint with a url parameter:
http://10.112.147.90/preview.php?url=http%3A%2F%2Fcvssm1%2Fpdf%2Fdummy.pdf

This structure strongly indicates a potential Server-Side Request Forgery (SSRF) vulnerability.
::SSRF Vulnerability Testing
To test for SSRF, we send the request to Burp Suite Repeater and set up a local Python HTTP server (python3 -m http.server). We then modify the url parameter to point to our local server.

The application fetches and renders the directory listing from our local machine, confirming the SSRF!
Next, we test common payloads to read local files, such as file:///etc/passwd.

The application blocks this attempt, returning: 'URL blocked due to keyword: file:/'.
::Leveraging Gopher Protocol
Since the file:// scheme is blocked, we can test other protocols. The gopher:// protocol is particularly useful in SSRF attacks because it allows us to send arbitrary raw data (like HTTP GET or POST requests) to any service without protocol overhead.
Let's test gopher:// by sending a dummy message to our Python server: gopher://10.112.72.139:8000/_asbawy_say_hello

We successfully receive the message on our Python server! This confirms we can use the gopher:// protocol to interact with internal services.
Foothold
::Internal Port Scanning
Since we can interact with internal services using gopher://, our next step is to perform a port scan against 127.0.0.1 to discover hidden applications. I used a custom Golang script to automate this process.
Running the script reveals an internal service on port 10000:
::SSRF Proxy with Golang
To comfortably interact with the service on port 10000, we can build a proxy that takes our local requests, double-URL encodes them, and routes them through the SSRF vulnerability using the gopher:// protocol.
Now we can visit http://127.0.0.1:1234 in our browser to seamlessly interact with the internal service.

::Bypassing Next.js Middleware (CVE-2025-29927)
The internal service displays a warning: "Unauthorised access to this system is strictly prohibited." Attempting to access /api redirects us to /customapi, indicating authentication controls are in place.
By examining the page source and JavaScript, we identify that the site is built with Next.js. Researching Next.js authentication vulnerabilities leads us to CVE-2025-29927, which allows bypassing Next.js middleware authentication using a specific HTTP header.
Let's test this bypass:
This successfully bypasses the authentication! We retrieve the first flag and a set of credentials: librarian:L1br4r1AN!!
Privilege Escalation
::2FA Authentication Bypass
With our newly acquired credentials, we can explore restricted areas of the main web application on port 80, such as the /management endpoint. To simplify access, we update our Golang proxy script to target internalPort = "80" instead of 10000.

After logging in with librarian:L1br4r1AN!!, we are presented with a Two-Factor Authentication (2FA) prompt.

Inspecting our browser cookies, we find an auth_token that looks suspicious:

URL-decoding this value reveals a serialized PHP object:
The object contains a boolean attribute validated set to 0 (false). We can manipulate this value to bypass the 2FA check by changing b:0; to b:1;.
We URL-encode our modified object:
Finally, we update our cookie in the browser storage and refresh the page, or simply send a curl request:
The authentication bypass is successful, granting us access to the final flag!

References

Red Team Consultant · Penetration Tester · Bug Bounty Hunter
Offensive security professional with 250+ vulnerabilities reported across 50+ organizations including Atlassian, Vimeo, and AT&T. Sharing research, tools, and field notes.