Hacker Targets Apache OFBiz in HTB Business Attack

Today we will exploit a combination of two vulnerabilities in the Apache OFBiz product. This will allow you to bypass authentication and remotely execute arbitrary code on the server. Having received the user session, we will dump and crack the hashes from the OFBiz database.

Our goal is to obtain superuser rights on the Bizness machine from the training site Hack The Box. The task level is easy.

warning

It is recommended to connect to machines with HTB only via VPN. Do not do this from computers that contain data that is important to you, as you will end up on a shared network with other participants.

Intelligence service

Port scanning

Add the machine's IP address to /etc/hosts:

И запус­каем ска­ниро­вание пор­тов.

Справка: сканирование портов

Ска­ниро­вание пор­тов — стан­дар­тный пер­вый шаг при любой ата­ке. Он поз­воля­ет ата­кующе­му узнать, какие служ­бы на хос­те при­нима­ют соеди­нение. На осно­ве этой информа­ции выбира­ется сле­дующий шаг к получе­нию точ­ки вхо­да.

На­ибо­лее извес­тный инс­тру­мент для ска­ниро­вания — это Nmap. Улуч­шить резуль­таты его работы ты можешь при помощи сле­дующе­го скрип­та:

#!/bin/bash

ports=$(nmap -p- --min-rate=500 $1 | grep ^(0-9) | cut -d '/' -f 1 | tr 'n' ',' | sed s/,$//)

nmap -p$ports -A $1

It works in two stages. The first one performs a regular quick scan, the second one performs a more thorough scan using the available scripts (option -A).

The result of the script

The scanner found three open ports:

  • 22 - OpenSSH 8.4p1 service;
  • 80 and 443 - Nginx 1.18.0 web server.

On port 80 a redirect is automatically performed to https://bizness.htb. We have already entered this address into /etc/hostsso all that remains is to open the browser and see what the site is there.

Site's home page
Site's home page

Point of entry

We couldn’t find anything interesting on the site, so let’s start scanning.

Help: web crawling with feroxbuster

One of the first steps when testing the security of a web application is to scan directories using a brute-force approach to find hidden information and functions that are not available to ordinary visitors. To do this you can use programs like dirsearch, DIRB or ffuf. I prefer feroxbuster.

When starting, specify the following parameters:

  • -u — URL;
  • -k — ignore SSL errors;
  • -w - dictionary (I use dictionaries from the set SecLists);
  • -t — number of threads;
  • -d — scanning depth.

Let's launch feroxbustersetting all the necessary parameters:

feroxbuster -k -u https://bizness.htb/ -t 128 -d 1 -w directory_2.3_medium_lowercase.txt

Result of scanning directories using feroxbuster
Result of scanning directories using feroxbuster