Impacket GetUserSPNs & Kerberoasting Explained

VbScrub
9 May 202018:57

Summary

TLDRThis video tutorial delves into the Kerberos Silver Ticket attack technique, demonstrating how to exploit user accounts with Service Principal Names (SPNs) in an Active Directory domain. Using the 'get_userSPNs' script and hashcat, the attacker can capture and decrypt encrypted data to obtain user passwords, all without needing admin rights. The script's process is explained, highlighting the importance of SPNs and the potential risks of setting services to run under user accounts. The tutorial also touches on best practices like using Managed Service Accounts to mitigate such vulnerabilities.

Takeaways

  • ๐Ÿ˜€ The video demonstrates a technique called Kerberos Silver Ticket attack, which exploits user accounts with Service Principal Names (SPNs).
  • ๐Ÿ”’ The attack requires initial domain credentials but does not need special permissions like admin rights.
  • ๐Ÿ–ฅ๏ธ The setup involves two virtual machines: one acting as a domain controller with Active Directory and the other as an attacker machine separate from the domain.
  • ๐Ÿ”Ž The 'get_userSPNs' script from Impacket is used to identify user accounts with SPNs, which are then targeted for the attack.
  • ๐Ÿ”‘ The attack relies on the fact that user accounts often have weaker passwords than computer accounts, making them more susceptible to cracking.
  • ๐Ÿ”„ The process includes using Kerberos authentication to request a Ticket-Granting Service (TGS) ticket, which is encrypted with the user's password.
  • ๐Ÿ“ˆ The TGS ticket, once cracked using hashcat, reveals the user's password, granting the attacker access to the service the account is running.
  • ๐Ÿ› ๏ธ The video mentions the use of managed service accounts or group managed service accounts as a more secure alternative to running services under user accounts.
  • ๐Ÿ”— The script performs an LDAP search to find user accounts with SPNs, which is a crucial step in identifying potential targets for the attack.
  • ๐Ÿ“š The video script serves as an educational guide, explaining the technical aspects of the Kerberos Silver Ticket attack in detail.
  • ๐Ÿ”ฎ The video promises a follow-up on Kerberos Silver Tickets, indicating a deeper exploration of the attack technique in subsequent content.

Q & A

  • What is the Kerberos Silver Ticket attack?

    -The Kerberos Silver Ticket attack is a technique where an attacker uses a user's account password to forge a Ticket-Granting Service (TGS) ticket, which can then be used to gain unauthorized access to services within a domain that authenticate using Kerberos.

  • What is the purpose of using the 'get user SPNs' script in the attack?

    -The 'get user SPNs' script is used to identify user accounts that have Service Principal Names (SPNs) assigned to them. These accounts are vulnerable to the attack because they have services that authenticate with Kerberos.

  • Why is it necessary to have DNS server settings pointing to the domain controller during the attack?

    -DNS server settings need to point to the domain controller because Kerberos authentication requires the use of fully qualified domain names (FQDNs). Correct DNS settings ensure that the attacker can resolve the domain controller's FQDN and perform the attack correctly.

  • What is the significance of the user account having a service principle name (SPN)?

    -A user account with an SPN is significant because it indicates that the account is associated with a service that authenticates with Kerberos. This makes the account a potential target for the Kerberos Silver Ticket attack.

  • What is the role of hashcat in the Kerberos Silver Ticket attack?

    -Hashcat is a password cracking tool used in the attack to decrypt the encrypted data obtained from the Kerberos TGS request. Once decrypted, the user's password can be revealed, allowing the attacker to forge tickets.

  • Why are computer accounts not targeted in the Kerberos Silver Ticket attack?

    -Computer accounts are not targeted because they have very long and complex passwords that are automatically changed by the system every 30 days. Cracking these passwords is impractical due to their length and complexity.

  • How does the attacker use the cracked user account password in the context of the attack?

    -Once the user account password is cracked, the attacker can use it to forge a TGS ticket, pretending to be that user and gaining access to services that the user account has access to within the domain.

  • What is the difference between using a user account and a managed service account to run a service?

    -A user account may have a simple password and can be used to run a service with Kerberos authentication. A managed service account, on the other hand, has a long, complex password that is automatically changed, making it more secure and less susceptible to attacks like the Kerberos Silver Ticket attack.

  • Why might an administrator set a service to run as a user account?

    -An administrator might set a service to run as a user account to grant specific permissions to access resources across the network. This allows for more granular control compared to running the service as a local system or network service account.

  • What is the next step or related attack after successfully performing a Kerberos Silver Ticket attack?

    -After successfully performing a Kerberos Silver Ticket attack, the next step or related attack could be a Pass-the-Hash attack or escalating privileges within the domain using the compromised user account.

