Let’s start by running a port sacn on the machine.
There are 4 open ports on the machine:
22 (SSH): OpenSSH 8.4p1 Debian 5+deb11u3
80 (HTTP): nginx 1.18.0
443 (HTTPS): nginx 1.18.0
1097 (Java RMI): Java RMI
Let’s start with adding the machine IP to the /etc/hosts file.
I will search for directories using dirsearch.
I found a directory /solr/admin/ which is a Solr admin panel. I will try to access it.
We will need credentials here, I tried some simple ones but none of them worked.
After some research, I found that the version of OFBiz is 18.12. On December 26, 2023, researchers at SonicWall announced the discovery of a zero-day security flaw in Apache OFBiz. Tracked as CVE-2023-51467, the vulnerability allows threat actors to bypass authentication and perform a Server-Side Request Forgery (SSRF). CVE-2023-51467 earned a critical CVSS score of 9.8. According to researchers at SonicWall, a patch released for another vulnerability, CVE-2023-49070, left the initial issue unresolved, making authentication bypass possible.source
Therefore, I will try to exploit this vulnerability by using this exploit
The script respond that Apache OFBiz instance seems to be vulnerable. Now let’s try to reverse shell.
Don’t forget to start a listener on your machine.
I got the user.txt flag from /home/ofbiz/ directory.
Privilege Escalation
I think this shell is not stable, so I will try to get a stable shell.
And as for Derby ::: Apache Derby is an open-source relational database management system (RDBMS) developed by the Apache Software Foundation. It’s implemented entirely in Java and can be embedded in Java programs for online transaction processing which has files in .dat format.
It is located in /opt/ofbiz/runtime/data/derby/ofbiztenant/seg0 directory.
There is a readme file that tells us to not touch any files in the directory.
Alright let’s try to get all the files in the directory and search for the hashes.
Voila we got the hashes $SHA$d$uP0_QaVBpDWFeo8-dRzDqRwXQ2I
There is a GitHub repository of OFBiz where I found the HashCrypt.java function that is used to hash the password. You can find it here
Now we have known the hashing algorithm, let’s try to crack the hash by creating a Python script.
Here we go, we got the password monkeybizness for the root user.
Conclusion
This was a fun machine, I am not sure why it has such low reviews. I learned about Apache OFBiz and how to exploit it. I also learned about Apache Derby and how to crack the hashes. I hope you enjoyed this write-up. Thank you for reading.