This box was downloaded from VulnHub and is also on the TJnull list of practice boxes for OSCP preparation. The box involved the follows:

  • Web Enumeration checking the source-code and static js file
  • MySQL commands to edit the database
  • Exploit the Document Upload vulnerability of SeedDMS to gain initial shell
  • Sudo access for privilege escalation

I always start my enumeration from the autorecon scan. Initial Nmap scan results are as below:

Nmap scan report for 10.0.0.30
Host is up, received arp-response (0.00042s latency).
Scanned at 2022-04-20 20:41:55 EDT for 9s
Not shown: 998 closed tcp ports (reset)
PORT     STATE SERVICE REASON         VERSION
80/tcp   open  http    syn-ack ttl 64 Apache httpd 2.4.41 ((Ubuntu))
| http-methods: 
|_  Supported Methods: HEAD GET POST OPTIONS
|_http-title: Welcome to the land of pwnland
|_http-server-header: Apache/2.4.41 (Ubuntu)
3306/tcp open  mysql   syn-ack ttl 64 MySQL 8.0.25-0ubuntu0.20.04.1
| mysql-info: 
|   Protocol: 10
|   Version: 8.0.25-0ubuntu0.20.04.1
|   Thread ID: 12
|   Capabilities flags: 65535
|   Some Capabilities: LongColumnFlag, Support41Auth, ConnectWithDatabase, Speaks41ProtocolOld, SwitchToSSLAfterHandshake, InteractiveClient, SupportsCompression, IgnoreSigpipes, LongPassword, SupportsTransactions, FoundRows, Speaks41ProtocolNew, ODBCClient, IgnoreSpaceBeforeParenthesis, DontAllowDatabaseTableColumn, SupportsLoadDataLocal, SupportsMultipleResults, SupportsMultipleStatments, SupportsAuthPlugins

Uptime guess: 13.285 days (since Thu Apr  7 13:52:16 2022)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=260 (Good luck!)
IP ID Sequence Generation: All zeros

TRACEROUTE
HOP RTT     ADDRESS
1   0.42 ms 10.0.0.30

Now as always I started my enumeration from port 80. Looking around and performing directory busting didn’t lead me to any vector. So I started looking for the source code .

I found an interesting comment in one of the static js file.

So there exists a web directory. Going the above-mentioned web directory is one of the open-source database management systems.

I started searching for the vulnerabilities for this system but all of the vulnerabilities were for the authenticated user. Now as this is the open-source software, I went to github and started looking for file tree structure and location of the config files.

Searching for the config files default location for seedDMS on google.

So looking at github file structure I now know that config file is located inside conf directory. Lets try if I can access this file in our case.

Default location seeddms51x/seeddms-5.1.22/conf shows error Not found.

Changing the web-address to /seeddms51x/conf/ gives us Forbidden error. So the directory does exist but forbidden to access.

Now in apache, even if the directory is forbidden for access, the files inside that forbidden directory may not be locked or can be accessed by any / unauthenticated user. Let’s see if that works in our case.

It works and looking at the contents of the settings.xml file, I found the credentials for SQL database.

During our initial nmap scan, there was MySQL running in port 3306. I will try these credentials in MySQL server.

mysql -h <ip> -u seeddms -p

Looking at the databases, I thought seeddms database looks like more interesting. Inside seeddms database, checking the content of users table gave me some credentials.

password : Saket@#$1337

Looking at the contents of the tblUsers table gave me more credentials.

Looking at the hash it is an MD5 hash.

I tried cracking the hash but was not successful, so I am going to add a new user into the database with the admin role.

INSERT INTO tblUsers (login,pwd,fullName,email,language,theme,comment,role,hidden,pwdExpiration,loginfailures,disabled,quota,homefolder) VALUES("cyberdai","b469546c28bb38181a493ad0e2af2429","Cyber Dai","[email protected]","en_GB","","",1,0,NULL,0,0,0,NULL);

Now, I used the cyberdai: cyberdai credential to log in to the seeddms system.

Now following the searchsploit 47022.txt, I was able to gain the reverse shell.

Setup the listener on port 1234.

Now checking the home folder I found user saket. I remember that we found a password for the user Saket Saurav before in the database. I tried using the same password to switch user to saket and succeeded.

Checking the sudo access for the user saket, I was surprised that he can use sudo for all commands.

It was hard to gain the initial shell but privilege escalation was really easy in this box.