Outlines

00:00

๐Ÿ”’ Kerberos Silver Ticket Attack Overview

This paragraph introduces a cybersecurity technique known as the Kerberos Silver Ticket attack. The speaker plans to demonstrate the attack using an 'Impacket' script called 'get_userSPNs' combined with 'hashcat' to extract a user's password. The setup involves two virtual machines: one acting as a domain controller with a basic Active Directory domain, and the other as an attacker machine not part of the domain. The speaker mentions that this attack is similar to previous Kerberos attacks covered in past videos, which targeted accounts without pre-authentication enabled. The process begins with a demonstration and will be followed by an explanation of how the attack works. It is noted that the attack requires some initial domain credentials but does not need special permissions or admin rights.

05:03

๐Ÿ–ฅ๏ธ Setting Up the Attack Environment

The speaker discusses the technical setup for the Kerberos attack, emphasizing the need for fully qualified domain names (FQDNs) over IP addresses for Kerberos authentication. The process involves configuring the attacker machine's DNS server to point to the domain controller and using the 'get_userSPNs' script to identify user accounts with service principal names (SPNs). The script is executed with the domain name, a user account, and its password as parameters. The speaker points out that the attack requires only ordinary domain user credentials and does not necessitate admin-level access.

10:05

๐Ÿ”‘ Cracking Kerberos Tickets with Hashcat

In this section, the speaker demonstrates the use of 'hashcat' to crack the encrypted Kerberos ticket data obtained from the 'get_userSPNs' script. The process involves identifying the correct hash type from 'hashcat' examples and using it to decrypt the ticket, which yields the user's password. The speaker successfully recovers the password for a service account, illustrating that the attack can work against any user account in the domain that runs a service authenticating with Kerberos, using only basic domain credentials.

15:06

๐Ÿ“š Understanding Service Principle Names (SPNs) and Kerberos Vulnerability

The speaker explains the concept of service principal names (SPNs) and their role in Kerberos authentication. SPNs are necessary for services that use Kerberos authentication and are composed of a service name, machine name, and optionally a port number. The speaker clarifies why computer accounts are not targeted in such attacks due to their long, complex passwords that change automatically. In contrast, user accounts with SPNs are vulnerable if they have weak passwords. The speaker also discusses why services might be configured to run under a user account and the security implications of doing so, including the use of managed service accounts as a more secure alternative.

๐Ÿ”„ The Process of the Kerberos Silver Ticket Attack

This paragraph delves into the technical details of how the Kerberos Silver Ticket attack operates. The process begins with authenticating a legitimate user account with the domain controller and conducting an LDAP search to find user accounts with SPNs. When a Ticket-Granting Service (TGS) is requested for a service, the response is encrypted with the password of the account running the service. This encrypted data can be cracked to reveal the account's password, which can then be used to forge tickets claiming membership in any group, effectively bypassing the need for further authentication with the domain controller. The speaker also mentions that this attack serves as a precursor to a more advanced 'silver ticket' attack, which will be covered in a subsequent video.

Mindmap

Keywords

๐Ÿ’กKerberos

Kerberos is a network authentication protocol designed to provide strong authentication for client/server applications by using secret-key cryptography. In the video, Kerberos is the core authentication mechanism being exploited to perform a 'Kerberos Silver Ticket' attack, which involves obtaining a user's password by leveraging the user's service principal names (SPNs).

๐Ÿ’กService Principal Names (SPNs)

Service Principal Names are unique identifiers used by Kerberos to associate a service instance with a domain account. In the script, the 'get user SPNs' script searches for user accounts with SPNs, which are crucial for the attack because they indicate that the account is used to run a service that authenticates with Kerberos.

๐Ÿ’กHashcat

Hashcat is a password recovery tool that uses various techniques to crack hashed passwords. In the context of the video, it is used to crack the encrypted Kerberos ticket, which was obtained by exploiting a user account with SPNs, ultimately revealing the user's password.

๐Ÿ’กActive Directory

Active Directory is a directory service that Microsoft developed for the Windows domain networks. It is used for authentication and provides a centralized location for managing users, computers, and other resources. The video's scenario involves a basic Active Directory domain setup for demonstrating the attack.

