VulnNet Active (Windows Redis + SMB scheduled job + SharpGPOAbuse)

This is a writeup for the VulnNET: Active machine, available on the TryHackMe.

You can take advantage of a Windows user's edit rights on a Group Policy Object in order to compromise the objects that are controlled by that GPO.

Introduction

Machine Description

VulnNet Entertainment had a bad time with their previous network which suffered multiple breaches. Now they moved their entire infrastructure and hired you again as a core penetration tester. Your objective is to get full access to the system and compromise the domain.

Notes & Observations

  • You can retrieve a user's NTLM hash by running Lua eval command and with Responder

  • Initial access can be done by modifying the content of a file found among the shares

  • Besides abusing the GPO there are other ways to escalate privileges (Print Nightmare)

Tools: nmap, redis-tools, Responder, smbclient, psexec.py, Metasploit

Walkthrough

What is the user flag?

Answer: THM{3eb176aee96432d5b100bc93580b291e}

  1. Run the usual nmap scan:

  • image.png

  • Connect to the Redist service and check the configurations, notice the windows user:

    • The redisc-cli command can be used after installing the redis-tools image.png

  • In other terminal window start responder:

  • Run the following script inside the Redis service with your ip address:

    • You should capture the user's NTLM hash image.png

  • Save the hash into a file and crack it with hashcat (use -O instead of --force if you have dedicated GPU):

  • image.png
  • List the SMB shares with the username and password you've just cracked:

  • smbclient -L //$ip -U enterprise-security --password=sand_0873959498

  • Access the Enterprise-Share SMB share and list its content:

    • This file is ran by a scheduler process image.png

  • Prepare a meterpeter multi handler session:

  • Create a PurgeIrrelevantData_1826.ps1 file with the following content (put your IP address and port specified in meterpreter):

  • Replace the same SMB file with the newly created one and wait:

  1. image.png image.png

  2. Get the user.txt file's content at C:\Users\enterprise-security\Desktop\user.txt. image.png

What is the root flag?

Answer: THM{d540c0645975900e5bb9167aa431fc9b}

  1. Enumerate the machine with Bloodhound (detailed description can be found here) image.png

    • If you check the "Find Shortest Paths to Domain Admins", you will see that enterpise-secrutiy user has generic write access to the GPO security-pol-vn

  2. Download or compile the SharpexeGPOAbuse.exe file and update the group policies on the target machine:

  • image.png image.png

  • Access the machine with our new privileges:

  1. image.png

  2. Get the system.txt at the C:\Users\Administrator\Desktop\system.txt location image.png

Last updated