AKERVA

First, we need to enumerate using nmap. SSH, HTTP default and HTTP custom port 5000 is open.

╭─hnl@hnl ~/Desktop/ctf/hackthebox/fortress  
╰─➤  nmap -A 10.13.37.11 | tee nmap.log
Starting Nmap 7.80 ( https://nmap.org ) at 2022-04-12 13:32 +0630
Nmap scan report for 10.13.37.11
Host is up (0.28s latency).
Not shown: 996 closed ports
PORT     STATE    SERVICE VERSION
22/tcp   open     ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 0d:e4:41:fd:9f:a9:07:4d:25:b4:bd:5d:26:cc:4f:da (RSA)
|   256 f7:65:51:e0:39:37:2c:81:7f:b5:55:bd:63:9c:82:b5 (ECDSA)
|_  256 28:61:d3:5a:b9:39:f2:5b:d7:10:5a:67:ee:81:a8:5e (ED25519)
80/tcp   open     http    Apache httpd 2.4.29 ((Ubuntu))
|_http-generator: WordPress 5.4-alpha-47225
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_http-title: Root of the Universe – by @lydericlefebvre & @akerva_fr
|_https-redirect: ERROR: Script execution failed (use -d to debug)
2811/tcp filtered gsiftp
5000/tcp open     http    Werkzeug httpd 0.16.0 (Python 2.7.15+)
| http-auth: 
| HTTP/1.0 401 UNAUTHORIZED\x0D
|_  Basic realm=Authentication Required
|_http-title: Site doesn't have a title (text/html; charset=utf-8).
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 81.79 seconds

A quick check to snmp port using nmap. It is open.

Flag 1 - Plain Sight

Let's enumerate HTTP default port first. When you browse to http://10.13.37.11/, you will see the following webpage.

In the source source of the webpage, you will see first flag.

Flag 2 - Take a Look Around

You will check the webpage sub directory using gobuster.

This website is make with wordpress. The only interesting sub directory is /dev directory. Let's browse into this. And then we will see nothing.

So, we will enumerate other port that we saw on nmap udp scan result. You will found the second flag on the snmp result.

Flag 3 - Dead Poets

You already seen /var/www/html/dev/space_dev.py at the previous scan result. Let's call from web browser. You will see nothing. How about /scripts/backup_every_17minutes.sh ? Nothing seen in the browser. Let's intercept using burp. When you are with GET method, you got permission error. I change GET to POST method. And then you will see the source code of backup_every_17minutes.sh.

Here is the source code of backup_every_17minutes.sh.

Flag 4 - Now You See Me

The script is simple. The name conversation of the backup file is backup_(year month date hour minute second) and save it to /var/www/html/backups. The simple example is backup_20220102010101.zip. So, we need to know the current uptime.

We don't know minute and second exactly. So, some of part we know is backup_2022041218????.zip. Generate 4 digits number fuzz it.

Download the file using curl.

When you unzip the file, var directory will extracted. In /var/www/www/dev, you will find a python script file called space_dev.py.

Flag 5 - Open Book

Here is the vulnerable part of the code. We can called file directory with filename parameter at port 5000.

Let's browser it http://10.13.37.11:5000/. It will tell you username and password.

Here is the username and password part of the code.

When successful the webpage only say Hello, World!. Let's call the parameter. You can read /etc/passwd through LFI http://10.13.37.11:5000/file?filename=../../../../etc/passwd.

You can read the flag at /home/aas/flag.txt http://10.13.37.11:5000/file?filename=../../../../home/aas/flag.txt

Flag 6 - Say Friend and Enter

You can't read id_rsa through LFI http://10.13.37.11:5000/file?filename=../../../../home/aas/.ssh/id_rsa. Just only got error. This part we got confuse. So, we will find sub directory on this webpage.

We found /console directory. In this diretory, the webpage tell use pin.

Let's find exploit relate with pin https://www.daehee.com/werkzeug-console-pin-exploit/. We need machine-id and mac-address.

  1. mac-address - http://10.13.37.11:5000/file?filename=../../../../sys/class/net/ens33/address (00:50:56:b9:6e:8f)

  2. machine-id - http://10.13.37.11:5000/file?filename=../../../../etc/machine-id (258f132cd7e647caaf5510e3aca997c1)

Let's generate mac-address through python.

The complete exploit.

Execute the script and you will get pin number. And then you will find a console.

In netcat session, we got a reverse shell.

In this aas directory, we found hidden flag.

Flag 7 - Super Mushroom

Let's check sudo version.

This sudo version is vulnerable and here is poc https://github.com/saleemrashid/sudo-cve-2019-18634

Flag 8 - Little Secret

We found secured_note.md file in root directory.

This is base64 and when decode it, we will find something.

It is vigenere cipher and AKERVA is the key.

Last updated