๐Ÿ’กDomain Controller

A Domain Controller is a server that handles security and access control for a Windows domain. In the script, the Domain Controller is the target of the Kerberos authentication process, where the attacker manipulates the authentication to gain unauthorized access.

๐Ÿ’กKerberos Silver Ticket

A Kerberos Silver Ticket is a type of ticket that an attacker can forge to gain access to a service within a Windows domain. The video discusses how obtaining a user's password through the described attack can lead to creating a Silver Ticket, which can be used to authenticate as that user to any service within the domain.

๐Ÿ’กPre-authentication

Pre-authentication is a step in the Kerberos authentication process where the client proves its knowledge of the password without sending the password over the network. The video mentions that if pre-authentication is disabled, it could be exploited in a different type of Kerberos attack.

๐Ÿ’กTGS (Ticket-Granting Service)

The Ticket-Granting Service is a part of the Kerberos protocol that issues tickets to access services within the domain. In the script, after obtaining a TGT (Ticket-Granting Ticket), the attacker requests a TGS to access a specific service, which is then used to obtain the encrypted data that can be cracked.

๐Ÿ’กEncryption Type 23

Encryption Type 23 refers to the specific encryption method used in the Kerberos protocol. In the context of the video, it is the encryption type of the TGS reply that the attacker captures and later cracks using Hashcat to reveal the user's password.

๐Ÿ’กManaged Service Accounts

Managed Service Accounts are a type of domain account designed to provide services with a domain account that has automatic password management and the ability to delegate permissions to access resources. The video suggests using Managed Service Accounts as a security measure to mitigate the risk of the described attack.

Highlights

Introduction to Kerberos Silver Ticket attack technique using 'get user SPNs' script and hashcat.

Setup of two virtual machines: one as a domain controller with Active Directory and another as an attacker machine.

Explanation of Kerberos authentication mechanism and its relation to the attack.

Demonstration of the attack using 'get user SPNs' in PowerShell.

Importance of using fully qualified domain names (FQDN) for Kerberos authentication.

Requirement of having initial domain credentials for the attack.

Process of using hashcat to crack the encrypted data obtained from the Kerberos request.

Identification of user accounts with service principal names (SPNs) as potential targets.

Difference between attacking user accounts and computer accounts in the context of Kerberos.

Discussion on why computer accounts are not targeted due to their complex and frequently changed passwords.

Common practice of setting services to run as user accounts in Active Directory.

Explanation of why user accounts with SPNs are vulnerable to Kerberos attacks.

LDAP search demonstration to find user accounts with SPNs.

Wireshark demonstration of the Kerberos handshake process during the attack.

Clarification on how the TGS (Ticket-Granting Service) ticket is encrypted with the service account's password.

The vulnerability arises when the service account's password is compromised, allowing attackers to forge tickets.

Transition to the next video on Kerberos Silver Ticket attacks, extending the capabilities of the initial attack.

Recap of the entire attack process, from obtaining initial credentials to cracking the service account's password.

Transcripts

play00:00

so today we're going to take a look at a

play00:02

technique called Kerberos sting not to

play00:04

do this we're going to use an impact

play00:05

script called get user SPNs

play00:07

and we'll combine that with hash katz

play00:09

and with the two of them we'll be able

play00:10

to get a user accounts password now as

play00:13

usual I've got two virtual machines set

play00:15

up here one that's a domain controller

play00:16

with this very basic Active Directory

play00:18

domain and then another which is our

play00:20

attacker machine which is not a member

play00:21

of the domain completely separate now if

play00:24

you've seen some of my previous videos

play00:25

on Kerberos attacks a lot of this will

play00:27

be very familiar we're basically doing

play00:29

the same thing that we did in the attack

play00:30

where we used in packets get MP users

play00:32

script to attack accounts that don't

play00:35

have Cobras pre authentication enabled

play00:36

is a very similar thing but just with a

play00:39

different part of the Kerberos

play00:40

authentication mechanism so you'll

play00:42

definitely recognize some things if

play00:44

you've seen those videos if not don't

play00:45

worry because I will try and explain

play00:46

things in a decent amount of detail in

play00:48

this one this is also going to leave

play00:50

very nicely into another video which

play00:52

will be coming very soon on Kerberos

play00:54

silver tickets so I think to start with

play00:55

we'll just do a very quick demonstration

play00:57

of the attack and then I'll go through

