Attacking IP
10.17.34.202
Target IP
10.10.109.1
Recon
Nmap:
Output:
Gobuster:
Output:
The /blog
site is a bit ugly and the assignment tell us that:
Quote
Ensure that you modify your hosts file to reflect internal.thm
So we add an entry to /etc/hosts
to reflect internal.thm
with the target IP:
The site is more beautiful (?đ€).
Scan with WPScan:
With:
-u
: specify the URL-e
: enumeratevp
: vulnerable pluginsu
: user IDs range (default: 1-10)
Output:
Brute Force
Try to brute force the password of admin
by using ffuf
1:
We can also use wpscan
:
Get the password very soon:
After login, we get the âAdministration email verificationâ message and it reveals about the email: admin@internal.thm
In blog posts section, we see a private post (/blog/wp-admin/post.php?post=5
) that has this content:
Quote
Donât forget to reset Willâs credentials. william:arnold147
Seem like a credentialđ€Šââïž. But it is a rabbit hole đ± (according to the roomâs author).
Reverse Shell
On WordPress, we can use âTheme Editorâ feature and edit the first theme (âTwenty Seventeeâ) to create reverse shell2.
Generate the script to create the reverse shell by using Metasploit Venom:
Edit the 404 template (404.php
file) and replace its content with the above script content.
Start a meterpreter section:
Access this URL and we will get the reverse shell:
Notice the theme name is twentyseventeen
. This name can be found by click on âCustomizeâ button of the theme.
Aubreanna
After receive the reverse shell, try to move to the folder /home/aubreanna
but failed. This happens because the current user is www-data
(use getuid
command of meterpreter) and this user does not have the access.
Search for text file with meterpreter:
Find some interesting files:
/boot/grub/gfxblacklist.txt
/opt/wp-save.txt
Content of wp-save
:
Use this to log in as user aubreanna
through SSH:
After log in, read user.txt
and we have the flag:
Success
THM{int3rna1_fl4g_1}
Jenkins
Also find out a file named jenkins.txt
that reveals Jenkins endpoint: http://172.17.0.2:8080/
. This IP address, according to the roomâs author, is a common address of a Docker container.
Use SSH tunneling3 to connect to the Jenkins service:
Now, the address 172.17.0.2:8080
will be forwarded to localhost:8080
. Open browser and we get the login page of Jenkins.
Use Burp Suite (canât use ffuf
because we want to examine the response headers) to brute force the password by using Burp Suite Intruder with first 500 passwords from rockyou.txt
wordlist.
Find a response contains this header:
This response size is the smallest, so maybe its payload (spongebob
) is the password. Try this password and it works.
Use âScript Consoleâ feature in âManage Jenkinsâ section to create a reverse shell in Groovy language. The script to create reverse shell:
Execute the script and we will receive a reverse shell (remember to start a nc
server before).
Go to /opt
folder again and find a file named note.txt
with this content:
And we found the root password đ€·ââïž.
Log in, read root.txt
and we have the flag:
Success
THM{d0ck3r_d3str0y3r}
Related
Resources
- Room: https://tryhackme.com/room/internal
- Walkthrough: https://www.youtube.com/watch?v=2TmguIvR3Kw
Footnotes
-
refer to TryHackMe - Authentication Bypass â©
-
refer to Introduction to Shells â©