I just solved Cohort from Hack the Box!
Cohort Machine Summary
Cohort is an easy-difficulty Linux machine on Hack The Box that focuses on web application enumeration, Server-Side Request Forgery (SSRF), and vulnerability research. The machine begins with standard reconnaissance, where Nmap enumeration reveals the available services, followed by hosts file configuration to resolve the target domain correctly. Initial web enumeration of the landing page provides little value, prompting directory enumeration, which uncovers a hidden portal exposing a URL validation feature.
Further investigation of the portal leads to SSRF internal port enumeration, where the vulnerable endpoint is abused to discover services listening on localhost. JavaScript analysis helps identify how the frontend communicates with the backend, while SSRF endpoint enumeration exposes internal infrastructure details, including backend services and an internal notebook hostname. After performing internal host resolution, additional API enumeration confirms the presence of internal services, and Marimo version enumeration identifies the notebook application as Marimo 0.20.4. Accessing the Marimo login page through SSRF confirms that the service is protected by authentication but exposes an unauthenticated WebSocket endpoint vulnerable to CVE-2026-39987.
The exploitation phase begins with exploit preparation, where a proof-of-concept targeting the vulnerable Marimo WebSocket is created. During initial exploitation, the exploit successfully achieves unauthenticated remote code execution, leading to gaining initial access through a bind shell. After shell stabilization, a fully interactive Bash session is established, allowing further system enumeration and the successful capture of the user flag.
For privilege escalation, privilege escalation enumeration reveals that the target is running PackageKit 1.2.8, a version affected by CVE-2026-41651, a local privilege escalation vulnerability. Following privilege escalation preparation, a public proof-of-concept is hosted locally and transferred to the target, where it is prepared for execution. Finally, the exploit successfully elevates privileges to root, enabling the capture of the root flag and completing the compromise of the machine.
Protected Page
Nmap Enumeration
I started by running an Nmap scan against the target to identify open ports, running services, and gather as much information as possible for initial enumeration. This gave me a clear picture of the attack surface before interacting with the target.
*.cohort.htb), suggesting that virtual hosts or subdomains might be involved later. With the initial enumeration complete, I shifted my focus to the web application for further reconnaissance.Hosts File Configuration
After identifying the target domain during enumeration, I added cohort.htb to my local hosts file so my machine could resolve the domain correctly. This allowed me to access the web application using its intended hostname instead of the IP address.
sudo to modify the system hosts file, and the command confirmed that the new entry was added successfully. With name resolution in place, I was ready to browse the application and continue web enumeration using https://cohort.htb.Web Enumeration
After adding the target domain to my hosts file, I browsed to the web application and confirmed that the IP address redirected to https://cohort.htb. I manually explored the site to look for exposed functionality, sensitive information, or hidden endpoints.
Directory Enumeration
Since manual browsing didn't reveal anything interesting, I ran Feroxbuster to enumerate hidden directories, files, and common backup extensions across the web application. I configured it to follow redirects, recurse through directories, and collect additional words and links during the scan.
portal.html, assets/app.js, and assets/styles.css, while sensitive paths such as /status and /assets/ returned 403 Forbidden responses. These findings suggested that additional functionality existed beyond the homepage, making portal.html the most promising endpoint to investigate next.Portal Enumeration
Based on the results from my directory enumeration, I visited the newly discovered portal.html page to inspect its functionality. Unlike the landing page, this endpoint exposed a feature that allowed users to submit a report source URL for validation.
SSRF Internal Port Enumeration
Since the portal fetched user-supplied URLs, I suspected an SSRF vulnerability and used it to enumerate services running on the target's localhost. I first generated a wordlist containing ports 1–65000, then fuzzed the port number through the vulnerable endpoint.
The scan identified several accessible internal services on ports 22, 80, 443, 5000, and 8888. The response from port 8888 stood out, and by requesting /api/version through the SSRF, I confirmed it was running Marimo version 0.20.4. This became the primary target for further investigation, as outdated internal services often expose exploitable vulnerabilities.
JavaScript Analysis
To better understand how the web application worked, I downloaded the client-side JavaScript file and inspected it for hidden API endpoints, requests, or interesting functionality. I also searched the source for common keywords related to authentication and backend communication.
SSRF Endpoint Enumeration
To gather more information about the internal infrastructure, I used the SSRF vulnerability to request the application's hidden /status endpoint. I sent the request using an alternative representation of the localhost IP to bypass the application's localhost restrictions.
127.0.0.1:8888 with the hostname nb-1be3782a8afd3ad5.cohort.htb, confirming the presence of an internal Marimo workspace. This provided a clear target for the next phase of exploitation.Internal Host Resolution
After discovering the internal notebook hostname through the SSRF response, I added it to my local hosts file so it would resolve correctly in my browser. This allowed me to interact with the internal virtual host using its intended hostname instead of the IP address.
sudo to update the hosts file, and the command confirmed that the new mapping was added successfully. With DNS resolution configured, I was ready to access nb-1be3782a8afd3ad5.cohort.htb and continue investigating the internal Marimo service.API Enumeration
After identifying the internal service on port 5000, I used the SSRF vulnerability to probe one of its exposed API endpoints. I targeted the /api/health endpoint to verify whether the backend service was reachable and responding.
Marimo Version Enumeration
After confirming that an internal service was running on port 8888, I queried its version endpoint through the SSRF vulnerability. This helped me identify the exact software version before searching for any known vulnerabilities.
0.20.4, confirming that the internal notebook service was running Marimo 0.20.4. Identifying the exact version was valuable because it allowed me to research publicly known vulnerabilities and determine whether this service could be exploited further.Marimo Login Page Enumeration
To better understand the internal notebook service, I used the SSRF vulnerability to request its root page instead of a specific API endpoint. This allowed me to inspect the application's HTML response without directly accessing the internal service.
Exploit Preparation
After confirming the internal notebook was running Marimo 0.20.4, I researched the version and found it was vulnerable to CVE-2026-39987, a pre-authentication Terminal WebSocket RCE. To verify whether the target was affected, I created a small Python proof-of-concept that connected to the exposed WebSocket endpoint and attempted to execute commands without authentication.
Initial Exploitation
With the proof-of-concept prepared, I executed it against the internal Marimo instance to determine whether the unauthenticated WebSocket vulnerability could be exploited. The script connected successfully and delivered the payload to the target.
Gaining Initial Access
After sending the payload, I attempted to connect to the bind shell that the exploit was expected to create. This would confirm whether the remote code execution was successful and provide my initial foothold on the target.
/bin/sh shell. Although the message "can't access tty; job control turned off" indicated a non-interactive shell, it confirmed that the exploit had successfully achieved remote code execution. With initial access established, I could begin enumerating the system for privilege escalation opportunities.Shell Stabilization
After obtaining the initial shell, I upgraded it to a more usable Bash session. This provides a better interactive environment, making it easier to execute commands and continue post-exploitation tasks.
script utility to spawn an interactive Bash shell, which successfully changed my prompt to marimo@cohort, confirming the current user. I then suspended the session with Ctrl+Z so I could perform the remaining steps required to fully stabilize the shell before resuming my interaction with the target.Shell Stabilization
To fully stabilize my shell, I resumed the suspended session, configured the terminal, and verified the privileges of the compromised account. This provided a much smoother environment for post-exploitation and system enumeration.
xterm, restoring proper terminal functionality. Finally, I verified my current privileges with id, confirming that I had code execution as the marimo user (uid=1000). With a fully interactive shell established, I continued enumerating the host for privilege escalation opportunities.Capturing the User Flag
With an interactive shell established, I began enumerating the compromised user's home directory for useful files. One of the first things I checked was whether the user flag was present.
user.txt file alongside the notebooks directory. I read the contents of user.txt and successfully retrieved the user flag, confirming that I had achieved an initial foothold on the target and could now shift my focus to privilege escalation.Hurray!!! I got the user flag.
Privilege Escalation Enumeration
After obtaining the user flag, I continued enumerating the system for potential privilege escalation vectors. Since Linux privilege escalation often involves outdated or misconfigured packages, I checked whether PackageKit was installed.
Privilege Escalation Preparation
After confirming that PackageKit 1.2.8 was installed, I researched the version and found it was affected by CVE-2026-41651, a local privilege escalation vulnerability. I downloaded a public Python proof-of-concept and prepared to transfer it to the compromised host for testing.
Transferring the Exploit
With the HTTP server running on my attacking machine, I downloaded the privilege escalation proof-of-concept directly onto the compromised host. This allowed me to prepare the exploit for local execution without relying on additional transfer methods.
cve-2026-41651.py script in my current working directory. With the exploit now available on the target, I was ready to execute it and attempt to escalate my privileges from the marimo user to root.Preparing the Exploit
After transferring the exploit to the target, I organized my workspace by copying the script to /tmp, a writable directory commonly used for temporary files. I then switched into that directory to prepare the exploit for execution.
cve-2026-41651.py had been copied successfully and was ready to run. I also noted several temporary system directories, including those associated with PackageKit and polkit, reinforcing that I was working in an environment where the identified privilege escalation vulnerability could potentially be exploited.Privilege Escalation
With the exploit prepared, I executed it against the vulnerable PackageKit 1.2.8 installation and instructed it to run a command as root. This was the final step in attempting to escalate my privileges on the target.
/root/root.txt and retrieve the root flag, confirming complete compromise of the target machine.Hurray!!! I got the root flag and with that the machine was officially pwned.
If you enjoy reading my walkthrough, do not forget to like, comment, and subscribe to my YouTube channel and also connect with me on LinkedIn. Also, don't forget to turn on post notification on my YouTube channel and Medium to get notification as soon as I write.
Subscribe to my YouTube channel and Follow me on: LinkedIn | Medium | Twitter | Boltech Twitter | Buy Me a Coffee
Keywords:
cohort.htb
Writeup Cohort - HTB Machine Complete Season 11 HackTheBox Walkthrough
Cohort htb writeup
Cohort HTB Walkthrough
Cohort - HackTheBox
HackTheBox - Cohort Season 11 Walkthrough
cohort machine hack the box writeup season 11
I just solved Cohort from Hack the Box
Cohort Hack the Box Walkthrough
Cohort Hack the Box Writeup
Cohort Walkthrough Begineer's Writeup from Hack The Box
Owned Cohort from Hack the Box
nb-1be3782a8afd3ad5.cohort.htb
Hack The Box Writeups - The Ultimate HTB Resource
Cohort HTB - Complete Writeup
HTB Writeup - Cohort
Hack The Box (HTB) Walkthroughs
Cohort - HTB Writeup
HTB Certified Web Exploitation Specialist (HTB CWES)
Cohort has been pwned
HTB-Cohort WriteUp
Pwned Cohort Box! hackthebox
cohort htb season 11 root flag hint
Rooted Cohort from Hack the Box - Season 11 Linux Machine
DarkZeroReturns htb walkthrough
DarkZeroReturns htb writeup
marimo@cohort


















%20Walkthroughs.jpg)

.jpg)











1 Comments
To current members, the password to access this encrypted page and other pages has been sent to your email address. If you haven't received it yet, reach out to me at isiaqibrahim.tr@gmail.com
ReplyDeleteNote: This write up includes the complete code blocks and commands. The password for each write up is different. I have sent the password to your inbox on Buy Me A Coffee.
Happy Hacking!!!😈😈