play00:59

and explain exactly how it works so if

play01:01

we run get user SP ends dr py b in

play01:03

packet script I'm just going to

play01:05

familiarize myself with the syntax again

play01:07

I'm pretty sure we literally just need

play01:09

specify the domain first of all actually

play01:12

as well we need to set our DNS server to

play01:14

point to the machine that were going to

play01:17

be attacking the domain controller to be

play01:19

fair if all you're doing is this get

play01:20

user SPN the script and the Kerberos

play01:22

ting attack you could probably get away

play01:24

with just doing the Dutch tcpip option

play01:26

with the implicit script to specify the

play01:28

DC IP address you probably don't need to

play01:30

set your DNS server but it's going to

play01:32

make things easier when we come to do

play01:33

the Kerberos solve a ticket attack so

play01:34

I'm just going to do it now and it will

play01:36

also mean that we don't need to specify

play01:37

the IP address with this get user SPN

play01:39

script so we're going to here change

play01:41

adapter options because the thing is

play01:43

with Kerberos you need to use fully

play01:45

qualified domain names you can't use IP

play01:47

addresses by default anyway there is an

play01:49

option you can set to enable that but by

play01:52

default if you're using an IP address to

play01:54

connect to something now you won't be

play01:56

using Kerberos authentication or

play01:58

fallback 2011 and for this attack we

play02:00

need to use Kerberos authentication so

play02:01

I'm going to just put in the domain name

play02:05

and then the user account we're going to

play02:07

use that is one thing to point out is

play02:09

that for this attack you need to already

play02:11

have some credentials they don't have to

play02:13

be

play02:13

anything special if we look at this

play02:15

account that I'm going to use it's not a

play02:17

member of any special groups so she just

play02:19

domain users and some random security

play02:21

group as there's no special permissions

play02:24

required for this just any user account

play02:26

in the domain so we're gonna specify the

play02:27

domain and then the user and the

play02:29

password and then that should be all we

play02:33

need actually so let's just try that and

play02:35

there we go we get some results again

play02:37

I'm gonna explain exactly where these

play02:38

results coming from what they all mean

play02:39

but to start where they just want to do

play02:41

a demo off the attack I'm just going to

play02:42

prove that it works for people that just

play02:44

literally want to see a step-by-step

play02:45

guide of how to do it so if we do that

play02:48

again we do - requests we will get TDs

play02:52

or you can just think of it as a load of

play02:54

encrypted data that was encrypted with

play02:56

this accounts password so if we can

play02:58

crack this then we can get this accounts

play03:00

password and that is essentially what

play03:01

the Kerberos ting technique is all about

play03:03

so we'll take all this and we'll just

play03:05

put it into hash cat just copy that and

play03:07

to find out what mode we need to use in

play03:09

hash cat have just gone to the house cat

play03:11

examples we'll just search for Kerberos

play03:14

it's not this one because we're not

play03:16

doing an AS req attack we're doing a TGS

play03:18

attack so it will probably be this on

play03:20

here you can see there we've got the

play03:21

type of encryption is type 23 if we go

play03:24

back to our machine you'll see here

play03:26

we've got type 23 is the encryption type

play03:28

there so we'll just take this number

play03:30

here 13100 M

play03:33

13100 and then we will paste in the

play03:37

information that we got from the script

play03:40

or just say you want to use the rock

play03:42

cued up text file to crack it go through

play03:45

and in a few seconds there we go it was

play03:50

correct it so the password was just set

play03:52

to the same thing that I said leave

play03:53

their account to obviously they would

play03:54

normally be different passwords but you

play03:56

see here the password is just password

play03:57

with zero so we now know the password

play04:01

for that SQL service account and we

play04:03

didn't really have to do anything which

play04:04

is wrong run scripts pass it into hash

play04:06

cat and we get the passwords and that

play04:09

will work for any user account in the

play04:10

domain that has been set to run a

play04:12

service that authenticates with Kerberos

play04:14

and again all we needed with just any

play04:16

domain credentials we don't need any

play04:17

kind of admin rights or anything like

play04:19

that so now that you've seen the attack

play04:20

in action

play04:21

let's take a look at how it actually

play04:22

works and why this works so if we go on

play04:24

to our domain control here

play04:26

and we'll look at what actually makes

play04:28

this account vulnerable essentially it's

play04:30

the fact that it's a user account and

play04:32

it's got in its attributes

play04:35

after the service principle name it's

