Page cover

Support

Easy - Windows

Recon

$ sudo nmap -T4 -sC -sV -O 10.10.11.174 -oN nmap.txt -Pn -p-
Starting Nmap 7.92 ( https://nmap.org ) at 2022-12-06 16:37 CST
Nmap scan report for 10.10.11.174
Host is up (0.21s latency).
Not shown: 65516 filtered tcp ports (no-response)
PORT      STATE SERVICE       VERSION
53/tcp    open  domain        Simple DNS Plus
88/tcp    open  kerberos-sec  Microsoft Windows Kerberos (server time: 2022-12-07 01:25:54Z)
135/tcp   open  msrpc         Microsoft Windows RPC
139/tcp   open  netbios-ssn   Microsoft Windows netbios-ssn
389/tcp   open  ldap          Microsoft Windows Active Directory LDAP (Domain: support.htb0., Site: Default-First-Site-Name)
445/tcp   open  microsoft-ds?
464/tcp   open  kpasswd5?
593/tcp   open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
636/tcp   open  tcpwrapped
3268/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: support.htb0., Site: Default-First-Site-Name)
3269/tcp  open  tcpwrapped
5985/tcp  open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
9389/tcp  open  mc-nmf        .NET Message Framing
49664/tcp open  msrpc         Microsoft Windows RPC
49667/tcp open  msrpc         Microsoft Windows RPC
49674/tcp open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
49679/tcp open  msrpc         Microsoft Windows RPC
49705/tcp open  msrpc         Microsoft Windows RPC
60575/tcp open  msrpc         Microsoft Windows RPC
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
OS fingerprint not ideal because: Missing a closed TCP port so results incomplete
No OS matches for host
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
|_clock-skew: -1s
| smb2-time: 
|   date: 2022-12-07T01:26:56
|_  start_date: N/A
| smb2-security-mode: 
|   3.1.1: 
|_    Message signing enabled and required

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 1105.50 seconds

Enumeration - DNS

Obviously there's a lot going on in the port list, I'll start at the top and see if I can extract anything from the DNS server.

Using dig to grab a BIND DNS banner didn't give me any answers. How about ANY records?

I get a couple subdomains from this. I'll save these for later as I'm not quite sure yet. I'll assume dc is domain controller, although my Windows knowledge is still very fresh. In the meantime, I start a a gobuster DNS brute force to see if there are any other undisclosed subdomains. Time to move on to SMB for a bit.

Enumeration - SMB

Interesting. A read-only share support-tools, what sort of data can we find in there.

Reverse Engineering

UserInfo.exe.zip eh? Unzipped: (oh and by the way, that gobuster DNS brute didn't give anything more)

I originally dragged UserInfo.exe into Ghidraarrow-up-right to decompile it, although that didn't do too well so I tried out DNSpyarrow-up-right and that did a great job at decompiling this .NET binary.

Moving along, I looked through the PE's objects to get a grasp on what this binary does. In the UserInfo.Services namespace, I find the LdapQuery class. Its methods include query() and printUser(). On class initialization, there is a call to Protected.getPassword() which I can assume it may be the LDAP password. That password is then used to login to the support.htb LDAP server through the System.DirectoryServices library. Sounds like a way in, time to check out the getPassword method.

Let's step through the method. First off, it's decoding Protected.enc_password in Base64 format. After that, it copies the character array of the Base64 decoded string, goes into a for loop based on the original array length, and does some XOR and moduli with the key's character index to decrypt it. Sorry to say that security by obscurity doesn't quite work that well.

I'll copy this over in Python to see if I can decrypt it there.

Exploiting LDAP

Alright let's try it. Using the username from LdapQuery initializer and the password we decoded, I tried to do an ldapdomaindump and...

Possibly not using this correctly. I need to read up on LDAP. Good ol' HackTricks GitBook helped me through a lot of service exploitation, here's a section on LDAParrow-up-right. Let's use ldapsearch and filter for sAMAccountName as stated in the LdapQuery query method.

If there's one thing I learned about LDAP, it's that it gives you so many lines of info. Anyways. Lots of stuff, but I see a user named support here. Let's dig into that.

This info field had a string that looked very much like a passphrase. Time to save that.

Getting access

I was stuck for a while, I wasn't sure what to do next even though I had creds to test. I looked back at the nmap scan results again and researched more about Windows administration services. After more consulting with the wonderful HackTricks GitBook, I found WinRMarrow-up-right which might allow me to get command line access to the server. I picked up evil-winrmarrow-up-right to try and authenticate with the server from my Linux box.

After some with evil-winrm's command arguments (I was stuck on having the wrong domain in the -i flag, but apparently it's not needed), finally I have acquired PowerShell access on the server. Now it's time for looting.

Privilege Escalation

Alright, heading to Desktop, I get the user flag and now it's time for privilege escalation. This part was going way over my head. I took a look at the Windows Local Privilege Escalationarrow-up-right section from HackTricks, but nothing seemed too viable. It seemed the support user had limited privileges and was denied access to many system tasks, even stuff as basic as systeminfo. mimikatz it is. Worth a shot.

Alright then, nevermind. WinRM says no. Guess it's back to the drawing board.

Active Directory & Kerberos Abuse

After about half an hour of research, I crawled upon AD/Kerberos abuse which seemed to be my only hope at the moment. Firstly, I wanted to get some PowerShell post-exploitation modules going. With evil-winrm, I uploaded PowerView.ps1arrow-up-right which is a pretty large module, but it would make life easier. Since we didn't seem to have any users with SPN enabled, I think this processarrow-up-right from Red Team Notes is what I'm gonna go with first.

First off, I need to verify we can create new Computer objects to the domain. Looks like we can.

Get-DomainController tells us that we're using Windows Server 2022 Standard. Next I need to find a Computer object which does not have a specific flag set. Viewing all AD computersarrow-up-right, I find the DCcomputer does not have this flag set.

Now let's load PowerMadarrow-up-right and create a Computer object.

Next off, I create a new RawSecurityDescriptor to apply to the DC computer. Now to verify:

Nice, things are lining up. Now, Red Team Notes wants to use Rubeusarrow-up-right to allow raw interactions with Kerberos abuses. I didn't want to compile it on my machine, but I did find a compiled binary herearrow-up-right. I uploaded it through WinRM and continued with the process.

I have the RC4 HMAC, now it's time to impersonate.

Permission denied. Ugh. I attempted this command different times as the writeup on this abusearrow-up-right had some trouble as well.

For now, I need a break as I've been at it for hours. Next time!

Last updated