Understanding Kerberoasting and the Vulnerability of SPNs

New-ADUser -Name "svc-taskrunner" -SamAccountName "svc-taskrunner" -AccountPassword (ConvertTo-SecureString "P@ssword123!" -AsPlainText -Force) -Enabled $true

setspn -a HTTP/DC01.maharjan.com.np svc-taskrunner

impacket-GetUserSPNs -dc-ip 192.168.0.2 'maharjan.com.np/jsmith:UserPassword123!' -request -outputfile krb_tickets.txt

Step 1: Setting up gMSA Infrastructure

New-ADServiceAccount -Name "gmsa-taskrunner" -DNSHostName "gmsa-taskrunner.maharjan.com.np " -PrincipalsAllowedToRetrieveManagedPassword "DC01$"

Step 2: Installing the gMSA on the Application Server

Install-ADServiceAccount -Identity "gmsa-taskrunner"

Set-ADServiceAccount -Identity "gmsa-taskrunner" -KerberosEncryptionType AES128,AES256

Step 3: Replacing the Service Account in Task Scheduler

setspn -q HTTP/*

:: Remove the SPN from the traditional service account
setspn -d HTTP/DC01.maharjan.com.np svc-taskrunner

:: Assign the SPN to the new gMSA account
setspn -a HTTP/DC01.maharjan.com.np gmsa-taskrunner$

impacket-GetUserSPNs -dc-ip 192.168.0.2 ‘maharjan.com.np/jsmith:UserPassword123!’ -request -outputfile krb_tickets.txt

Leave a Reply

Your email address will not be published. Required fields are marked *