play04:37

got some values in here that is

play04:39

essentially all that makes it vulnerable

play04:40

to this kind of attack so for an example

play04:42

if we just create a new user account

play04:45

test or just a password to test as well

play04:50

I just got in the habit of always taking

play04:55

those things okay

play04:56

finally test isn't good enough password

play04:58

will just use password with a zero again

play04:59

then my favorite default okay so now

play05:03

we've got that account in there because

play05:04

we haven't set any service principle

play05:06

names on it when we run this script it

play05:10

won't find that account okay so we're

play05:11

not seeing our test account in there but

play05:14

as soon as we add a service principle

play05:16

name you don't have to do this from the

play05:18

attribute editor tab you can do it from

play05:19

PowerShell and there's also a set SPN

play05:21

executable that's included the windows

play05:24

but I'm just used to doing it through

play05:25

here I'm wondering why I can't see and

play05:27

that's because I've got that tick so

play05:28

only shows that we've already got values

play05:30

in them yes if we go into here and we

play05:33

add we just put a test slash test just

play05:36

put anything in there by that and now if

play05:40

we go back to our attack machine when

play05:43

that same script again now we could

play05:45

basically just get the password for this

play05:47

test account because it's got a service

play05:48

principle name set so why is that the

play05:50

case and also why don't we see or why

play05:54

don't we go after computer accounts

play05:56

because if we look at a computer account

play05:57

and we go to the area it's a tab look at

play06:00

service principle name see that's got

play06:02

loads of sales principle names so why

play06:04

aren't we attacking that why doesn't the

play06:06

script find that essentially because

play06:08

computer accounts have very long complex

play06:10

passwords that get automatically set by

play06:12

the system every 30 days I think is by

play06:14

default so trying to crack them is a

play06:18

very very long process potentially

play06:20

impossible I can't remember off the top

play06:22

of my head what the password length is

play06:24

but I've got a feeling it's something

play06:25

like 150 characters of just random bytes

play06:28

so we can't just throw with a rock you

play06:30

password list at it and assume that

play06:32

we'll get cracked or even doing a brute

play06:34

force crack would take forever so that's

play06:37

why we don't graph the computer accounts

play06:38

user accounts on the other hand

play06:40

as you've just seen we can set very dumb

play06:42

passwords for passwords it will probably

play06:44

be in a common password list and it's

play06:46

quite common for people to do this to

play06:47

create a user account to run a service

play06:49

like if we open up services that Emma

play06:51

see this is where an admin would set

play06:54

this so we go to the MS SQL service

play06:58

called SQL Server you can see here that

play07:01

I've set that to run using that service

play07:04

account so this is that account there

play07:07

that SQL servers account we've set it to

play07:09

run as that account we've had to put the

play07:11

password in here and that's a pretty

play07:12

common thing for admins to do because

play07:14

say you've got a service that needs to

play07:16

access some files especially if they're

play07:18

on another server it's got access

play07:19

something across the network if you just

play07:21

leave this running as local system or

play07:23

network service then when this goes to

play07:25

connect out to a file server or whatever

play07:27

to do something with those files say

play07:28

this was running as network service like

play07:30

this one here you've got a grant that

play07:32

account permission to access those files

play07:35

which now means every other service

play07:37

that's running as a network service has

play07:38

permission to access those files and if

play07:41

they were on a remote file server now

play07:43

you've got to grant the computer account

play07:44

for the services running on you've got

play07:46

to grant that permission to access those

play07:47

files which means that any service on

play07:49

this entire computer that can access

play07:52

things over the network has now got

play07:53

permission to access those there are

play07:55

some ways around that I'm not going to

play07:56

go into that too much I'm just trying to

play07:58

give you a rough idea of why someone

play07:59

would actually set a service to run as a

play08:01

user account and like you can use these

play08:03

NT service accounts now that's fine for

play08:05

accessing local files and resources

play08:07

because now you can grant permissions to

play08:09

this virtual service account that's

play08:10

technically the name of them virtual

play08:11

service accounts if you want to look

play08:13

into them more yeah they get created for

play08:15

each service and it'll just be NT

play08:16

service slash the name of the service so

play08:19

yeah that's fine for local access but if

play08:21

you want to access something across the

play08:22

network then again you're gonna have to

play08:24

grant permission to the computer account

play08:25

which means any service on this entire

play08:28

computer can now access those resources

play08:29

and that might not always be desirable

play08:31

so that's a reason for using an actual

