windowsShenzi

Privilege Escalation using AlwaysInstallElevated

Summary

  • Guest users had access to /shenzi directory via SMB.

  • Within this directory, I found a password.txt file containing the credentials for a WordPress site hosted at the /shenzi path.

  • Using these credentials, I logged into the WordPress admin panel.

  • Injected a reverse shell payload into the 404.php page. After testing various payloads, I found that the PHP reverse shell by Ivan Sincek from revshell.com provided a stable connection.

  • Triggering the modified 404.php page gave me a reverse shell as a low-privileged user, allowing me to obtain the first low-privilege flag. 🎉

  • To elevate privileges, I utilised powerup.ps1 and winPEAS to identify potential escalation vectors.

  • During this process, I discovered that the AlwaysInstallElevated setting was enabled. This Windows policy allows Windows Installer packages (.msi files) to be installed with administrative privileges.

  • Leveraging this, I created a reverse shell payload embedded in a .msi file, uploaded it to the target machine, and installed it. This successfully granted me a reverse shell with administrator privileges, allowing me to complete the privilege escalation and achieve full control of the system.

🧵Let's Unpack

Enumeration

# Nmap
sudo nmap -sC -sN -A -oN nmapFull -p- -A 192.168.172.55

# gobuster 
gobuster dir -u http://192.168.172.55 -w /usr/share/seclists/Discovery/Web-Content/raft-large-directories.txt 

# smbclient
smbclient //192.168.172.55/shenzi -U guest
>
smb: \> dir
  .                                   D        0  Thu May 28 21:15:09 2020
  ..                                  D        0  Thu May 28 21:15:09 2020
  passwords.txt                       A      894  Thu May 28 21:15:09 2020
  readme_en.txt                       A     7367  Thu May 28 21:15:09 2020
  sess_klk75u2q4rpgfjs3785h6hpipp      A     3879  Thu May 28 21:15:09 2020
  why.tmp                             A      213  Thu May 28 21:15:09 2020
  xampp-control.ini                   A      178  Thu May 28 21:15:09 2020

# validating credentials using cme
 crackmapexec smb  192.168.172.55 -u 'admin' -p 'FeltHeadwallWight357' --continue-on-success

Initial Foodhold

Injecting reverse shell

Updating 404.php page to have the following PHP reverse shell

chevron-rightRef Ivan Sincek shell -> https://www.revshells.com/arrow-up-righthashtag

Privilege Escalation

Using winPEAS.exearrow-up-right and PowerUp.ps1 arrow-up-rightto get familiar with Priv escalation vector

The above script revealed that the AlwaysInstallElevated setting is enabled in the Windows policy.

Exploiting to gain elevated shell

Last updated