play08:33

user account in the domain because now

play08:35

you can grant permissions anywhere on

play08:37

the network to that user account and

play08:38

then set the service to run as that user

play08:40

account and now only that service can

play08:42

access those files and resources the

play08:44

best solution though is to use a managed

play08:46

service accounts or a group managed

play08:47

service account and they are user

play08:50

accounts in Active Directory that

play08:51

essentially behave like computer

play08:53

accounts

play08:53

get their passwords set to those long

play08:55

complex passwords and changed

play08:56

automatically and then you can use them

play08:58

to run a service so that's kind of the

play09:00

solution to this but I'll be honest

play09:02

they're not particularly well I was

play09:04

gonna say they're not well supported

play09:05

they out likely do they work perfectly

play09:08

but actually working with them as a bit

play09:10

of a pain like you can't just right

play09:11

click here and create a new my service

play09:13

account maybe there's some newer tools

play09:15

since I last looked into them that make

play09:17

it easier to use now but yeah when they

play09:18

first came out managed in group managed

play09:20

service accounts you had to do it all

play09:22

with PowerShell and it was a little bit

play09:23

awkward so there we go that was a bit of

play09:25

a long tangent but I hopefully

play09:26

understand that it is kind of common for

play09:28

people to set services to run as a user

play09:31

account from Active Directory so if that

play09:33

service in this case SQL Server that

play09:35

service wants to use Kerberos

play09:37

authentication or wants to support

play09:38

Kerberos authentication it has to have a

play09:40

service principle name that's just part

play09:42

of the way that Kerberos works I'm not

play09:44

going to go into that too much right now

play09:45

but long story short it has to have a

play09:47

service principle name for it in order

play09:49

for it to be able to respond to Kerberos

play09:51

authentication requests and that service

play09:53

principle name as you can see is made up

play09:55

from the service name which can be

play09:57

whatever the service wants it to be and

play09:58

then the Machine name and optionally a

play10:01

port number also optionally you don't

play10:03

have to have the full fully qualified

play10:05

domain name there you'll see in a lot of

play10:06

the default ones here it'll just have or

play10:13

it'll have both sites so I'll have the

play10:14

service and then just the computer name

play10:16

and then I'll have the service and the

play10:17

computer name and the fully qualified

play10:19

domain name that's because when a client

play10:20

tries to connect to one of these

play10:21

services it has a few options of how it

play10:24

could specify the name you see there's

play10:25

different variations again so the

play10:28

service principle names have to support

play10:29

each of those that a client could

play10:30

potentially use so going back to our SQL

play10:33

SVC account so we know that it's got

play10:35

these SP ends how does the in package

play10:38

script take advantage of that go back to

play10:41

our workstation essentially all the

play10:43

script is doing in this part here where

play10:45

we just run it the first time without

play10:46

that request all it's doing is just an

play10:48

LDAP search just to find any user

play10:50

accounts that have got a service

play10:51

principle name we could do this

play10:53

ourselves just as easily and I'm gonna

play10:55

do this from the DC just so I don't have

play10:57

to bother setting up like a reverse

play11:00

shell and but assume that you were doing

play11:02

this remotely you can do this with like

play11:05

LDAP search or if you had a reverse

play11:07

all going on the remote machine you

play11:08

could do it this way but yeah it's just

play11:09

a nailed up so if we do like get a V

play11:11

user we set an LDAP filter do a service

play11:15

principle name equals anything this is

play11:19

going to find any user accounts that

play11:21

I've got a service principle name all

play11:23

right would if I actually put the dash

play11:25

in the right place there we go

play11:26

so what does that found is found the

play11:28

krbtgt account which we can ignore

play11:30

that's a built in Kerberos kind of

play11:33

master key account which I've covered in

play11:34

other videos the golden ticket one

play11:36

specifically but yeah so other than that

play11:38

it's found our SQL SVC account and it's

play11:41

found our test account which is exactly

play11:42

what the impact script found if we

play11:43

wanted to actually see the results so

play11:47

just do properties and we'll say

play11:49

1includes so as principal name so now we

play11:54

can see we get this after we added to

play11:56

the results and it shows us the SPN for

play11:58

each of these accounts so here we're

play11:59

seeing those same SV ends that we saw in

play12:01

actual Directory users and computers so

play12:04

that's essentially all the implicit

play12:05

script is doing at that point it's just

play12:07

doing an LDAP search for user accounts

play12:08

that have any value in the service

play12:10

principal name so nothing crazy there

play12:12

nothing special so we flick back to the

play12:14

workstation what it does when we do dat

play12:16

request though is if we open up

play12:18

Wireshark this is where things will get

play12:22

very familiar for people who have seen

play12:23

the get MP users video we just do a

play12:26

capture on the network card and we run

play12:28

that stop this I'm gonna filter it for

play12:33

Kerberos now what we can see is that we

play12:35

get the normal Kerberos kind of

play12:37

handshake going on to authenticate the

play12:38

user account and this is authenticating

play12:40

legitimate user account the a Smith

play12:42

account and in a previous video where we

play12:45

were looking at Kerberos pre

play12:46

authentication and the get NP user

play12:48

script this part here basically wouldn't

play12:50

happen because if pre off is disabled we

play12:53

kind of skip this part and we go

play12:54

straight to here where we just get back

play12:56

some encrypted data that's encrypted

play12:57

with the users password and we can crack

play12:59

it again that's covered in a previous

play13:01

video I'm not going to go over that now

play13:02

so even though preauth is enabled on

play13:03

this account

play13:04

we've got legitimate credentials for

play13:05

this a Smith account so we're fine then

play13:08

we move on to the tds part now these are

play13:11

doubled here because we've got one where

play13:13

we're requesting that test service and

play13:15

then we've got the one where we're

play13:16

requesting the SQL service so we're just

play13:17

gonna ignore test service or focus on

play13:19

this

play13:20

well part so now going to explain

play13:21

everything that Kerberos does but for

play13:23

this part we're going to focus on just

play13:25

accept that we log on as a legitimate

play13:28

user account we get what's called a TGT

play13:30

and then we can use that TGT to request

play13:33

a ticket for a service the TGT proves

play13:36

that we are who we say we are so in this

play13:37

case we're saying I am a Smith our user

play13:40

account and I want to access this mssql

play13:42

service on this computer the Kerberos

play13:45

service or the domain controller in this

play13:46

case you would think would do some kind

play13:49

of like authorization check to see if

play13:51

this user account is allowed to access

play13:52

this service but it doesn't it just says

play13:55

sure here's a TGS which is another kind

play13:57

of ticket for that service you can use

play13:59

that to access the service now it's then

play14:02

up to the service itself to decide if

play14:03

this user account is allowed which is

play14:05

fine because the service will look at

play14:08

this this encrypted data here which

play14:10

we'll get onto in a second this contains

play14:11

the the user's username and the groups

play14:14

are they're a member of so the service

play14:16

can look at that because it can decrypt

play14:17

this again I'll explain how why in a

play14:19

second

play14:19

it can decrypt that you can see this

play14:21

user is a member of these groups it's

play14:23

got this username this security ID are

play14:25

they allowed in satisfying the access

play14:27

controls how things is still okay it's

play14:29

not as if this part here means that we

play14:30

can now just access every service in the

play14:32

world the service can still easily deny

play14:34

us access but to actually do the

play14:36

Kerberos authentication side of things

play14:37

we need to pass it this TGS ticket and

play14:40

that's what it's sending back to us here

play14:42

this TGS rep is the domain control

play14:44

sending as a ticket the we can then pass

play14:45

on to whatever service this is that

play14:47

we're trying to access so this encrypted

play14:49

part is the important bit really because

play14:51

it's encrypted with this e type of 23

play14:53

and if you remember in the hash code

play14:55

examples let me show you it we ended up

play14:57

using this here because it's a TGS rep

play15:00

and it's a type 23

play15:01

okay so Kerberos TDS rep e type 23 we go

play15:05

back to our machine we'll see we've got

play15:08

the Kerberos TGS rep e type 23 so that's

play15:11

why we use that hash cap mode to decrypt

play15:13

this text here so like I've said

play15:15

multiple times this is encrypted and

play15:16

it's encrypted using the password of the

play15:19

service account that is running this

play15:21

service ok so this is the service front

play15:23

access and those service principle names

play15:25

that we were looking at earlier the SP

play15:27

ends they tie that user account which

play15:29

was called SQL SVC in our case that SQL

play15:32

SVC user account is

play15:33

to this service because it has service

play15:36

principle name that matches this service

play15:38

and this machine name okay so that means

play15:40

that Kerberos and the drain controller

play15:42

knows that that account is what is

play15:44

running this service so when it sends

play15:46

out a TDS for this service again the TDS

play15:49

is just a ticket that the user gets back

play15:51

and that they can then pass on to the

play15:53

service to prove that they are who they

play15:55

say they are and that they are a member

play15:56

of these groups and the way we prove

play15:58

that is the fact that this is encrypted

play16:00

with the password of the service account

play16:02

because the user doesn't know the

play16:04

password of the service account in

play16:05

theory the only things that know the

play16:07

password of the service account are the

play16:09

service because it's running as that

play16:10

service account and the domain

play16:11

controller because that's where the

play16:13

password is stored so that acts as like

play16:14

a shared secret key for all of this and

play16:17

that proves the authenticity of this

play16:19

whole ticket that we're sending so now

play16:22

when the service receives this request

play16:24

from us we pass on this ticket this

play16:25

encrypted ticket to the service it can

play16:28

decrypt it because it's got its own

play16:29

password and then it can read the

play16:31

contents of it if we tried to just fake

play16:33

our own ticket that said I'm a member of

play16:35

the domain admins and we send that off

play16:36

to the service we wouldn't have the

play16:38

password to encrypt this correctly so

play16:40

the service would decrypt it using its

play16:41

password it would just fail the

play16:43

decryption it wouldn't make any sense so

play16:45

we would know this wasn't a legitimate

play16:47

ticket obviously where this all falls

play16:49

down though is if we do manage to get

play16:50

the password for this account which is

play16:52

what we've just done with this attack so

play16:54

then we can just fake this whole ticket

play16:56

ourselves we can say I am a member of

play16:58

domain admins might say it is the

play17:00

administrator SID we could fake it we

play17:03

encrypt all of that with the password

play17:04

that we know for the service account

play17:06

create this whole ticket send it off to

play17:08

the service we don't even have to talk

play17:10

to a domain controller at all we just

play17:11

talk to the service because we use the

play17:14

right password to encrypt all this it

play17:15

can decrypt it thinks it's legitimate

play17:17

and then it thinks we're a member of

play17:19

domain admins and that is basically what

play17:20

Kerberos silver ticket attack is but

play17:22

we're going to look at that in more

play17:23

detail and do a demo of that in the next

play17:25

video but yeah for this one that is

play17:27

probably about it I feel like I've been

play17:30

a little bit quick going over all this

play17:31

stuff and maybe some diagrams would help

play17:33

when we're talking about you know

play17:34

passing tickets around but to be fair

play17:36

there's a lot of examples online if you

play17:38

just search for like Ross authentication

play17:40

diagram or something you'll see exactly

play17:42

how it all kind of flows it's not that

play17:43

complicated it seems it at first

play17:44

especially when you're looking at it in

play17:46

why

play17:47

but it's really fairly straightforward

play17:48

and some good videos and good articles

play17:50

that explain it this is a real quick

play17:51

recap just to kind of rundown of the

play17:53

whole process the whole attack starts by

play17:55

us having some legitimate credentials

play17:57

use those to authenticate with a domain

play17:59

controller and do an LDAP search to find

play18:01

any user accounts that have a service

play18:03

principle name associated with them

play18:05

because that means that when we request

play18:07

a TGS for that service so we request a

play18:09

TDS for this service here we'll get some

play18:12

data back that is encrypted with the

play18:13

password of this account which is what

play18:16

this data here is we can then crack that

play18:18

offline with hash cap and get the

play18:19

password for this account now that's

play18:22

kind of the end of that attack but it

play18:23

feeds very nicely into a silver ticket

play18:25

attack obviously we could now that we've

play18:27

just got the password for this account

play18:28

we could just look around as that

play18:29

account you know maybe that's got access

play18:31

to something special that we didn't have

play18:32

access to with these credentials that's

play18:34

quite likely because it's a service

play18:36

account you can probably do more than a

play18:37

regular user account and so that is a

play18:39

perfectly valid attack on its own but

play18:42

like I say it feels very nicely into a

play18:43

silver ticket attack because now we can

play18:45

forge our own TDs and just claim to be a

play18:48

member of whatever groups who want so I

play18:50

think that covers it let me know if you

play18:51

have any questions I will do my best to

play18:53

answer them in the comments as always

play18:54

and yeah I will see you in the next

play18:56

video

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
Kerberos AttackService Principal NamesPassword CrackingActive DirectorySecurity TechniquesHashcat UsageAuthentication MechanismCybersecurity TutorialDomain ControllerAttack Demonstration